Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] Stop designtime designer being deleted. #1307

Merged
merged 2 commits into from
Feb 15, 2018
Merged
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 @@ -15,7 +15,7 @@ Copyright (C) 2014 Xamarin. All rights reserved.
</PropertyGroup>

<Target Name="_RegisterAndroidFilesWithFileWrites" BeforeTargets="IncrementalClean" Condition=" '$(_IsRunningXBuild)' != 'true' ">
<CreateItem Include="$(OutDir)*.pdb;$(OutDir)*.dll;$(OutDir)*.dll.mdb;$(MonoAndroidIntermediateAssemblyDir)*.dll.mdb;$(MonoAndroidIntermediateAssemblyDir)*.pdb;$(MonoAndroidLinkerInputDir)*.dll.mdb;$(MonoAndroidLinkerInputDir)*.pdb;$(_AndroidManagedResourceDesignerFile)">
<CreateItem Include="$(OutDir)*.pdb;$(OutDir)*.dll;$(OutDir)*.dll.mdb;$(MonoAndroidIntermediateAssemblyDir)*.dll.mdb;$(MonoAndroidIntermediateAssemblyDir)*.pdb;$(MonoAndroidLinkerInputDir)*.dll.mdb;$(MonoAndroidLinkerInputDir)*.pdb">
<Output TaskParameter="Include" ItemName="_FilesToRegister" />
</CreateItem>
<CreateItem Include="$([System.IO.Path]::GetFullPath('%(_FilesToRegister.Identity)'))"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,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.");

}
}
Expand Down Expand Up @@ -1112,10 +1112,10 @@ public void BuildAppWithManagedResourceParserAndLibraries ()


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.");
designerFile = Path.Combine (Root, path, libProj.ProjectName, libProj.IntermediateOutputPath, "designtime", "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.");


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,47 @@ namespace Xamarin.Android.Build.Tests
[Parallelizable (ParallelScope.Children)]
public class IncrementalBuildTest : BaseTest
{
[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");
using (var b = CreateApkBuilder (path)) {
b.Target = "Compile";
Assert.IsTrue(b.Build (proj), "DesignTime Build should have succeeded");
var designTimeDesigner = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "designtime", "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.");
b.Target = "Compile";
Assert.IsTrue(b.Build (proj), "Build should have succeeded");
FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should still exist after Compile.");
b.Target = "Build";
Assert.IsTrue(b.Build (proj), "Build should have succeeded");
FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should still exist after second Build.");
Assert.IsTrue(b.Build (proj), "Build should have succeeded");
FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should still exist after third Build.");
b.Target = "Compile";
Assert.IsTrue(b.Build (proj), "Build should have succeeded");
FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should still exist after second Compile.");
b.Target = "Clean";
Assert.IsTrue(b.Build (proj), "Clean should have succeeded");
FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should still exist after second Clean.");
b.Target = "ReBuild";
Assert.IsTrue(b.Build (proj), "ReBuild should have succeeded");
FileAssert.Exists (designTimeDesigner, $"{designTimeDesigner} should still exist after ReBuild.");
}

}

[Test]
public void LibraryIncrementalBuild () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1116,11 +1116,6 @@ because xbuild doesn't support framework reference assemblies.
<Compile Remove="@(CorrectCasedItem)" Condition=" '$(ManagedDesignTimeBuild)' == 'True' And '%(CorrectCasedItem.Identity)' != '' "/>
<Compile Include="$(_AndroidManagedResourceDesignerFile)" Condition=" '$(ManagedDesignTimeBuild)' == 'True' And Exists ('$(_AndroidManagedResourceDesignerFile)')" />
</ItemGroup>
<WriteLinesToFile
Condition="Exists ('$(_AndroidManagedResourceDesignerFile)')"
File="$(IntermediateOutputPath)$(CleanFile)"
Lines="$([System.IO.Path]::GetFullPath('$(_AndroidManagedResourceDesignerFile)'))"
Overwrite="false" />
</Target>

<!-- Resource Build -->
Expand Down