Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public void InstallAndroidDependenciesTest ([Values ("GoogleV2", "Xamarin")] str
// been added to the Xamarin manifest yet.
var xamarin_manifest_needs_updating = false;

AssertCommercialBuild ();
var oldSdkPath = Environment.GetEnvironmentVariable ("TEST_ANDROID_SDK_PATH");
var oldJdkPath = Environment.GetEnvironmentVariable ("TEST_ANDROID_JDK_PATH");
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ public void BuildIncremental ([Values] AndroidRuntime runtime)
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
return;
}
AssertCommercialBuild (); // Incremental build assertions require Fast Deployment

var gradleProject = AndroidGradleProject.CreateDefault (GradleTestProjectDir);
var gradleModule = gradleProject.Modules.First ();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ public void RepetiviteBuildUpdateSingleResource ([Values] AndroidRuntime runtime
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
return;
}
AssertCommercialBuild (); // Incremental build assertions require Fast Deployment

var proj = new XamarinAndroidApplicationProject {
IsRelease = isRelease,
};
Expand Down Expand Up @@ -544,9 +542,7 @@ protected override void OnClick()
Assert.IsFalse (StringAssertEx.ContainsText (b.LastBuildOutput, "AndroidResgen: Warning while updating Resource XML"),
"Warning while processing resources should not have been raised.");
Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true), "Build should have succeeded.");
if (TestEnvironment.CommercialBuildAvailable) {
Assert.IsTrue (b.Output.IsTargetSkipped ("_GenerateJavaStubs"), "Target _GenerateJavaStubs should have been skipped");
}
Assert.IsTrue (b.Output.IsTargetSkipped ("_GenerateJavaStubs"), "Target _GenerateJavaStubs should have been skipped");

lib.Touch ("CustomTextView.cs");

Expand Down Expand Up @@ -1087,14 +1083,10 @@ public string GetFoo () {
appBuilder.Output.AssertTargetIsNotSkipped ("_UpdateAndroidResgen");
foo.Timestamp = DateTimeOffset.UtcNow;
Assert.IsTrue (libBuilder.Build (libProj, doNotCleanupOnUpdate: true, saveProject: false), "Library project should have built");
if (TestEnvironment.CommercialBuildAvailable) {
libBuilder.Output.AssertTargetIsSkipped (target);
}
libBuilder.Output.AssertTargetIsSkipped (target);
appBuilder.BuildLogFile = "build1.log";
Assert.IsTrue (appBuilder.Build (appProj, doNotCleanupOnUpdate: true, saveProject: false), "Application Build should have succeeded.");
if (TestEnvironment.CommercialBuildAvailable) {
appBuilder.Output.AssertTargetIsSkipped ("_UpdateAndroidResgen");
}
appBuilder.Output.AssertTargetIsSkipped ("_UpdateAndroidResgen");
// Check Contents of the file in the apk are correct.
string apk = Path.Combine (Root, appBuilder.ProjectDirectory, appProj.OutputPath, appProj.PackageName + "-Signed.apk");
byte[] rawContentBuildOne = ZipHelper.ReadFileFromZip (apk,
Expand Down Expand Up @@ -1176,16 +1168,12 @@ public void BuildAppWithManagedResourceParser ([Values] AndroidRuntime runtime)
appBuilder.BuildLogFile = "build.log";
Assert.IsTrue (appBuilder.Build (appProj, doNotCleanupOnUpdate: true),
"Normal Application Build should have succeeded.");
if (TestEnvironment.CommercialBuildAvailable) {
Assert.IsTrue (appProj.CreateBuildOutput (appBuilder).IsTargetSkipped ("_ManagedUpdateAndroidResgen", defaultIfNotUsed: true),
"Target '_ManagedUpdateAndroidResgen' should not have run.");
}
Assert.IsTrue (appProj.CreateBuildOutput (appBuilder).IsTargetSkipped ("_ManagedUpdateAndroidResgen", defaultIfNotUsed: true),
"Target '_ManagedUpdateAndroidResgen' should not have run.");
appBuilder.BuildLogFile = "designtimebuild.log";
Assert.IsTrue (appBuilder.DesignTimeBuild (appProj, doNotCleanupOnUpdate: true), "DesignTime Application Build should have succeeded.");
if (TestEnvironment.CommercialBuildAvailable) {
Assert.IsTrue (appProj.CreateBuildOutput (appBuilder).IsTargetSkipped ("_ManagedUpdateAndroidResgen", defaultIfNotUsed: true),
"Target '_ManagedUpdateAndroidResgen' should not have run.");
}
Assert.IsTrue (appProj.CreateBuildOutput (appBuilder).IsTargetSkipped ("_ManagedUpdateAndroidResgen", defaultIfNotUsed: true),
"Target '_ManagedUpdateAndroidResgen' should not have run.");

Assert.IsTrue (appBuilder.Clean (appProj), "Clean should have succeeded");
Assert.IsTrue (File.Exists (designerFile), $"'{designerFile}' should not have been cleaned.");
Expand Down Expand Up @@ -1462,14 +1450,12 @@ public void CustomViewAddResourceId ([Values] AndroidRuntime runtime)
proj.Touch (@"Resources\layout\Main.axml");

Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true), "second build should have succeeded");
if (TestEnvironment.CommercialBuildAvailable) {
Assert.IsTrue (
b.Output.IsTargetPartiallyBuilt ("_CompileResources"),
"The target _CompileResources should have been partially built");
Assert.IsTrue (
b.Output.IsTargetSkipped ("_FixupCustomViewsForAapt2", defaultIfNotUsed: true),
"The target _FixupCustomViewsForAapt2 should have been skipped");
}
Assert.IsTrue (
b.Output.IsTargetPartiallyBuilt ("_CompileResources"),
"The target _CompileResources should have been partially built");
Assert.IsTrue (
b.Output.IsTargetSkipped ("_FixupCustomViewsForAapt2", defaultIfNotUsed: true),
"The target _FixupCustomViewsForAapt2 should have been skipped");

