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

[Mono.Android] build and reference non-PCL Java.Interop #2105

Merged
merged 1 commit into from
Aug 29, 2018

Commits on Aug 29, 2018

  1. [Mono.Android] build and reference non-PCL Java.Interop

    Fixes: http://work.devdiv.io/667174
    Context: dotnet/java-interop#360
    
    Building `Java.Interop` in a similar fashion as `Mono.Android.dll`:
    
        <PropertyGroup>
            <NoStdLib>true</NoStdLib>
            <TargetFrameworkIdentifier>MonoAndroid</TargetFrameworkIdentifier>
            <TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
            <TargetFrameworkRootPath>$(XAInstallPrefix)xbuild-framework</TargetFrameworkRootPath>
        </PropertyGroup>
        <ItemGroup>
            <Reference Include="mscorlib">
                <HintPath>$(XAInstallPrefix)xbuild-frameworks\MonoAndroid\v1.0\mscorlib.dll</HintPath>
                <Private>False</Private>
            </Reference>
            <Reference Include="System">
                <HintPath>$(XAInstallPrefix)xbuild-frameworks\MonoAndroid\v1.0\System.dll</HintPath>
                <Private>False</Private>
            </Reference>
            <Reference Include="System.Core">
                <HintPath>$(XAInstallPrefix)xbuild-frameworks\MonoAndroid\v1.0\System.Core.dll</HintPath>
                <Private>False</Private>
            </Reference>
        </ItemGroup>
    
    Decreases the assemblies referenced in a "Hello World" Xamarin.Android
    project dramatically:
    
        Adding assembly reference for Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, recursively...
            Adding assembly reference for System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.ComponentModel.Composition, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, recursively...
            Adding assembly reference for System.Diagnostics.Debug, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Threading, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Collections, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Collections.Concurrent, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Reflection, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Linq.Expressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Reflection.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Dynamic.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.ObjectModel, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Linq, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Runtime.InteropServices, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Runtime.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
            Adding assembly reference for System.Reflection.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, recursively...
        Adding assembly reference for Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, recursively...
    
    Becomes:
    
        Adding assembly reference for Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, recursively...
        Adding assembly reference for Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065, recursively...
    
    And the savings in build times for "Hello World", this is the
    `Rebuild` target:
    - `Debug` + PCL - 8.424s
    - `Release` + PCL - 13.651s
    - `Debug` + *not* PCL - 4.258s
    - `Release` + *not* PCL - 9.487s
    
    *NOTE: this was a master/Debug build of Xamarin.Android*
    
    The `Java.Interop.dll` in
    `lib\xamarin.android\xbuild\Xamarin\Android\` remains unchanged, as
    referenced by `Xamarin.Android.Build.Tasks`.
    
    The modified `Java.Interop.dll` in
    `lib\xamarin.android\xbuild-frameworks\MonoAndroid\v1.0\` will look
    something like:
    
        // bin\Debug\lib\xamarin.android\xbuild-frameworks\MonoAndroid\v1.0\Java.Interop.dll
        // Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065
    
        [assembly: TargetFramework("MonoAndroid,Version=v1.0")]
    
    Changes:
    - `$(MSBuildThisFile)` should be an input of `_BuildJavaInterop`
    - Set `$(JavaInteropProfile)` and various other properties so a
      non-PCL version of `Java.Interop.dll` is built
    - Make sure to copy `Java.Interop.dll` from the `DebugNet45` directory
    - Bump to java.interop/master/659711c
    
    dotnet/java-interop@893562c...659711c
    jonathanpeppers committed Aug 29, 2018
    Configuration menu
    Copy the full SHA
    42fcd79 View commit details
    Browse the repository at this point in the history