Skip to content

[build] option for Java.Interop to be built as non-PCL #360

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

Merged
merged 3 commits into from
Aug 25, 2018

Conversation

jonathanpeppers
Copy link
Member

Fixes: http://work.devdiv.io/667174

When building a "Hello World" Xamarin.Android app, I noticed the
following in the build log:

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...

It appears that Java.Interop is a PCL, and we end up having to work
with lots of facade assemblies during our build!

My thought is that we should build Java.Interop.dll the same as
Mono.Android.dll:

<PropertyGroup>
    <NoStdLib>true</NoStdLib>
</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>

I added a new property, $(JavaInteropProfile) we can set downstream
in Xamarin.Android. We can set this with a
Configuration.Override.props file that is already used in
Xamarin.Android's build process.

After doing this, the log now reads:

 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

That does bring up a big question, however...

Why are facade assemblies adding so much build time???

This change is good: making Java.Interop have fewer dependencies.
But I suspect there is more work to be done downstream in
Xamarin.Android. I have a feeling referencing netstandard libraries
cause the same problem to occur.

@jonathanpeppers
Copy link
Member Author

Here are binlogs of the build times mentioned above: java.interop.zip

jonathanpeppers added a commit to jonathanpeppers/java.interop that referenced this pull request Aug 23, 2018
In PR: dotnet#360

I will likely add a new `$(Configuration)` to be used in
xamarin-android, so we can build `Java.Interop` as a non-PCL.

The existence of `XAIntegrationDebug` and `XAIntegrationRelease` are
confusing, since they are no longer used.

See:
dotnet@54a2aff
dotnet/android#1231

This removes `XAIntegrationDebug` and `XAIntegrationRelease` from all
solutions and project files.

I also let VS 2017 update the SLN file, as it was an old VS 2010
format...
jonathanpeppers added a commit to jonathanpeppers/java.interop that referenced this pull request Aug 23, 2018
In PR: dotnet#360

I will likely add a new `$(Configuration)` to be used in
xamarin-android, so we can build `Java.Interop` as a non-PCL.

The existence of `XAIntegrationDebug` and `XAIntegrationRelease` are
confusing, since they are no longer used.

See:
dotnet@54a2aff
dotnet/android#1231

This removes `XAIntegrationDebug` and `XAIntegrationRelease` from all
solutions, project files, and `Makefile`.

I also let VS 2017 update the SLN file, as it was an old VS 2010
format...
jonathanpeppers added a commit to jonathanpeppers/java.interop that referenced this pull request Aug 24, 2018
In PR: dotnet#360

I will likely add a new `$(Configuration)` to be used in
xamarin-android, so we can build `Java.Interop` as a non-PCL.

The existence of `XAIntegrationDebug` and `XAIntegrationRelease` are
confusing, since they are no longer used.

See:
dotnet@54a2aff
dotnet/android#1231

This removes `XAIntegrationDebug` and `XAIntegrationRelease` from all
solutions, project files, and `Makefile`.

I also let VS 2017 update the SLN file, as it was an old VS 2010
format...
dellis1972 pushed a commit that referenced this pull request Aug 24, 2018
In PR: #360

I will likely add a new `$(Configuration)` to be used in
xamarin-android, so we can build `Java.Interop` as a non-PCL.

The existence of `XAIntegrationDebug` and `XAIntegrationRelease` are
confusing, since they are no longer used.

See:
54a2aff
dotnet/android#1231

This removes `XAIntegrationDebug` and `XAIntegrationRelease` from all
solutions, project files, and `Makefile`.

I also let VS 2017 update the SLN file, as it was an old VS 2010
format...
@dellis1972
Copy link
Contributor

4 second improvements on build times! worth looking at

Fixes: http://work.devdiv.io/667174

When building a "Hello World" Xamarin.Android app, I noticed the
following in the build log:

    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...

It appears that Java.Interop is a PCL, and we end up having to work
with lots of facade assemblies during our build!

My thought is that we should build `Java.Interop.dll` the same as
`Mono.Android.dll`:

    <PropertyGroup>
        <NoStdLib>true</NoStdLib>
    </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>

I added a new property, `$(JavaInteropProfile)` we can set downstream
in Xamarin.Android. We can set this with a
`Configuration.Override.props` file that is already used in
Xamarin.Android's build process.

