[Mono.Android] Generate $(OutputPath)mono.android.jar

As an ancient "optimization" -- which probably needs rethinking, but
now is not the time for such rethinking -- during .apk generation
time, Mono.Android.dll was *not* processed along with the other
assemblies, the rationale being that it would slow things down.

(I don't think that this is true anymore...)

To optimize things, we instead generated a mono.android.jar during
Xamarin.Android build-time, and the .apk generation process would
include this prebuilt mono.android.jar into the final .apk.

For now, follow suite: Generate $(OutputPath)mono.android.jar after
building $(OutputPath)Mono.Android.dll. mono.android.jar contains the
Java Callable Wrappers for all Java.Lang.Object and
Java.Lang.Throwable subclasses within Mono.Android.dll.
This commit is contained in:
Jonathan Pryor 2016-04-21 15:31:09 -04:00
Родитель dfe9c4fcba
Коммит 953e28b79c
2 изменённых файлов: 43 добавлений и 1 удалений

Просмотреть файл

@ -304,5 +304,10 @@
<Name>generator</Name>
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\external\Java.Interop\tools\jcw-gen\jcw-gen.csproj">
<Project>{52C7D9B6-E8C8-47D0-9471-652D278D7D77}</Project>
<Name>jcw-gen</Name>
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
</Project>

Просмотреть файл

@ -67,8 +67,45 @@
Command="$(ManagedRuntime) $(Generator) $(_ApiLevel) $(_Out) $(_Codegen) $(_Fixup) $(_Enums1) $(_Enums2) $(_Versions) $(_Annotations) $(_Assembly) $(_TypeMap) $(_Dirs) $(_Api)"
/>
</Target>
<ItemGroup>
<_CommonJavaSources Include="java\**\*.java" />
</ItemGroup>
<Target Name="_GenerateJavaCallableWrappers"
AfterTargets="CoreCompile"
Inputs="$(OutputPath)$(AssemblyName).dll"
Outputs="$(OutputPath)mono.android.jar">
<MakeDir Directories="$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw\bin" />
<PropertyGroup>
<JcwGen>..\..\external\Java.Interop\bin\$(Configuration)\jcw-gen.exe</JcwGen>
<_LibDirs>-L "$(OutputPath)" -L "$(OutputPath)..\v1.0\" -L "$(OutputPath)..\v1.0\Facades"</_LibDirs>
<_Assembly>"$(OutputPath)$(AssemblyName).dll"</_Assembly>
<_Out>-o "$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw\src"</_Out>
</PropertyGroup>
<Exec
Command="$(ManagedRuntime) $(JcwGen) $(_Out) $(_LibDirs) $(_Assembly)"
/>
<ItemGroup>
<_JavaSources Include="$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw\src\**\*.java" />
</ItemGroup>
<WriteLinesToFile
File="$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw\classes.txt"
Lines="@(_CommonJavaSources);@(_JavaSources)"
Overwrite="True"
/>
<PropertyGroup>
<_Target>-source 1.6 -target 1.6</_Target>
<_D>-d "$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw\bin"</_D>
<_AndroidJar>"$(AndroidToolchainDirectory)\sdk\platforms\android-$(AndroidApiLevel)\android.jar"</_AndroidJar>
</PropertyGroup>
<Exec
Command="javac $(_Target) $(_D) -bootclasspath $(_AndroidJar) @$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw\classes.txt"
/>
<Exec
Command="jar cf &quot;$(OutputPath)mono.android.jar&quot; -C &quot;$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw\bin&quot; ."
/>
</Target>
<Target Name="_CleanBinding"
AfterTargets="Clean">
<RemoveDir Directories="$(IntermediateOutputPath)android-$(AndroidApiLevel)" />
<RemoveDir Directories="$(IntermediateOutputPath)android-$(AndroidApiLevel);$(IntermediateOutputPath)android-$(AndroidApiLevel).jcw" />
</Target>
</Project>