var r_java = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "android", "src", proj.PackageNameJavaIntermediatePath, "R.java");
FileAssert.Exists (r_java);
Expand Down Expand Up @@ -1529,9 +1515,7 @@ BuildItem CreateItem (string include) =>
using (var b = CreateApkBuilder ()) {
Assert.IsTrue (b.Build (proj), "first build should have succeeded.");
Assert.IsTrue (b.Build (proj), "second build should have succeeded.");
if (TestEnvironment.CommercialBuildAvailable) {
b.Output.AssertTargetIsSkipped ("_CompileResources");
}
b.Output.AssertTargetIsSkipped ("_CompileResources");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,12 @@ public void BuildAotApplicationWithNdkAndBundleAndÜmläüts (string supportedAb
}
}
Assert.IsTrue (b.Build (proj), "Second Build should have succeeded.");
if (TestEnvironment.CommercialBuildAvailable) {
Assert.IsTrue (
b.Output.IsTargetSkipped ("_CompileJava"),
"the _CompileJava target should be skipped");
Assert.IsTrue (
b.Output.IsTargetSkipped ("_BuildApkEmbed"),
"the _BuildApkEmbed target should be skipped");
}
Assert.IsTrue (
b.Output.IsTargetSkipped ("_CompileJava"),
"the _CompileJava target should be skipped");
Assert.IsTrue (
b.Output.IsTargetSkipped ("_BuildApkEmbed"),
"the _BuildApkEmbed target should be skipped");
}
}

