Skip to content

Commit

Permalink
Merge branch 'main' into llvm-generator-update
Browse files Browse the repository at this point in the history
* main:
  Bump to dotnet/installer@28d4a6b4be 8.0.100-preview.7.23330.16 (dotnet#8162)
  [Xamarin.Android.Build.Tasks] Move MonoAndroidAssetsDirIntermediate (dotnet#8166)
  [xaprepare] update Debian dependencies for current unstable (trixie) (dotnet#8169)
  [CI] Use dotnet test slicer in nightly tests (dotnet#8154)
  [Xamarin.Android.Build.Tasks] MarshalMethodsAssemblyRewriter+new file (dotnet#8151)
  Bump to dotnet/installer@d2a244f560 8.0.100-preview.7.23325.5 (dotnet#8142)
  • Loading branch information
grendello committed Jul 6, 2023
2 parents 1d43520 + 517a59a commit 80c4fb4
Show file tree
Hide file tree
Showing 14 changed files with 293 additions and 479 deletions.
343 changes: 68 additions & 275 deletions build-tools/automation/azure-pipelines-nightly.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ class LinuxDebian : LinuxDebianCommon
new DebianLinuxProgram ("openjdk-8-jdk"),
};

static readonly List<DebianLinuxProgram> packagesPreTrixie = new List<DebianLinuxProgram> {
new DebianLinuxProgram ("libncurses5-dev"),
};

static readonly List<DebianLinuxProgram> packagesTrixieAndLater = new List<DebianLinuxProgram> {
new DebianLinuxProgram ("libncurses-dev"),
};

// zulu-8 does NOT exist as official Debian package! We need it for our bots, but we have to figure out what to
// do with Debian 10+ in general, as it does not contain OpenJDK 8 anymore and we require it to work.
static readonly List<DebianLinuxProgram> packages10AndNewerBuildBots = new List<DebianLinuxProgram> {
Expand Down Expand Up @@ -45,8 +53,26 @@ protected override void InitializeDependencies ()
if (DebianRelease.Major >= 10 || (IsTesting && String.Compare ("buster", CodeName, StringComparison.OrdinalIgnoreCase) == 0)) {
if (Context.IsRunningOnHostedAzureAgent)
Dependencies.AddRange (packages10AndNewerBuildBots);
} else
if (DebianRelease.Major >= 13) {
Dependencies.AddRange (packagesTrixieAndLater);
} else {
Dependencies.AddRange (packagesPreTrixie);
}
} else {
Dependencies.AddRange (packagesPre10);
Dependencies.AddRange (packagesPreTrixie);
}
}

static bool IsDebian13OrNewer (string? version)
{
if (String.IsNullOrEmpty (version)) {
return false;
}

return
version.IndexOf ("trixie", StringComparison.OrdinalIgnoreCase) >= 0 ||
version.IndexOf ("sid", StringComparison.OrdinalIgnoreCase) >= 0;
}

static bool IsDebian10OrNewer (string? version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ abstract class LinuxDebianCommon : Linux
new DebianLinuxProgram ("g++-mingw-w64"),
new DebianLinuxProgram ("gcc-mingw-w64"),
new DebianLinuxProgram ("git"),
new DebianLinuxProgram ("libncurses5-dev"),
new DebianLinuxProgram ("libtool"),
new DebianLinuxProgram ("libz-mingw-w64-dev"),
new DebianLinuxProgram ("linux-libc-dev"),
Expand Down
20 changes: 10 additions & 10 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="8.0.100-preview.6.23318.1">
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="8.0.100-preview.7.23330.16">
<Uri>https://github.com/dotnet/installer</Uri>
<Sha>8d98e5a6ba7f7fbc157ebea6317d8e7418472920</Sha>
<Sha>28d4a6b4bed1515bdbe491c9e0c8ef7aa3a24497</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="8.0.0-preview.6.23316.3" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="8.0.0-preview.7.23329.8" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>76da696f3ffdd81506b09dfc440ee6f4e1001868</Sha>
<Sha>3e87528325b09f884b0a09a8c4ef79393abfd0db</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="8.0.0-preview.6.23316.3" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Dependency Name="Microsoft.NETCore.App.Ref" Version="8.0.0-preview.7.23329.8" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>76da696f3ffdd81506b09dfc440ee6f4e1001868</Sha>
<Sha>3e87528325b09f884b0a09a8c4ef79393abfd0db</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport" Version="8.0.0-preview.6.23312.1" CoherentParentDependency="Microsoft.NETCore.App.Ref">
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport" Version="8.0.0-preview.7.23326.1" CoherentParentDependency="Microsoft.NETCore.App.Ref">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>1640faa87e2e7656bf20dfe38eb8ea3cc3b9e806</Sha>
<Sha>60a73f97a0ec16c25ce4d36b1bcff1fedb831716</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.4-alpha.23312.1" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.4-alpha.23327.1" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
<Uri>https://github.com/dotnet/cecil</Uri>
<Sha>ad66dcb8a04dabce995d3557832ed8d53e594d0c</Sha>
<Sha>3e46711f5a933551557286d211970faa08b07b7e</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
Expand Down
10 changes: 5 additions & 5 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project>
<!--Package versions-->
<PropertyGroup>
<MicrosoftDotnetSdkInternalPackageVersion>8.0.100-preview.6.23318.1</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftNETILLinkTasksPackageVersion>8.0.0-preview.6.23316.3</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>8.0.0-preview.6.23316.3</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftDotnetSdkInternalPackageVersion>8.0.100-preview.7.23330.16</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftNETILLinkTasksPackageVersion>8.0.0-preview.7.23329.8</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>8.0.0-preview.7.23329.8</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftDotNetApiCompatPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetApiCompatPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>8.0.0-preview.6.23312.1</MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>8.0.0-preview.7.23326.1</MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion>
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
<MicrosoftTemplateEngineTasksPackageVersion>7.0.100-rc.1.22410.7</MicrosoftTemplateEngineTasksPackageVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.23312.1</MicrosoftDotNetCecilPackageVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.23327.1</MicrosoftDotNetCecilPackageVersion>
<SystemIOHashingPackageVersion>$(MicrosoftNETCoreAppRefPackageVersion)</SystemIOHashingPackageVersion>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2560,5 +2560,22 @@ public void CheckLintResourceFileReferencesAreFixed ()
StringAssertEx.DoesNotContain (errorFilePath, b.LastBuildOutput, $"Path {errorFilePath} should have been replaced.");
}
}

[Test]
public void SimilarAndroidXAssemblyNames ([Values(true, false)] bool publishTrimmed)
{
var proj = new XamarinAndroidApplicationProject {
IsRelease = true,
AotAssemblies = publishTrimmed,
PackageReferences = {
new Package { Id = "Xamarin.AndroidX.CustomView", Version = "1.1.0.17" },
new Package { Id = "Xamarin.AndroidX.CustomView.PoolingContainer", Version = "1.0.0.4" },
}
};
proj.SetProperty (KnownProperties.PublishTrimmed, publishTrimmed.ToString());
proj.MainActivity = proj.DefaultMainActivity.Replace ("//${AFTER_ONCREATE}", "AndroidX.CustomView.PoolingContainer.PoolingContainer.IsPoolingContainer (null);");
using var builder = CreateApkBuilder ();
Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static CodeBehindTests ()
{
TestProjectRootDirectory = Path.GetFullPath (Path.Combine (XABuildPaths.TopDirectory, "tests", "CodeBehind", "BuildTests"));
CommonSampleLibraryRootDirectory = Path.GetFullPath (Path.Combine (XABuildPaths.TopDirectory, "tests", "CodeBehind", CommonSampleLibraryName));
TestOutputDir = Path.Combine (SetUp.TestDirectoryRoot, "temp", "CodeBehind");
TestOutputDir = Path.Combine (XABuildPaths.TestOutputDirectory, "temp", "CodeBehind");
if (Builder.UseDotNet) {
ProjectName += ".NET";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public bool Build (string projectOrSolution, string target, string [] parameters
static EmbeddedDSOTests ()
{
TestProjectRootDirectory = Path.GetFullPath (Path.Combine (XABuildPaths.TopDirectory, "tests", "EmbeddedDSOs", "EmbeddedDSO"));
TestOutputDir = Path.Combine (SetUp.TestDirectoryRoot, "temp", "EmbeddedDSO");
TestOutputDir = Path.Combine (XABuildPaths.TestOutputDirectory, "temp", "EmbeddedDSO");

produced_binaries = new List <string> {
$"{ProjectAssemblyName}.dll",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,58 +23,9 @@ public class BaseTest
public static ConcurrentDictionary<string, string> TestOutputDirectories = new ConcurrentDictionary<string, string> ();
public static ConcurrentDictionary<string, string> TestPackageNames = new ConcurrentDictionary<string, string> ();

[SetUpFixture]
public class SetUp
{
public static string TestDirectoryRoot {
get;
private set;
}

[OneTimeSetUp]
public void BeforeAllTests ()
{
TestDirectoryRoot = XABuildPaths.TestOutputDirectory;
}

[OneTimeTearDown]
public void AfterAllTests ()
{
if (System.Diagnostics.Debugger.IsAttached)
return;

//NOTE: adb.exe can cause a couple issues on Windows
// 1) it holds a lock on ~/android-toolchain, so a future build that needs to delete/recreate would fail
// 2) the MSBuild <Exec /> task *can* hang until adb.exe exits

try {
RunAdbCommand ("kill-server", true);
} catch (Exception ex) {
Console.Error.WriteLine ("Failed to run adb kill-server: " + ex);
}

//NOTE: in case `adb kill-server` fails, kill the process as a last resort
foreach (var p in Process.GetProcessesByName ("adb.exe"))
p.Kill ();
}

}

protected bool IsWindows => TestEnvironment.IsWindows;

protected bool IsMacOS => TestEnvironment.IsMacOS;

protected bool IsLinux => TestEnvironment.IsLinux;

public string StagingPath {
get { return Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); }
}

public string Root {
get {
return Path.GetFullPath (SetUp.TestDirectoryRoot);
}
}
public string Root => Path.GetFullPath (XABuildPaths.TestOutputDirectory);

public static bool CommercialBuildAvailable => TestEnvironment.CommercialBuildAvailable;

Expand Down Expand Up @@ -569,6 +520,28 @@ public void TestSetup ()
TestContext.Out.Flush ();
}

[OneTimeTearDown]
protected virtual void AfterAllTests ()
{
if (System.Diagnostics.Debugger.IsAttached)
return;

//NOTE: adb.exe can cause a couple issues on Windows
// 1) it holds a lock on ~/android-toolchain, so a future build that needs to delete/recreate would fail
// 2) the MSBuild <Exec /> task *can* hang until adb.exe exits
if (IsWindows) {
try {
RunAdbCommand ("kill-server", true);
} catch (Exception ex) {
Console.Error.WriteLine ("Failed to run adb kill-server: " + ex);
}

//NOTE: in case `adb kill-server` fails, kill the process as a last resort
foreach (var p in Process.GetProcessesByName ("adb.exe"))
p.Kill ();
}
}

[TearDown]
protected virtual void CleanupTest ()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void DeviceSetup ()
}

[OneTimeTearDown]
public void DeviceTearDown ()
protected virtual void DeviceTearDown ()
{
if (IsDeviceAttached ()) {
// make sure we are not on a guest user anymore.
Expand Down Expand Up @@ -199,11 +199,16 @@ protected static void RunProjectAndAssert (XamarinAndroidApplicationProject proj
builder.BuildLogFile = logName;
Assert.True (builder.RunTarget (proj, "_Run", doNotCleanupOnUpdate: doNotCleanupOnUpdate, parameters: parameters), "Project should have run.");
} else {
var result = AdbStartActivity ($"{proj.PackageName}/{proj.JavaPackageName}.MainActivity");
Assert.IsTrue (result.Contains ("Starting: Intent { cmp="), $"Attempt to start activity failed with:\n{result}");
StartActivityAndAssert (proj);
}
}

protected static void StartActivityAndAssert (XamarinAndroidApplicationProject proj)
{
var result = AdbStartActivity ($"{proj.PackageName}/{proj.JavaPackageName}.MainActivity");
Assert.IsTrue (result.Contains ("Starting: Intent { cmp="), $"Attempt to start activity failed with:\n{result}");
}

protected TimeSpan ProfileFor (Func<bool> func, TimeSpan? timeout = null)
{
var stopwatch = new Stopwatch ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ public void Rewrite (DirectoryAssemblyResolver resolver, List<string> targetAsse
foreach (AssemblyDefinition asm in uniqueAssemblies) {
foreach (string path in GetAssemblyPaths (asm)) {
var writerParams = new WriterParameters {
WriteSymbols = (File.Exists (path + ".mdb") || File.Exists (Path.ChangeExtension (path, ".pdb"))),
WriteSymbols = File.Exists (Path.ChangeExtension (path, ".pdb")),
};


string output = $"{path}.new";
string directory = Path.Combine (Path.GetDirectoryName (path), "new");
Directory.CreateDirectory (directory);
string output = Path.Combine (directory, Path.GetFileName (path));
log.LogDebugMessage ($"Writing new version of assembly: {output}");

// TODO: this should be used eventually, but it requires that all the types are reloaded from the assemblies before typemaps are generated
Expand All @@ -137,36 +138,23 @@ public void Rewrite (DirectoryAssemblyResolver resolver, List<string> targetAsse
// versions around.
foreach (string path in newAssemblyPaths) {
string? pdb = null;
string? mdb = null;

string source = Path.ChangeExtension (Path.Combine (Path.GetDirectoryName (path), Path.GetFileNameWithoutExtension (path)), ".pdb");
string source = Path.ChangeExtension (path, ".pdb");
if (File.Exists (source)) {
pdb = source;
}

source = $"{path}.mdb";
if (File.Exists (source)) {
mdb = source;
}

foreach (string targetPath in targetAssemblyPaths) {
string target = Path.Combine (targetPath, Path.GetFileNameWithoutExtension (path));
string target = Path.Combine (targetPath, Path.GetFileName (path));
CopyFile (path, target);

if (!String.IsNullOrEmpty (pdb)) {
target = Path.ChangeExtension (Path.Combine (targetPath, Path.GetFileNameWithoutExtension (pdb)), ".pdb");
CopyFile (pdb, target);
}

if (!String.IsNullOrEmpty (mdb)) {
target = Path.Combine (targetPath, Path.ChangeExtension (Path.GetFileName (path), ".mdb"));
CopyFile (mdb, target);
CopyFile (pdb, Path.ChangeExtension (target, ".pdb"));
}
}

RemoveFile (path);
RemoveFile (pdb);
RemoveFile (mdb);
}

void CopyFile (string source, string target)
Expand All @@ -182,6 +170,7 @@ void RemoveFile (string? path)
}

try {
log.LogDebugMessage ($"Deleting: {path}");
File.Delete (path);
} catch (Exception ex) {
log.LogWarning ($"Unable to delete source file '{path}'");
Expand Down
16 changes: 8 additions & 8 deletions src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<AndroidPackagingOptionsExclude Include="$([MSBuild]::Escape('*.kotlin_*'))" />
</ItemGroup>

<!-- Assets build properties -->
<PropertyGroup>
<MonoAndroidAssetsDirIntermediate>$(IntermediateOutputPath)assets\</MonoAndroidAssetsDirIntermediate>
<MonoAndroidAssetsPrefix Condition="'$(MonoAndroidAssetsPrefix)' == ''">Assets</MonoAndroidAssetsPrefix>
</PropertyGroup>

<!--
*******************************************
Imports
Expand Down Expand Up @@ -439,7 +445,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
Outputs="$(MonoAndroidAssetsDirIntermediate)xa-internal/xa-mam-mapping.xml">
<MakeDir
Condition=" '@(_AndroidMamMappingFile->Count())' != '0' "
Directories="$(MonoAndroidAssetsDirIntermediate)/xa-internal"
Directories="$(MonoAndroidAssetsDirIntermediate)xa-internal"
/>
<MamJsonToXml
MappingFiles="@(_AndroidMamMappingFile)"
Expand All @@ -464,7 +470,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
Outputs="$(_XARemapMembersFilePath)">
<MakeDir
Condition=" '@(_AndroidRemapMembers->Count())' != '0' "
Directories="$(MonoAndroidAssetsDirIntermediate)/xa-internal"
Directories="$(MonoAndroidAssetsDirIntermediate)xa-internal"
/>
<MergeRemapXml
InputRemapXmlFiles="@(_AndroidRemapMembers)"
Expand Down Expand Up @@ -880,12 +886,6 @@ because xbuild doesn't support framework reference assemblies.
/>
</Target>

<!-- Assets build properties -->
<PropertyGroup>
<MonoAndroidAssetsDirIntermediate>$(IntermediateOutputPath)assets\</MonoAndroidAssetsDirIntermediate>
<MonoAndroidAssetsPrefix Condition="'$(MonoAndroidAssetsPrefix)' == ''">Assets</MonoAndroidAssetsPrefix>
</PropertyGroup>

<!-- Assets Build -->

<Target Name="UpdateAndroidAssets"
Expand Down
Loading

0 comments on commit 80c4fb4

Please sign in to comment.