Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Nov 4, 2024
1 parent 79cfc8d commit 01da59b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.


<Target Name="_InjectAaptDependencies">
<PropertyGroup Condition="'$(DesignTimeBuild)' != 'True'">
<PropertyGroup Condition="'$(DesignTimeBuild)' != 'True' Or ('$(DesignTimeBuild)' == 'True' And '$(AndroidUseManagedDesignTimeResourceGenerator)' == 'False') ">
<_SetLatestTargetFrameworkVersionDependsOnTargets>
$(_SetLatestTargetFrameworkVersionDependsOnTargets);
_CreateAapt2VersionCache;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,24 @@ Copyright (C) 2016 Xamarin. All rights reserved.
<Message Text="IntermediateOutputPath: $(IntermediateOutputPath)" />
</Target>

<Target Name="_GetProjectResourceDirectory" Returns="$(MSBuildProjectDirectory)\$(MonoAndroidResourcePrefix)">
</Target>

<Target Name="_CollectProjectReferenceResources"
Condition="'$(AndroidUseDesignerAssembly)' == 'True' And '$(DesignTimeBuild)' == 'True' "
>
<MSBuild
Projects="@(ProjectReference)"
Targets="Restore;_GetProjectResourceDirectory"
SkipNonexistentTargets="true"
>
<Output TaskParameter="TargetOutputs" ItemName="LibraryResourceDirectories" />
</MSBuild>
</Target>

<Target Name="_GenerateRtxt"
Condition="'$(AndroidUseDesignerAssembly)' == 'True' And '$(DesignTimeBuild)' == 'True' "
DependsOnTargets="_CreatePropertiesCache;_ResolveSdks;_ResolveAndroidTooling;_GetJavaPlatformJar;_GenerateAndroidResourceDir;_SetupDesignerProperties"
DependsOnTargets="_CreatePropertiesCache;_ResolveSdks;_ResolveAndroidTooling;_GetJavaPlatformJar;_GenerateAndroidResourceDir;_SetupDesignerProperties;_CollectProjectReferenceResources"
Inputs="$(_AndroidResFlagFile);@(_AndroidResourceDest);@(LibraryResourceDirectories->'%(StampFile)')"
Outputs="$(_DesignerIntermediateOutputPath)R.txt"
>
Expand All @@ -78,7 +93,7 @@ Copyright (C) 2016 Xamarin. All rights reserved.
</Target>

<Target Name="_GenerateResourceCaseMap"
DependsOnTargets="_ComputeAndroidResourcePaths;_SetupDesignerProperties;_GetLibraryImports"
DependsOnTargets="_ComputeAndroidResourcePaths;_SetupDesignerProperties;_GetLibraryImports;_CollectProjectReferenceResources"
Inputs="@(_AndroidResourceDest);@(LibraryResourceDirectories->'%(StampFile)')"
Outputs="$(_GenerateResourceCaseMapFile)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,14 +1179,19 @@ public void DesignTimeBuild ()
Assert.IsTrue (b.DesignTimeBuild (proj), "first dtb should have succeeded.");
var target = "_GenerateResourceDesignerAssembly";
Assert.IsFalse (b.Output.IsTargetSkipped (target), $"`{target}` should not have been skipped.");
var importsTarget = "_ResolveLibraryProjectImports";
Assert.IsTrue (b.Output.IsTargetSkipped (importsTarget, defaultIfNotUsed: true), $"`{importsTarget}` should have been skipped.");
// DesignTimeBuild=true lowercased
var parameters = new [] { "DesignTimeBuild=true" };
Assert.IsTrue (b.RunTarget (proj, "Compile", doNotCleanupOnUpdate: true, parameters: parameters), "second dtb should have succeeded.");
Assert.IsTrue (b.Output.IsTargetSkipped (target, defaultIfNotUsed: true), $"`{target}` should have been skipped.");
Assert.IsTrue (b.Output.IsTargetSkipped (importsTarget, defaultIfNotUsed: true), $"`{importsTarget}` should have been skipped.");
Assert.IsTrue (b.RunTarget (proj, "UpdateGeneratedFiles", doNotCleanupOnUpdate: true, parameters: parameters), "UpdateGeneratedFiles should have succeeded.");
Assert.IsTrue (b.Output.IsTargetSkipped (target, defaultIfNotUsed: true), $"`{target}` should have been skipped.");
Assert.IsTrue (b.Output.IsTargetSkipped (importsTarget, defaultIfNotUsed: true), $"`{importsTarget}` should have been skipped.");
Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true, saveProject: false), "full build should have succeeded.");
Assert.IsFalse (b.Output.IsTargetSkipped (target), $"`{target}` should not have been skipped.");
Assert.IsFalse (b.Output.IsTargetSkipped (importsTarget), $"`{importsTarget}` should not have been skipped.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ This file is used by all project types, including binding projects.
</PropertyGroup>

<Target Name="_ResolveLibraryProjectImports"
Condition=" '$(DesignTimeBuild)' != 'True' "
DependsOnTargets="$(CoreResolveReferencesDependsOn)"
Inputs="$(ProjectAssetsFile);$(MSBuildProjectFullPath);@(_MonoAndroidReferencePath);@(_MonoAndroidReferenceDependencyPaths);@(AndroidAarLibrary);$(_AndroidBuildPropertiesCache)"
Outputs="$(_AndroidStampDirectory)_ResolveLibraryProjectImports.stamp">
Expand All @@ -57,7 +56,9 @@ This file is used by all project types, including binding projects.
</ItemGroup>
</Target>

<Target Name="_ExtractLibraryProjectImports" DependsOnTargets="_ResolveLibraryProjectImports" Condition=" '$(DesignTimeBuild)' != 'True' ">
<Target Name="_ExtractLibraryProjectImports"
DependsOnTargets="_ResolveLibraryProjectImports"
>
<ReadLibraryProjectImportsCache
CacheFile="$(_AndroidLibraryProjectImportsCache)">
<Output TaskParameter="ResolvedResourceDirectories" ItemName="LibraryResourceDirectories" />
Expand Down

0 comments on commit 01da59b

Please sign in to comment.