Expand Down Expand Up @@ -289,14 +287,12 @@ public void BuildAotApplicationAndÜmläüts (string supportedAbis, bool enableL
}
}
Assert.IsTrue (b.Build (proj), "Second Build should have succeeded.");
if (TestEnvironment.CommercialBuildAvailable) {
Assert.IsTrue (
b.Output.IsTargetSkipped ("_CompileJava"),
"the _CompileJava target should be skipped");
Assert.IsTrue (
b.Output.IsTargetSkipped ("_BuildApkEmbed"),
"the _BuildApkEmbed target should be skipped");
}
Assert.IsTrue (
b.Output.IsTargetSkipped ("_CompileJava"),
"the _CompileJava target should be skipped");
Assert.IsTrue (
b.Output.IsTargetSkipped ("_BuildApkEmbed"),
"the _BuildApkEmbed target should be skipped");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,9 @@ public void BuildApplicationWithAssetPack ([Values] bool isRelease, [Values] And
Assert.IsFalse (zip.ContainsEntry ("assetpack1/resources.pb"), "aab should not contain assetpack1/resources.pb");
}
Assert.IsTrue (appBuilder.Build (app, doNotCleanupOnUpdate: true, saveProject: false), $"{app.ProjectName} should succeed");
if (TestEnvironment.CommercialBuildAvailable) {
appBuilder.Output.AssertTargetIsSkipped ("_CreateAssetPackManifests");
appBuilder.Output.AssertTargetIsSkipped ("_BuildAssetPacks");
appBuilder.Output.AssertTargetIsSkipped ("_GenerateAndroidAssetsDir");
}
appBuilder.Output.AssertTargetIsSkipped ("_CreateAssetPackManifests");
appBuilder.Output.AssertTargetIsSkipped ("_BuildAssetPacks");
appBuilder.Output.AssertTargetIsSkipped ("_GenerateAndroidAssetsDir");
FileAssert.Exists (asset3File, $"file {asset3File} should exist.");
asset3.TextContent = () => "Asset3 Updated";
asset3.Timestamp = DateTime.UtcNow.AddSeconds(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ public void BindingLibraryIncremental (string classParser, AndroidRuntime runtim
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
return;
}
AssertCommercialBuild (); // Incremental build assertions require Fast Deployment

var targets = new List<string> {
"_ExportJarToXml",
"GenerateBindings",
Expand Down Expand Up @@ -884,10 +882,8 @@ public void BindingWithAndroidJavaSource ([Values] AndroidRuntime runtime)
"generated", "src", "Com.Xamarin.Android.Test.Msbuildtest.IJavaSourceTestInterface.cs");
StringAssertEx.ContainsText (File.ReadAllLines (generatedIface), "string GreetWithQuestion (string name, global::Java.Util.Date date, string question);");
Assert.IsTrue (libBuilder.Build (lib), "Library build should have succeeded.");
if (TestEnvironment.CommercialBuildAvailable) {
Assert.IsTrue (libBuilder.Output.IsTargetSkipped ("_CompileBindingJava", defaultIfNotUsed: true), $"`_CompileBindingJava` should be skipped on second build!");
Assert.IsTrue (libBuilder.Output.IsTargetSkipped ("_ClearGeneratedManagedBindings", defaultIfNotUsed: true), $"`_ClearGeneratedManagedBindings` should be skipped on second build!");
}
Assert.IsTrue (libBuilder.Output.IsTargetSkipped ("_CompileBindingJava", defaultIfNotUsed: true), $"`_CompileBindingJava` should be skipped on second build!");
Assert.IsTrue (libBuilder.Output.IsTargetSkipped ("_ClearGeneratedManagedBindings", defaultIfNotUsed: true), $"`_ClearGeneratedManagedBindings` should be skipped on second build!");
FileAssert.Exists (generatedCode, $"'{generatedCode}' should have not be deleted on second build.");
Assert.IsTrue (libBuilder.DesignTimeBuild (lib, target: "UpdateGeneratedFiles"), "DTB should have succeeded.");
FileAssert.Exists (generatedCode, $"'{generatedCode}' should have not be deleted on DTB build.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public partial class BuildTest : BaseTest
/* debugSymbols */ true ,
/* optimize */ true ,
/* embedassebmlies */ false ,
/* expectedResult */ TestEnvironment.CommercialBuildAvailable ? "debug" : "release",
/* expectedResult */ "debug",
},
new object[] {
/* supportedAbi */ "armeabi-v7a",
Expand All @@ -183,7 +183,7 @@ public partial class BuildTest : BaseTest
/* debugSymbols */ false ,
/* optimize */ null ,
/* embedassebmlies */ null ,
/* expectedResult */ TestEnvironment.CommercialBuildAvailable ? "debug" : "release",
/* expectedResult */ "debug",
},
};
#pragma warning restore 414
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot, bo
Assert.AreEqual (XABuildConfig.AndroidDefaultTargetDotnetApiLevel.Major.ToString (),
uses_sdk.Attribute (ns + "targetSdkVersion").Value);

