diff --git a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Common/ImportAfter/Xamarin.Android.Windows.targets b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Common/ImportAfter/Xamarin.Android.Windows.targets index 7b16e67727c..e2e05a2e53b 100644 --- a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Common/ImportAfter/Xamarin.Android.Windows.targets +++ b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Common/ImportAfter/Xamarin.Android.Windows.targets @@ -11,16 +11,6 @@ Copyright (C) 2014 Xamarin. All rights reserved. Xamarin - <_IsRunningXBuild Condition=" '$(MSBuildRuntimeVersion)' == '' ">true - - - - - - - - diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs index 7970c43c3a1..9457a249165 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidUpdateResourcesTest.cs @@ -73,6 +73,7 @@ public void DesignTimeBuild ([Values(false, true)] bool isRelease, [Values (fals new BuildItem.ProjectReference (@"..\Lib1\Lib1.csproj", lib.ProjectName, lib.ProjectGuid), }, }; + var baseIntermediateOutputPath = Path.Combine (path, proj.ProjectName, "obj"); var intermediateOutputPath = Path.Combine (path, proj.ProjectName, proj.IntermediateOutputPath); proj.SetProperty ("AndroidUseManagedDesignTimeResourceGenerator", useManagedParser.ToString ()); if (useManagedParser) @@ -100,7 +101,7 @@ public void DesignTimeBuild ([Values(false, true)] bool isRelease, [Values (fals first = items.First (); Assert.IsTrue (items.All (x => x == first), "All Items should have matching values"); } - var designTimeDesigner = Path.Combine (intermediateOutputPath, "designtime", "Resource.designer.cs"); + var designTimeDesigner = Path.Combine (baseIntermediateOutputPath, proj.GetProperty (KnownProperties.Configuration) + "_Resource.designer.cs"); if (useManagedParser) { FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should have been created."); } @@ -1000,7 +1001,7 @@ public void BuildAppWithManagedResourceParser() "DesignTime Application Build should have succeeded."); Assert.IsFalse (appProj.CreateBuildOutput (appBuilder).IsTargetSkipped ("_ManagedUpdateAndroidResgen"), "Target '_ManagedUpdateAndroidResgen' should have run."); - var designerFile = Path.Combine (Root, path, appProj.ProjectName, appProj.IntermediateOutputPath, "designtime", "Resource.Designer.cs"); + var designerFile = Path.Combine (Root, path, appProj.ProjectName, "obj", appProj.GetProperty (KnownProperties.Configuration) + "_Resource.designer.cs"); FileAssert.Exists (designerFile, $"'{designerFile}' should have been created."); var designerContents = File.ReadAllText (designerFile); @@ -1016,7 +1017,7 @@ public void BuildAppWithManagedResourceParser() "Target '_ManagedUpdateAndroidResgen' should not have run."); Assert.IsTrue (appBuilder.Clean (appProj), "Clean should have succeeded"); - Assert.IsFalse (File.Exists (designerFile), $"'{designerFile}' should have been cleaned."); + Assert.IsTrue (File.Exists (designerFile), $"'{designerFile}' should not have been cleaned."); } } @@ -1075,7 +1076,7 @@ public void BuildAppWithManagedResourceParserAndLibraries () Assert.LessOrEqual (appBuilder.LastBuildTime.TotalMilliseconds, maxBuildTimeMs, $"DesignTime build should be less than {maxBuildTimeMs} milliseconds."); Assert.IsFalse (appProj.CreateBuildOutput (appBuilder).IsTargetSkipped ("_ManagedUpdateAndroidResgen"), "Target '_ManagedUpdateAndroidResgen' should have run."); - var designerFile = Path.Combine (Root, path, appProj.ProjectName, appProj.IntermediateOutputPath, "designtime", "Resource.Designer.cs"); + var designerFile = Path.Combine (Root, path, appProj.ProjectName, "obj", appProj.GetProperty (KnownProperties.Configuration) + "_Resource.designer.cs"); FileAssert.Exists (designerFile, $"'{designerFile}' should have been created."); var designerContents = File.ReadAllText (designerFile); @@ -1112,10 +1113,10 @@ public void BuildAppWithManagedResourceParserAndLibraries () Assert.IsTrue (appBuilder.Clean (appProj), "Clean should have succeeded"); - Assert.IsFalse (File.Exists (designerFile), $"'{designerFile}' should have been cleaned."); - designerFile = Path.Combine (Root, path, libProj.ProjectName, libProj.IntermediateOutputPath, "designtime", "Resource.Designer.cs"); + Assert.IsTrue (File.Exists (designerFile), $"'{designerFile}' should not have been cleaned."); + designerFile = Path.Combine (Root, path, libProj.ProjectName, "obj", libProj.GetProperty (KnownProperties.Configuration) + "_Resource.designer.cs"); Assert.IsTrue (libBuilder.Clean (libProj), "Clean should have succeeded"); - Assert.IsFalse (File.Exists (designerFile), $"'{designerFile}' should have been cleaned."); + Assert.IsTrue (File.Exists (designerFile), $"'{designerFile}' should not have been cleaned."); } diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs index dacafbe1b5c..00d3591daa7 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs @@ -2012,7 +2012,7 @@ public void BuildInDesignTimeMode ([Values(false, true)] bool useManagedParser) builder.Build (proj, parameters: new string[] { "DesignTimeBuild=true" }); Assert.IsFalse (builder.Output.IsTargetSkipped ("_CreatePropertiesCache"), "target \"_CreatePropertiesCache\" should have been run."); Assert.IsFalse (builder.Output.IsTargetSkipped ("_ResolveLibraryProjectImports"), "target \"_ResolveLibraryProjectImports\' should have been run."); - var librarycache = Path.Combine (Root, path, proj.IntermediateOutputPath, "designtime", "libraryprojectimports.cache"); + var librarycache = Path.Combine (Root, path, "obj", proj.GetProperty (KnownProperties.Configuration) + "_libraryprojectimports.cache"); Assert.IsTrue (File.Exists (librarycache), $"'{librarycache}' should exist."); librarycache = Path.Combine (Root, path, proj.IntermediateOutputPath, "libraryprojectimports.cache"); Assert.IsFalse (File.Exists (librarycache), $"'{librarycache}' should not exist."); @@ -2022,7 +2022,7 @@ public void BuildInDesignTimeMode ([Values(false, true)] bool useManagedParser) Assert.IsTrue (builder.Clean (proj), "Clean Should have succeeded"); builder.Target = "_CleanDesignTimeIntermediateDir"; Assert.IsTrue (builder.Build (proj), "_CleanDesignTimeIntermediateDir should have succeeded"); - librarycache = Path.Combine (Root, path, proj.IntermediateOutputPath, "designtime", "libraryprojectimports.cache"); + librarycache = Path.Combine (Root, path, "obj", proj.GetProperty (KnownProperties.Configuration) + "_libraryprojectimports.cache"); Assert.IsFalse (File.Exists (librarycache), $"'{librarycache}' should not exist."); } } diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs index e3f81e71919..8cd97584c49 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs @@ -50,6 +50,32 @@ public Class1 () } } + [Test] + public void IncrementalCleanDuringClean () + { + var path = Path.Combine ("temp", TestName); + var proj = new XamarinAndroidApplicationProject () { + ProjectName = "App1", + IsRelease = true, + }; + proj.SetProperty ("AndroidUseManagedDesignTimeResourceGenerator", "True"); + proj.SetProperty ("BuildingInsideVisualStudio", "True"); + var intermediateOutputPath = Path.Combine (Root, path, "obj"); + using (var b = CreateApkBuilder (path, false, false)) { + b.Target = "Compile"; + Assert.IsTrue(b.Build (proj), "DesignTime Build should have succeeded"); + var designTimeDesigner = Path.Combine (intermediateOutputPath, proj.GetProperty (KnownProperties.Configuration) + "_Resource.designer.cs"); + FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should have been created."); + b.Target = "Build"; + Assert.IsTrue(b.Build (proj), "Build should have succeeded"); + FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should still exist after Build."); + b.Target = "Clean"; + Assert.IsTrue(b.Build (proj), "Clean should have succeeded"); + FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should still exist after Clean."); + } + + } + [Test] public void AllProjectsHaveSameOutputDirectory() { diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj index 45222dd1511..d0b1d8fbea8 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj @@ -38,7 +38,7 @@ ..\..\..\..\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll - @@ -1188,6 +1186,9 @@ because xbuild doesn't support framework reference assemblies. AssemblyIdentityMapFile="$(_AndroidLibrayProjectAssemblyMapFile)" OutputImportDirectory="$(_AndroidLibrayProjectIntermediatePath)"> + + + @@ -1249,6 +1250,9 @@ because xbuild doesn't support framework reference assemblies. + + + @@ -2675,6 +2679,26 @@ because xbuild doesn't support framework reference assemblies. + + + + + + + + + + + + + + + + + + +