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] fix _CopyIntermediateAssemblies outputs #2308

Merged
merged 1 commit into from
Oct 17, 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 @@ -318,5 +318,29 @@ public Class2 ()
}
}
}

[Test]
public void CopyIntermediateAssemblies ()
{
var target = "_CopyIntermediateAssemblies";
var proj = new XamarinFormsAndroidApplicationProject ();
using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
Assert.IsTrue (b.Build (proj), "first build should succeed");
Assert.IsFalse (b.Output.IsTargetSkipped (target), $"`{target}` should *not* be skipped!");

var assembly = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, proj.ProjectName + ".dll");
FileAssert.Exists (assembly);
File.SetLastWriteTimeUtc (assembly, DateTime.UtcNow);
File.SetLastAccessTimeUtc (assembly, DateTime.UtcNow);

//NOTE: second build, target will run because inputs changed
Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true, saveProject: false), "second build should succeed");
Assert.IsFalse (b.Output.IsTargetSkipped (target), $"`{target}` should *not* be skipped on second build!");

//NOTE: third build, it should certainly *not* run! there are no changes
Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true, saveProject: false), "third build should succeed");
Assert.IsTrue (b.Output.IsTargetSkipped (target), $"`{target}` should be skipped on third build!");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1974,8 +1974,8 @@ because xbuild doesn't support framework reference assemblies.
</Target>

<Target Name="_CopyIntermediateAssemblies"
Inputs="@(ResolvedUserAssemblies)"
Outputs="@(ResolvedUserAssemblies->'$(MonoAndroidLinkerInputDir)%(Filename)%(Extension)')"
Inputs="@(ResolvedUserAssemblies);@(_AndroidResolvedSatellitePaths)"
Outputs="$(IntermediateOutputPath)_copyintermediate.stamp"
DependsOnTargets="_ResolveAssemblies;_ResolveSatellitePaths;_CreatePackageWorkspace;_CreateIntermediateAssembliesDir;_CopyConfigFiles">
<!-- Make a copy of every assembly we need in assemblies -->
<CopyIfChanged
Expand All @@ -1987,6 +1987,10 @@ because xbuild doesn't support framework reference assemblies.
DestinationFiles="@(_AndroidResolvedSatellitePaths->'$(MonoAndroidLinkerInputDir)%(DestinationSubDirectory)%(Filename)%(Extension)')"
/>
<Delete Files="@(ResolvedAssemblies->'$(MonoAndroidLinkerInputDir)%(Filename)%(Extension).mdb')" />
<Touch Files="$(IntermediateOutputPath)_copyintermediate.stamp" AlwaysCreate="True" />
<ItemGroup>
<FileWrites Include="$(IntermediateOutputPath)_copyintermediate.stamp" />
</ItemGroup>
</Target>

<Target Name="_CollectConfigFiles"
Expand Down Expand Up @@ -3103,6 +3107,7 @@ because xbuild doesn't support framework reference assemblies.
<Delete Files="$(MonoAndroidIntermediate)stub_application_data.txt" />
<Delete Files="$(IntermediateOutputPath)_javac.stamp" />
<Delete Files="$(IntermediateOutputPath)_javastubs.stamp" />
<Delete Files="$(IntermediateOutputPath)_copyintermediate.stamp" />
<Delete Files="$(_AndroidResFlagFile)" />
<Delete Files="$(_AndroidLinkFlag)" />
<Delete Files="$(_AndroidComponentResgenFlagFile)" />
Expand Down