bool expectEmbeddedAssembies = !(TestEnvironment.CommercialBuildAvailable && !isRelease);
bool expectEmbeddedAssembies = isRelease;
var apkPath = Path.Combine (outputPath, $"{proj.PackageName}-Signed.apk");
FileAssert.Exists (apkPath);
var helper = new ArchiveAssemblyHelper (apkPath, usesAssemblyStore, rids);
if (runtime != AndroidRuntime.NativeAOT) {
helper.AssertContainsEntry ($"assemblies/{proj.ProjectName}.dll", shouldContainEntry: expectEmbeddedAssembies);
helper.AssertContainsEntry ($"assemblies/{proj.ProjectName}.pdb", shouldContainEntry: !TestEnvironment.CommercialBuildAvailable && !isRelease);
helper.AssertContainsEntry ($"assemblies/{proj.ProjectName}.pdb", shouldContainEntry: false);
helper.AssertContainsEntry ($"assemblies/Mono.Android.dll", shouldContainEntry: expectEmbeddedAssembies);
helper.AssertContainsEntry ($"assemblies/es/{proj.ProjectName}.resources.dll", shouldContainEntry: expectEmbeddedAssembies);
helper.AssertContainsEntry ($"assemblies/de-DE/{proj.ProjectName}.resources.dll", shouldContainEntry: expectEmbeddedAssembies);
Expand Down Expand Up @@ -1266,8 +1266,6 @@ public void FastDeploymentDoesNotAddContentProvider ([Values (AndroidRuntime.Mon
return;
}

AssertCommercialBuild ();

var proj = new XamarinAndroidApplicationProject {
EmbedAssembliesIntoApk = false,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,6 @@ public void BuildXamarinFormsMapsApplication ([Values] bool multidex, [Values (A
if (IgnoreUnsupportedConfiguration (runtime, release: false)) {
return;
}
AssertCommercialBuild (); // Incremental build assertions require Fast Deployment

var proj = new XamarinFormsMapsApplicationProject ();
proj.SetRuntime (runtime);

Expand Down Expand Up @@ -1167,19 +1165,17 @@ public CustomTextView(Context context, IAttributeSet attributes) : base(context,
FileAssert.Exists (designtime_build_props, "designtime/build.props should exist after the second `Build`.");

//NOTE: none of these targets should run, since we have not actually changed anything!
if (TestEnvironment.CommercialBuildAvailable) {
var targetsToBeSkipped = new [] {
//TODO: We would like for this assertion to work, but the <Compile /> item group changes between DTB and regular builds
// $(IntermediateOutputPath)designtime\Resource.designer.cs -> Resources\Resource.designer.cs
// And so the built assembly changes between DTB and regular build, triggering `_LinkAssembliesNoShrink`
//"_LinkAssembliesNoShrink",
"_UpdateAndroidResgen",
"_BuildLibraryImportsCache",
"_CompileJava",
};
foreach (var targetName in targetsToBeSkipped) {
Assert.IsTrue (b.Output.IsTargetSkipped (targetName), $"`{targetName}` should be skipped!");
}
var targetsToBeSkipped = new [] {
//TODO: We would like for this assertion to work, but the <Compile /> item group changes between DTB and regular builds
// $(IntermediateOutputPath)designtime\Resource.designer.cs -> Resources\Resource.designer.cs
// And so the built assembly changes between DTB and regular build, triggering `_LinkAssembliesNoShrink`
//"_LinkAssembliesNoShrink",
"_UpdateAndroidResgen",
"_BuildLibraryImportsCache",
"_CompileJava",
};
foreach (var targetName in targetsToBeSkipped) {
Assert.IsTrue (b.Output.IsTargetSkipped (targetName), $"`{targetName}` should be skipped!");
}

b.Target = "Clean";
Expand Down Expand Up @@ -1319,15 +1315,13 @@ public void CheckTimestamps ([Values] bool isRelease, [Values] AndroidRuntime ru
//One last build with no changes
Assert.IsTrue (b.Build (proj), "third build should have succeeded.");

if (TestEnvironment.CommercialBuildAvailable) {
// NativeAOT always runs the linking step
if (runtime != AndroidRuntime.NativeAOT) {
b.Output.AssertTargetIsSkipped (isRelease ? KnownTargets.LinkAssembliesShrink : KnownTargets.LinkAssembliesNoShrink);
}
b.Output.AssertTargetIsSkipped ("_UpdateAndroidResgen");
b.Output.AssertTargetIsSkipped ("_BuildLibraryImportsCache");
b.Output.AssertTargetIsSkipped ("_CompileJava");
// NativeAOT always runs the linking step
if (runtime != AndroidRuntime.NativeAOT) {
b.Output.AssertTargetIsSkipped (isRelease ? KnownTargets.LinkAssembliesShrink : KnownTargets.LinkAssembliesNoShrink);
}
b.Output.AssertTargetIsSkipped ("_UpdateAndroidResgen");
b.Output.AssertTargetIsSkipped ("_BuildLibraryImportsCache");
b.Output.AssertTargetIsSkipped ("_CompileJava");
}
}

Expand Down Expand Up @@ -1888,8 +1882,6 @@ public void BuildAppCheckDebugSymbols ([Values] AndroidRuntime runtime)
return;
}

AssertCommercialBuild (); // FIXME: when Fast Deployment isn't available, we would need to use `llvm-objcopy` to extract the debug symbols

var path = Path.Combine ("temp", TestName);
var lib = new XamarinAndroidLibraryProject () {
IsRelease = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,6 @@ public void LibraryProjectsShouldSkipGetPrimaryCpuAbi ([Values] AndroidRuntime r
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
return;
}
AssertCommercialBuild ();

const string target = "_GetPrimaryCpuAbi";
var proj = new XamarinAndroidLibraryProject ();
using (var b = CreateDllBuilder ()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class DebuggingTasksTests : BaseTest
[OneTimeSetUp]
public void SetUp ()
{
AssertCommercialBuild ();
}

// https://github.com/xamarin/monodroid/blob/63bbeb076d809c74811a8001d38bf2e9e8672627/tests/msbuild/nunit/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests/ResolveXamarinAndroidToolsTests.cs
Expand Down
Loading