Skip to content

Commit 54a2aff

Browse files
committed
[build] Add XAIntegrationDebug configuration, make xa-all target.
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.
1 parent 0613419 commit 54a2aff

File tree

3 files changed

+40
-9
lines changed

3 files changed

+40
-9
lines changed

Java.Interop.sln

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Global
5757
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5858
Debug|Any CPU = Debug|Any CPU
5959
Release|Any CPU = Release|Any CPU
60+
XAIntegrationDebug|Any CPU = XAIntegrationDebug|Any CPU
6061
EndGlobalSection
6162
GlobalSection(ProjectConfigurationPlatforms) = postSolution
6263
{04E28441-36FF-4964-ADD7-EFBB47CCE406}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -83,6 +84,8 @@ Global
8384
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
8485
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
8586
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.Release|Any CPU.Build.0 = Release|Any CPU
87+
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.XAIntegrationDebug|Any CPU.ActiveCfg = Debug|Any CPU
88+
{6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A}.XAIntegrationDebug|Any CPU.Build.0 = Debug|Any CPU
8689
{6970466B-F6D1-417A-8A27-4FED8555EBD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8790
{6970466B-F6D1-417A-8A27-4FED8555EBD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
8891
{6970466B-F6D1-417A-8A27-4FED8555EBD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -95,6 +98,8 @@ Global
9598
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.Debug|Any CPU.Build.0 = Debug|Any CPU
9699
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.Release|Any CPU.ActiveCfg = Release|Any CPU
97100
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.Release|Any CPU.Build.0 = Release|Any CPU
101+
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.XAIntegrationDebug|Any CPU.ActiveCfg = XAIntegrationDebug|Any CPU
102+
{94BD81F7-B06F-4295-9636-F8A3B6BDC762}.XAIntegrationDebug|Any CPU.Build.0 = XAIntegrationDebug|Any CPU
98103
{A76309AB-98AC-4AE2-BA30-75481420C52F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99104
{A76309AB-98AC-4AE2-BA30-75481420C52F}.Debug|Any CPU.Build.0 = Debug|Any CPU
100105
{A76309AB-98AC-4AE2-BA30-75481420C52F}.Release|Any CPU.ActiveCfg = Release|Any CPU

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
CONFIGURATION = Debug
22

3+
XA_CONFIGURATION = XAIntegrationDebug
4+
35
DEPENDENCIES = \
46
bin/$(CONFIGURATION)/libNativeTiming.dylib
57

8+
XA_INTEGRATION_OUTPUTS = \
9+
bin/$(XA_CONFIGURATION)/Java.Interop.dll
10+
611
TESTS = \
712
bin/$(CONFIGURATION)/Java.Interop-Tests.dll \
813
bin/$(CONFIGURATION)/Java.Interop.Dynamic-Tests.dll \
@@ -16,7 +21,9 @@ ATESTS = \
1621

1722
XBUILD = xbuild
1823

19-
all: $(DEPENDENCIES) $(TESTS)
24+
all: $(DEPENDENCIES) $(TESTS) $(XA_INTEGRATION_OUTPUTS)
25+
26+
xa-all: $(XA_INTEGRATION_OUTPUTS)
2027

2128
clean:
2229
$(XBUILD) /t:Clean
@@ -63,6 +70,9 @@ bin/$(CONFIGURATION)/Android.Interop-Tests.dll: $(wildcard src/Android.Interop/*
6370
$(XBUILD)
6471
touch $@
6572

73+
bin/$(XA_CONFIGURATION)/Java.Interop.dll:
74+
$(XBUILD) /p:Configuration=$(XA_CONFIGURATION)
75+
6676
CSHARP_REFS = \
6777
bin/$(CONFIGURATION)/Java.Interop.dll \
6878
bin/$(CONFIGURATION)/Java.Interop.Export.dll \

src/Java.Interop/Java.Interop.csproj

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<WarningLevel>4</WarningLevel>
2424
<ConsolePause>false</ConsolePause>
2525
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
26+
<JNIEnvGenPath>$(OutputPath)</JNIEnvGenPath>
2627
</PropertyGroup>
2728
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2829
<Optimize>true</Optimize>
@@ -32,13 +33,24 @@
3233
<ConsolePause>false</ConsolePause>
3334
<DefineConstants>INTEROP</DefineConstants>
3435
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
36+
<JNIEnvGenPath>$(OutputPath)</JNIEnvGenPath>
37+
</PropertyGroup>
38+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'XAIntegrationDebug|AnyCPU' ">
39+
<DebugSymbols>true</DebugSymbols>
40+
<DebugType>full</DebugType>
41+
<Optimize>false</Optimize>
42+
<OutputPath>..\..\bin\XAIntegrationDebug</OutputPath>
43+
<DefineConstants>DEBUG;INTEROP;FEATURE_HANDLES_ARE_INTPTRS</DefineConstants>
44+
<ErrorReport>prompt</ErrorReport>
45+
<WarningLevel>4</WarningLevel>
46+
<ConsolePause>false</ConsolePause>
47+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
48+
<JNIEnvGenPath>..\..\bin\Debug</JNIEnvGenPath>
3549
</PropertyGroup>
3650
<ItemGroup>
3751
<Compile Include="Properties\AssemblyInfo.cs" />
3852
<Compile Include="Java.Interop\JavaPeerableExtensions.cs" />
3953
<Compile Include="Java.Interop\JavaVM.cs" />
40-
<Compile Include="Java.Interop\JniAllocObjectRef.cs" />
41-
<Compile Include="Java.Interop\JniReferenceSafeHandle.cs" />
4254
<Compile Include="Java.Interop\JniEnvironment.cs" />
4355
<Compile Include="Java.Interop\JniEnvironment.g.cs" />
4456
<Compile Include="Java.Interop\JniEnvironment.References.cs" />
@@ -53,9 +65,6 @@
5365
<Compile Include="Java.Interop\JniStaticFieldInfo.cs" />
5466
<Compile Include="Java.Interop\JniType.cs" />
5567
<Compile Include="Java.Interop\JValue.cs" />
56-
<Compile Include="Java.Interop\JniGlobalReference.cs" />
57-
<Compile Include="Java.Interop\JniWeakGlobalReference.cs" />
58-
<Compile Include="Java.Interop\JniLocalReference.cs" />
5968
<Compile Include="Java.Interop\JavaException.cs" />
6069
<Compile Include="Java.Interop\JniNativeMethodRegistration.cs" />
6170
<Compile Include="Java.Interop\JavaObject.cs" />
@@ -99,6 +108,13 @@
99108
<Compile Include="Java.Interop\JniMarshalMethod.cs" />
100109
<Compile Include="Java.Interop\ManagedPeer.cs" />
101110
</ItemGroup>
111+
<ItemGroup Condition=" !$(Configuration.StartsWith('XAIntegration')) ">
112+
<Compile Include="Java.Interop\JniAllocObjectRef.cs" />
113+
<Compile Include="Java.Interop\JniGlobalReference.cs" />
114+
<Compile Include="Java.Interop\JniLocalReference.cs" />
115+
<Compile Include="Java.Interop\JniReferenceSafeHandle.cs" />
116+
<Compile Include="Java.Interop\JniWeakGlobalReference.cs" />
117+
</ItemGroup>
102118
<ItemGroup>
103119
<CompileJavaInteropJar Include="java\com\xamarin\android\internal\JavaProxyObject.java" />
104120
<CompileJavaInteropJar Include="java\com\xamarin\android\internal\JavaProxyThrowable.java" />
@@ -115,11 +131,11 @@
115131
<PropertyGroup>
116132
<Runtime Condition="'$(OS)' != 'Windows_NT'">mono</Runtime>
117133
</PropertyGroup>
118-
<Target Name="BuildJniEnvironment_g_cs" Inputs="$(OutputPath)\jnienv-gen.exe" Outputs="Java.Interop\JniEnvironment.g.cs">
119-
<Exec Command="$(Runtime) &quot;$(OutputPath)\jnienv-gen.exe&quot; Java.Interop\JniEnvironment.g.cs" />
134+
<Target Name="BuildJniEnvironment_g_cs" Inputs="$(JNIEnvGenPath)\jnienv-gen.exe" Outputs="Java.Interop\JniEnvironment.g.cs;$(OutputPath)\jni.c">
135+
<Exec Command="$(Runtime) &quot;$(JNIEnvGenPath)\jnienv-gen.exe&quot; Java.Interop\JniEnvironment.g.cs $(OutputPath)\jni.c" />
120136
</Target>
121137
<ItemGroup>
122-
<JavaInteropJar Include="%24%28OutputPath%29java-interop.jar" />
138+
<JavaInteropJar Include="$(OutputPath)java-interop.jar" />
123139
</ItemGroup>
124140
<Target Name="BuildInteropJar" Inputs="@(CompileJavaInteropJar)" Outputs="@(JavaInteropJar)">
125141
<MakeDir Directories="$(OutputPath)ji-classes" />

0 commit comments

Comments
 (0)