After doing this, the log now reads:

   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

That does bring up a big question, however...

Why are facade assemblies adding so much build time???

This change is good: making `Java.Interop` have fewer dependencies.
But I suspect there is more work to be done downstream in
Xamarin.Android. I have a feeling referencing `netstandard` libraries
cause the same problem to occur.
…lder

This allows us to have two sets of outputs:
- bin/Debug/Java.Interop.dll - referenced by MSBuild tasks
- bin/DebugNet45/Java.Interop.dll - referenced by Mono.Android.dll and apps

Other changes:
- Fixed warning where file was getting imported twice
- Updated `.gitignore` for `*.binlog` files
@dellis1972 dellis1972 merged commit 893562c into dotnet:master Aug 25, 2018
@jonathanpeppers jonathanpeppers deleted the java.interop-not-pcl branch August 25, 2018 12:22
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Aug 25, 2018
Context: dotnet/java-interop@78f7301...893562c

Use JdkInfo during the build:
dotnet/java-interop#349

Optimize type lookups:
dotnet/java-interop#350

[jnimarshalmethod-gen] --types option:
dotnet/java-interop@d174fa6

Remove unused XAIntegration $(Configuration):
dotnet/java-interop#361

Option to build Java.Interop as non-PCL:
dotnet/java-interop#360
dellis1972 pushed a commit to dotnet/android that referenced this pull request Aug 26, 2018
Context: dotnet/java-interop@78f7301...893562c

Use JdkInfo during the build:
dotnet/java-interop#349

Optimize type lookups:
dotnet/java-interop#350

[jnimarshalmethod-gen] --types option:
dotnet/java-interop@d174fa6

Remove unused XAIntegration $(Configuration):
dotnet/java-interop#361

Option to build Java.Interop as non-PCL:
dotnet/java-interop#360
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Aug 27, 2018
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>
    </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*

Changes:
- `$(MSBuildThisFile)` should be an input of `_BuildJavaInterop`
- Set `$(JavaInteropProfile)` so a non-PCL version of
  `Java.Interop.dll` is built
- Make sure to copy `Java.Interop.dll` from the `DebugNet45` directory
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Aug 29, 2018
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 added a commit that referenced this pull request Sep 5, 2018
* [build] option for Java.Interop to be built as non-PCL

Fixes: http://work.devdiv.io/667174

When building a "Hello World" Xamarin.Android app, I noticed the
following in the build log:

    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...

It appears that Java.Interop is a PCL, and we end up having to work
with lots of facade assemblies during our build!

My thought is that we should build `Java.Interop.dll` the same as
`Mono.Android.dll`:

    <PropertyGroup>
        <NoStdLib>true</NoStdLib>
    </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>

I added a new property, `$(JavaInteropProfile)` we can set downstream
in Xamarin.Android. We can set this with a
`Configuration.Override.props` file that is already used in
Xamarin.Android's build process.

After doing this, the log now reads:

   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

That does bring up a big question, however...

Why are facade assemblies adding so much build time???

This change is good: making `Java.Interop` have fewer dependencies.
But I suspect there is more work to be done downstream in
Xamarin.Android. I have a feeling referencing `netstandard` libraries
cause the same problem to occur.

* [build] $(JavaInteropProfile) now outputs to $(Configuration)Net45 folder

This allows us to have two sets of outputs:
- bin/Debug/Java.Interop.dll - referenced by MSBuild tasks
- bin/DebugNet45/Java.Interop.dll - referenced by Mono.Android.dll and apps

Other changes:
- Fixed warning where file was getting imported twice
- Updated `.gitignore` for `*.binlog` files

* Whoops doc XML file was missing
jonathanpeppers added a commit to jonathanpeppers/java.interop that referenced this pull request Sep 7, 2018
In PR: dotnet#360

I will likely add a new `$(Configuration)` to be used in
xamarin-android, so we can build `Java.Interop` as a non-PCL.

The existence of `XAIntegrationDebug` and `XAIntegrationRelease` are
confusing, since they are no longer used.

See:
dotnet@54a2aff
dotnet/android#1231

This removes `XAIntegrationDebug` and `XAIntegrationRelease` from all
solutions, project files, and `Makefile`.

I also let VS 2017 update the SLN file, as it was an old VS 2010
format...
@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants