Skip to content
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
5 changes: 4 additions & 1 deletion build-tools/mono-runtimes/mono-runtimes.targets
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
WorkingDirectory="$(IntermediateOutputPath)\%(_MonoRuntime.Identity)"
/>
<Touch
Files="@(_RuntimeSource);@(_ProfilerSource);@(_MonoPosixHelperSource);@(_BclProfileItems)"
Files="@(_RuntimeSource);@(_ProfilerSource);@(_MonoPosixHelperSource);@(_BclProfileItems);@(_MonoBtlsSource)"
/>
</Target>
<Target Name="_InstallRuntimes"
Expand Down Expand Up @@ -459,6 +459,9 @@
SourceFiles="@(_FSharp)"
DestinationFolder="$(_BclFrameworkDir)"
/>
<Touch
Files="@(_FSharp->'$(_BclFrameworkDir)\%(Filename)%(Extension)')"
/>
<Touch
Files="@(_BclInstalledItem)"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/Mono.Android/Mono.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
</PropertyGroup>
<Import Project="Mono.Android.targets" />
<PropertyGroup>
<JavaCallableWrapperAbsAssembly>$(JavaCallableWrapperOutputPathAbs)$(AssemblyName).dll</JavaCallableWrapperAbsAssembly>
<JavaCallableWrapperAbsAssembly>$([System.IO.Path]::GetFullPath ('$(OutputPath)$(AssemblyName).dll'))</JavaCallableWrapperAbsAssembly>
<JavaCallableWrapperAfterTargets>CoreBuild</JavaCallableWrapperAfterTargets>
</PropertyGroup>
<Import Project="..\..\build-tools\scripts\JavaCallableWrappers.targets" />
Expand Down
2 changes: 2 additions & 0 deletions src/Mono.Android/Mono.Android.targets
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<Exec
Command="$(ManagedRuntime) ..\..\bin\Build$(Configuration)\jnienv-gen.exe -o Android.Runtime\JNIEnv.g.cs --use-java-interop"
/>
<Touch Files="Android.Runtime\JNIEnv.g.cs" />
</Target>
<ItemGroup>
<_AndroidProfile Include="Profiles\api-*.xml.in" />
Expand Down Expand Up @@ -128,6 +129,7 @@
SourceFiles="$(IntermediateOutputPath)__dex\classes.dex"
DestinationFiles="$(OutputPath)mono.android.dex"
/>
<Touch Files="$(OutputPath)mono.android.dex" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you have to Touch this file, and I believe unnecessary touching is bad because it can cause possible later rebuild cascades, but anyhow changes in this code path will be simply lost because it will be killed because it is jack!
https://github.com/xamarin/xamarin-android/pull/514/files#diff-77c7d22cbe4c79b8f43dd2e97eb81688

It should have been actually already killed (I was totally unaware that jack could be used outside our MSBuild tasks).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And from what I observed, these _GenerateMonoAndroidDex targets are not in use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Losing changes here is fine; i just want to speed up a specific local rebuild, and I encountered this target constantly re-running.

If you'd prefer, I can just kill this target and integrate the appropriate changes from PR #514?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either is fine, but the more important question here is: what is triggering this target? Could you check the diagnostic build output and see which targets depend on these _GenerateMonoAndroidDex* targets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is triggering this target?

The e.g. _GenerateMonoAndroidDex18 target is AfterTargets="GenerateJavaCallableWrappers", and GenerateJavaCallableWrappers is -- for Mono.Android.csproj -- AfterTargets="CoreBuild".

Yes, there are circumstances where AfterTargets works! :-)

Not that the use of AfterTargets is immediately apparent from diagnostic build output:

Building target "_GenerateMonoAndroidDex16" in project ".../xamarin-android/src/Mono.Android/Mono.Android.csproj" (".../xamarin-android/src/Mono.Android/Mono.Android.targets"); "GenerateJavaCallableWrappers" depends on it.

I think the message has it backwards, but the actual ordering is correct (truncated output):

Building target "GenerateJavaCallableWrappers" 
    Done building target "GenerateJavaCallableWrappers"
Building target "_GenerateMonoAndroidDex16"
Building target "_GenerateMonoAndroidDex18"
Done building target "GenerateJavaCallableWrappers" 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why am I NOT seeing any references to those targets?

/sources/monodroid/xamarin-android$ grep -R GenerateMonoAndroidDex
/sources/monodroid/xamarin-android$ cd ../monodroid
/sources/monodroid/monodroid$ grep -R GenerateMonoAndroidDex
/sources/monodroid/monodroid$

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atsushieno: Something is very fishy with that grep, as it's not finding the target definitions within the repo:

$ git grep GenerateMonoAndroidDex
src/Mono.Android/Mono.Android.targets:  <Target Name="_GenerateMonoAndroidDex16"
src/Mono.Android/Mono.Android.targets:  <Target Name="_GenerateMonoAndroidDex18"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was running it from my o-preview tree where I removed them by myself. Your grep results also say that they are not REFERENCED.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're not explicitly referenced. They're implicitly referenced, via AfterTargets.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. We should completely eliminate those use of "AfterTargets", but that can be done in different commits.

<RemoveDir
Directories="$(IntermediateOutputPath)__dex"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@
<Copy
SourceFiles="$(IntermediateOutputPath)multidex-aar\classes.jar"
DestinationFiles="$(OutputPath)..\..\..\mandroid\android-support-multidex.jar" />
<Touch Files="$(OutputPath)..\..\..\mandroid\android-support-multidex.jar" />
<Copy
SourceFiles="$(_SupportLicense)"
DestinationFiles="$(OutputPath)..\..\..\mandroid\MULTIDEX_JAR_LICENSE" />
<Touch Files="$(OutputPath)..\..\..\mandroid\MULTIDEX_JAR_LICENSE" />
</Target>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ public override bool Execute ()
sb.AppendLine ("\t}");
sb.AppendLine ("}");

File.WriteAllText (OutputFile.ItemSpec, sb.ToString ());
var newContents = sb.ToString ();
var curContents = "";
if (File.Exists (OutputFile.ItemSpec)) {
curContents = File.ReadAllText (OutputFile.ItemSpec);
}
if (newContents != curContents) {
File.WriteAllText (OutputFile.ItemSpec, sb.ToString ());
}

return !Log.HasLoggedErrors;
}
Expand Down