Skip to content

Commit

Permalink
[build] Add XAIntegrationDebug configuration, make xa-all target.
Browse files Browse the repository at this point in the history
As mentioned in commit 25de1f3, we want to build a *subset* of
Java.Interop.dll for integration with Xamarin.Android, because I don't
feel that the entire Java.Interop API is stable, and thus shouldn't be
made public yet.

To that end, add an XAIntegrationDebug target to Java.Interop.csproj,
along with some MSBuild voodoo to selectively include only some of the
<Compile/> entries, not all of them, to (hopefully?) narrow down the
number of files that would otherwise require #if's to build.

(Meaning, I think it'll be easier to selectively *add* code instead of
selectively remove it.)

Add a `make xa-all` toplevel target to build just the
XAIntegrationDebug configuration outputs, which will be located in
$(topdir)/bin/XAIntegrationDebug.
  • Loading branch information
jonpryor committed Oct 23, 2015
1 parent 0613419 commit 54a2aff
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
5 changes: 5 additions & 0 deletions Java.Interop.sln
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
XAIntegrationDebug|Any CPU = XAIntegrationDebug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{04E28441-36FF-4964-ADD7-EFBB47CCE406}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand All @@ -83,6 +84,8 @@ Global
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.Release|Any CPU.Build.0 = Release|Any CPU
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.XAIntegrationDebug|Any CPU.ActiveCfg = Debug|Any CPU
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.XAIntegrationDebug|Any CPU.Build.0 = Debug|Any CPU
{6970466B-F6D1-417A-8A27-4FED8555EBD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6970466B-F6D1-417A-8A27-4FED8555EBD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6970466B-F6D1-417A-8A27-4FED8555EBD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -95,6 +98,8 @@ Global
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.Release|Any CPU.Build.0 = Release|Any CPU
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.XAIntegrationDebug|Any CPU.ActiveCfg = XAIntegrationDebug|Any CPU
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.XAIntegrationDebug|Any CPU.Build.0 = XAIntegrationDebug|Any CPU
{A76309AB-98AC-4AE2-BA30-75481420C52F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A76309AB-98AC-4AE2-BA30-75481420C52F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A76309AB-98AC-4AE2-BA30-75481420C52F}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
CONFIGURATION = Debug

XA_CONFIGURATION = XAIntegrationDebug

DEPENDENCIES = \
bin/$(CONFIGURATION)/libNativeTiming.dylib

XA_INTEGRATION_OUTPUTS = \
bin/$(XA_CONFIGURATION)/Java.Interop.dll

TESTS = \
bin/$(CONFIGURATION)/Java.Interop-Tests.dll \
bin/$(CONFIGURATION)/Java.Interop.Dynamic-Tests.dll \
Expand All @@ -16,7 +21,9 @@ ATESTS = \

XBUILD = xbuild

all: $(DEPENDENCIES) $(TESTS)
all: $(DEPENDENCIES) $(TESTS) $(XA_INTEGRATION_OUTPUTS)

xa-all: $(XA_INTEGRATION_OUTPUTS)

clean:
$(XBUILD) /t:Clean
Expand Down Expand Up @@ -63,6 +70,9 @@ bin/$(CONFIGURATION)/Android.Interop-Tests.dll: $(wildcard src/Android.Interop/*
$(XBUILD)
touch $@

bin/$(XA_CONFIGURATION)/Java.Interop.dll:
$(XBUILD) /p:Configuration=$(XA_CONFIGURATION)

CSHARP_REFS = \
bin/$(CONFIGURATION)/Java.Interop.dll \
bin/$(CONFIGURATION)/Java.Interop.Export.dll \
Expand Down
32 changes: 24 additions & 8 deletions src/Java.Interop/Java.Interop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<JNIEnvGenPath>$(OutputPath)</JNIEnvGenPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
Expand All @@ -32,13 +33,24 @@
<ConsolePause>false</ConsolePause>
<DefineConstants>INTEROP</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<JNIEnvGenPath>$(OutputPath)</JNIEnvGenPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'XAIntegrationDebug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\XAIntegrationDebug</OutputPath>
<DefineConstants>DEBUG;INTEROP;FEATURE_HANDLES_ARE_INTPTRS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<JNIEnvGenPath>..\..\bin\Debug</JNIEnvGenPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Java.Interop\JavaPeerableExtensions.cs" />
<Compile Include="Java.Interop\JavaVM.cs" />
<Compile Include="Java.Interop\JniAllocObjectRef.cs" />
<Compile Include="Java.Interop\JniReferenceSafeHandle.cs" />
<Compile Include="Java.Interop\JniEnvironment.cs" />
<Compile Include="Java.Interop\JniEnvironment.g.cs" />
<Compile Include="Java.Interop\JniEnvironment.References.cs" />
Expand All @@ -53,9 +65,6 @@
<Compile Include="Java.Interop\JniStaticFieldInfo.cs" />
<Compile Include="Java.Interop\JniType.cs" />
<Compile Include="Java.Interop\JValue.cs" />
<Compile Include="Java.Interop\JniGlobalReference.cs" />
<Compile Include="Java.Interop\JniWeakGlobalReference.cs" />
<Compile Include="Java.Interop\JniLocalReference.cs" />
<Compile Include="Java.Interop\JavaException.cs" />
<Compile Include="Java.Interop\JniNativeMethodRegistration.cs" />
<Compile Include="Java.Interop\JavaObject.cs" />
Expand Down Expand Up @@ -99,6 +108,13 @@
<Compile Include="Java.Interop\JniMarshalMethod.cs" />
<Compile Include="Java.Interop\ManagedPeer.cs" />
</ItemGroup>
<ItemGroup Condition=" !$(Configuration.StartsWith('XAIntegration')) ">
<Compile Include="Java.Interop\JniAllocObjectRef.cs" />
<Compile Include="Java.Interop\JniGlobalReference.cs" />
<Compile Include="Java.Interop\JniLocalReference.cs" />
<Compile Include="Java.Interop\JniReferenceSafeHandle.cs" />
<Compile Include="Java.Interop\JniWeakGlobalReference.cs" />
</ItemGroup>
<ItemGroup>
<CompileJavaInteropJar Include="java\com\xamarin\android\internal\JavaProxyObject.java" />
<CompileJavaInteropJar Include="java\com\xamarin\android\internal\JavaProxyThrowable.java" />
Expand All @@ -115,11 +131,11 @@
<PropertyGroup>
<Runtime Condition="'$(OS)' != 'Windows_NT'">mono</Runtime>
</PropertyGroup>
<Target Name="BuildJniEnvironment_g_cs" Inputs="$(OutputPath)\jnienv-gen.exe" Outputs="Java.Interop\JniEnvironment.g.cs">
<Exec Command="$(Runtime) &quot;$(OutputPath)\jnienv-gen.exe&quot; Java.Interop\JniEnvironment.g.cs" />
<Target Name="BuildJniEnvironment_g_cs" Inputs="$(JNIEnvGenPath)\jnienv-gen.exe" Outputs="Java.Interop\JniEnvironment.g.cs;$(OutputPath)\jni.c">
<Exec Command="$(Runtime) &quot;$(JNIEnvGenPath)\jnienv-gen.exe&quot; Java.Interop\JniEnvironment.g.cs $(OutputPath)\jni.c" />
</Target>
<ItemGroup>
<JavaInteropJar Include="%24%28OutputPath%29java-interop.jar" />
<JavaInteropJar Include="$(OutputPath)java-interop.jar" />
</ItemGroup>
<Target Name="BuildInteropJar" Inputs="@(CompileJavaInteropJar)" Outputs="@(JavaInteropJar)">
<MakeDir Directories="$(OutputPath)ji-classes" />
Expand Down

0 comments on commit 54a2aff

Please sign in to comment.