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] MSBuild target does not properly build incrementally #3674

Merged
merged 3 commits into from Jan 9, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -1131,10 +1131,15 @@ public void BuildAppWithManagedResourceParser()
StringAssert.Contains ("myButton", designerContents, $"{designerFile} should contain Resources.Id.myButton");
StringAssert.Contains ("Icon", designerContents, $"{designerFile} should contain Resources.Drawable.Icon");
StringAssert.Contains ("Main", designerContents, $"{designerFile} should contain Resources.Layout.Main");
Assert.IsTrue (appBuilder.Build (appProj),
appBuilder.BuildLogFile = "build.log";
Assert.IsTrue (appBuilder.Build (appProj, doNotCleanupOnUpdate: true),
"Normal Application Build should have succeeded.");
Assert.IsTrue (appProj.CreateBuildOutput (appBuilder).IsTargetSkipped ("_ManagedUpdateAndroidResgen"),
"Target '_ManagedUpdateAndroidResgen' should not have run.");
appBuilder.BuildLogFile = "designtimebuild.log";
Assert.IsTrue (appBuilder.DesignTimeBuild (appProj, doNotCleanupOnUpdate: true), "DesignTime Application Build should have succeeded.");
Assert.IsTrue (appProj.CreateBuildOutput (appBuilder).IsTargetSkipped ("_ManagedUpdateAndroidResgen"),
"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
33 changes: 20 additions & 13 deletions src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
Expand Up @@ -1227,23 +1227,30 @@ because xbuild doesn't support framework reference assemblies.
</ItemGroup>
</Target>

<PropertyGroup>
<_ManagedUpdateAndroidResgenInputs>
$(MSBuildAllProjects);
@(AndroidResource);
@(AndroidBoundLayout);
@(_MonoAndroidReferencePath);
@(_LibraryResourceDirectoryStamps);
$(_AndroidBuildPropertiesCache);
$(ProjectAssetsFile);
</_ManagedUpdateAndroidResgenInputs>
</PropertyGroup>
<Target Name="_BeforeManagedUpdateAndroidResgen">
<PropertyGroup>
<_ManagedUpdateAndroidResgenInputs>
$(MSBuildAllProjects);
@(AndroidResource);
@(AndroidBoundLayout);
@(_MonoAndroidReferencePath);
@(_LibraryResourceDirectoryStamps);
$(_AndroidBuildPropertiesCache);
$(ProjectAssetsFile);
</_ManagedUpdateAndroidResgenInputs>
</PropertyGroup>
<PropertyGroup>
<_ManagedUpdateAndroidResgenInputs Condition="Exists ('$(_AndroidResourcePathsDesignTimeCache)')">$(_ManagedUpdateAndroidResgenInputs);$(_AndroidResourcePathsDesignTimeCache);</_ManagedUpdateAndroidResgenInputs>
<_ManagedUpdateAndroidResgenInputs Condition="Exists ('$(_AndroidLibraryImportsDesignTimeCache)')">$(_ManagedUpdateAndroidResgenInputs);$(_AndroidLibraryImportsDesignTimeCache);</_ManagedUpdateAndroidResgenInputs>
<_ManagedUpdateAndroidResgenInputs Condition="Exists ('$(_AndroidLibraryProjectImportsDesignTimeCache)')">$(_ManagedUpdateAndroidResgenInputs);$(_AndroidLibraryProjectImportsDesignTimeCache);</_ManagedUpdateAndroidResgenInputs>
</PropertyGroup>
</Target>

<!-- Managed DesignTime Resource Generation -->
<Target Name="_ManagedUpdateAndroidResgen" Condition=" '$(ManagedDesignTimeBuild)' == 'True' "
Inputs="$(_ManagedUpdateAndroidResgenInputs);$(_AndroidLibraryProjectImportsCache);$(_AndroidLibraryImportsCache);"
Inputs="$(_ManagedUpdateAndroidResgenInputs)"
Outputs="$(_AndroidManagedResourceDesignerFile)"
DependsOnTargets="_CreatePropertiesCache;_ExtractLibraryProjectImports;_ValidateAndroidPackageProperties">
DependsOnTargets="_CreatePropertiesCache;_ExtractLibraryProjectImports;_ValidateAndroidPackageProperties;_BeforeManagedUpdateAndroidResgen">
<MakeDir Directories="$(_AndroidIntermediateDesignTimeBuildDirectory)" />
<!-- Parse primary R.java and create Resources.Designer.cs -->
<GenerateResourceDesigner
Expand Down