Skip to content

Commit b1693b4

Browse files
committed
***DO NOT MERGE*** Context: dotnet/java-interop#597 Just testing to see if dotnet/java-interop#597 works... Need to use `msbuild /restore` for all builds to allow `Java.Interop.Tools.Cecil` to build; see: dotnet#4376 (comment) Note: `$(TargetFrameworks)` throws a wrench into things. If two `$(TargetFramework)` builds share the same output directory, the `IncrementalClean` target will *remove files created by previous builds*, e.g. when e.g. `generator.csproj` builds the `netcoreapp3.1` framework, it will *delete* the `generator.exe` built by the `net472` framework, which results in subsequent build breaks. The only path to sanity is to *ensure* that different `$(TargetFramework)` builds have *completely separate* `$(OutputPath)` values. The "normal" approach to doing this is for `$(OutputPath)` to end with `$(TargetFramework)`. The problem here is that xamarin-android is setup so that we mirror the installation directory, with e.g. `bin/Debug` being an "installation root", and that installation root *won't* (normally?) have *both* net472 and netcoreapp3.1 outputs for the "same" project. The "solution" is to use the new `$(UtilityOutputFullPathCoreApps)` property within Java.Interop to ensure that Java.Interop "utility" apps -- normally placed into `bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android` -- are *instead* placed into `bin/Debug-netcoreapp3.1` for netcoreapp3.1 builds. This ensure that things *actually build*. Locally. YMMV.
1 parent d2e9a3f commit b1693b4

File tree

10 files changed

+24
-31
lines changed

10 files changed

+24
-31
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
branch = v1.1.1
1313
[submodule "external/Java.Interop"]
1414
path = external/Java.Interop
15-
url = https://github.com/xamarin/java.interop.git
16-
branch = master
15+
url = https://github.com/jonpryor/java.interop.git
16+
branch = jonp-cecil-nuget
1717
[submodule "external/mman-win32"]
1818
path = external/mman-win32
1919
url = https://github.com/witwall/mman-win32.git

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ BOOTSTRAP_BUILD_LOG = bin/Build$(CONFIGURATION)/bootstrap-build.binlog
3131
BOOTSTRAP_MSBUILD_FLAGS = /t:Restore,Build /binaryLogger:"$(BOOTSTRAP_BUILD_LOG)" $(PREPARE_COMMON_MSBUILD_FLAGS)
3232

3333
all:
34-
$(call MSBUILD_BINLOG,all,$(_SLN_BUILD)) $(MSBUILD_FLAGS) $(SOLUTION)
34+
$(call MSBUILD_BINLOG,all,$(_SLN_BUILD)) /restore $(MSBUILD_FLAGS) $(SOLUTION)
3535

3636
-include bin/Build$(CONFIGURATION)/rules.mk
3737

Xamarin.Android.sln

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK", "src\OpenTK-1.0\Op
7878
{3F1F2F50-AF1A-4A5A-BEDB-193372F068D7} = {3F1F2F50-AF1A-4A5A-BEDB-193372F068D7}
7979
EndProjectSection
8080
EndProject
81-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Cecil", "external\Java.Interop\src\Xamarin.Android.Cecil\Xamarin.Android.Cecil.csproj", "{15945D4B-FF56-4BCC-B598-2718D199DD08}"
82-
EndProject
83-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Cecil.Mdb", "external\Java.Interop\src\Xamarin.Android.Cecil\Xamarin.Android.Cecil.Mdb.csproj", "{C0487169-8F81-497F-919E-EB42B1D0243F}"
84-
EndProject
8581
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "proguard", "src\proguard\proguard.csproj", "{4B9D96BB-95AB-44E8-9F87-13B12C8BCED1}"
8682
EndProject
8783
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "api-xml-adjuster", "build-tools\api-xml-adjuster\api-xml-adjuster.csproj", "{8A6CB07C-E493-4A4F-AB94-038645A27118}"
@@ -263,14 +259,6 @@ Global
263259
{5EB9E888-E357-417E-9F39-DDEC195CE47F}.Debug|AnyCPU.Build.0 = Debug|Any CPU
264260
{5EB9E888-E357-417E-9F39-DDEC195CE47F}.Release|AnyCPU.ActiveCfg = Release|Any CPU
265261
{5EB9E888-E357-417E-9F39-DDEC195CE47F}.Release|AnyCPU.Build.0 = Release|Any CPU
266-
{15945D4B-FF56-4BCC-B598-2718D199DD08}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
267-
{15945D4B-FF56-4BCC-B598-2718D199DD08}.Debug|AnyCPU.Build.0 = Debug|Any CPU
268-
{15945D4B-FF56-4BCC-B598-2718D199DD08}.Release|AnyCPU.ActiveCfg = Release|Any CPU
269-
{15945D4B-FF56-4BCC-B598-2718D199DD08}.Release|AnyCPU.Build.0 = Release|Any CPU
270-
{C0487169-8F81-497F-919E-EB42B1D0243F}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
271-
{C0487169-8F81-497F-919E-EB42B1D0243F}.Debug|AnyCPU.Build.0 = Debug|Any CPU
272-
{C0487169-8F81-497F-919E-EB42B1D0243F}.Release|AnyCPU.ActiveCfg = Release|Any CPU
273-
{C0487169-8F81-497F-919E-EB42B1D0243F}.Release|AnyCPU.Build.0 = Release|Any CPU
274262
{4B9D96BB-95AB-44E8-9F87-13B12C8BCED1}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
275263
{4B9D96BB-95AB-44E8-9F87-13B12C8BCED1}.Debug|AnyCPU.Build.0 = Debug|Any CPU
276264
{4B9D96BB-95AB-44E8-9F87-13B12C8BCED1}.Release|AnyCPU.ActiveCfg = Release|Any CPU
@@ -417,8 +405,6 @@ Global
417405
{7387E151-48E3-4885-B2CA-A74434A34045} = {864062D3-A415-4A6F-9324-5820237BA058}
418406
{B8F799C5-D7CE-4E09-9CE6-BAA4173E7EC8} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
419407
{5EB9E888-E357-417E-9F39-DDEC195CE47F} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
420-
{15945D4B-FF56-4BCC-B598-2718D199DD08} = {864062D3-A415-4A6F-9324-5820237BA058}
421-
{C0487169-8F81-497F-919E-EB42B1D0243F} = {864062D3-A415-4A6F-9324-5820237BA058}
422408
{4B9D96BB-95AB-44E8-9F87-13B12C8BCED1} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
423409
{8A6CB07C-E493-4A4F-AB94-038645A27118} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
424410
{E0890301-F75F-40E7-B008-54C28B3BA542} = {864062D3-A415-4A6F-9324-5820237BA058}

build-tools/scripts/BuildEverything.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif
2626
leeroy: leeroy-all framework-assemblies opentk-jcw
2727

2828
leeroy-all:
29-
$(call MSBUILD_BINLOG,leeroy-all,$(_SLN_BUILD)) $(SOLUTION) /p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS)
29+
$(call MSBUILD_BINLOG,leeroy-all,$(_SLN_BUILD)) /restore $(SOLUTION) /p:Configuration=$(CONFIGURATION) $(_MSBUILD_ARGS)
3030

3131
opentk-jcw:
3232
$(foreach api_level, $(API_LEVELS), \

build-tools/scripts/Configuration.Java.Interop.Override.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<CecilSourceDirectory>$(MSBuildThisFileDirectory)..\..\external\mono\external\cecil</CecilSourceDirectory>
55
<UtilityOutputFullPath>$(MSBuildThisFileDirectory)..\..\bin\$(Configuration)\lib\xamarin.android\xbuild\Xamarin\Android\</UtilityOutputFullPath>
6+
<UtilityOutputFullPathCoreApps>$(MSBuildThisFileDirectory)..\..\bin\$(Configuration)-netcoreapp3.1\</UtilityOutputFullPathCoreApps>
67
<XamarinAndroidToolsDirectory>$(MSBuildThisFileDirectory)..\..\external\xamarin-android-tools</XamarinAndroidToolsDirectory>
78
</PropertyGroup>
89
</Project>

build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ public static partial class Paths
285285

286286
public static string TestBinDir => GetCachedPath (ref testBinDir, () => Path.Combine (Configurables.Paths.BinDirRoot, $"Test{ctx.Configuration}"));
287287
public static string BinDir => GetCachedPath (ref binDir, () => Path.Combine (Configurables.Paths.BinDirRoot, ctx.Configuration));
288+
public static string NetCoreBinDir => GetCachedPath (ref binDir, () => Path.Combine (Configurables.Paths.BinDirRoot, $"{ctx.Configuration}-netcoreapp3.1"));
288289
public static string BuildBinDir => GetCachedPath (ref buildBinDir, () => Path.Combine (Configurables.Paths.BinDirRoot, $"Build{ctx.Configuration}"));
289290
public static string MingwBinDir => GetCachedPath (ref mingwBinDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidMxeFullPath), "bin"));
290291
public static string ProfileAssembliesProjitemsPath => GetCachedPath (ref profileAssembliesProjitemsPath, () => Path.Combine (BuildBinDir, "ProfileAssemblies.projitems"));

build-tools/xaprepare/xaprepare/Steps/Step_InstallMonoRuntimes.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ async Task<bool> ConjureXamarinCecilAndRemapRef (Context context, bool haveManag
124124
return false;
125125
}
126126

127+
Utilities.CreateDirectory (Configurables.Paths.NetCoreBinDir);
128+
Utilities.CopyFile (assemblyPath, Path.Combine (Configurables.Paths.NetCoreBinDir, "Xamarin.Android.Cecil.dll"));
129+
127130
StatusStep (context, "Re-signing Xamarin.Android.Cecil.Mdb.dll");
128131
assemblyPath = Path.Combine (Configurables.Paths.BuildBinDir, "Xamarin.Android.Cecil.Mdb.dll");
129132
result = await sn.ReSign (snkPath, assemblyPath, $"sign-xamarin-android-cecil-mdb");
@@ -132,6 +135,8 @@ async Task<bool> ConjureXamarinCecilAndRemapRef (Context context, bool haveManag
132135
return false;
133136
}
134137

138+
Utilities.CopyFile (assemblyPath, Path.Combine (Configurables.Paths.NetCoreBinDir, "Xamarin.Android.Cecil.Mdb.dll"));
139+
135140
return true;
136141
}
137142

build-tools/xaprepare/xaprepare/ThirdPartyNotices/Java.Interop.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class JavaInterop_External_Dependencies_Group : ThirdPartyNoticeGroup
1212
public override List<ThirdPartyNotice> Notices => new List <ThirdPartyNotice> {
1313
new JavaInterop_xamarin_Java_Interop_TPN (),
1414
new JavaInterop_gityf_crc_TPN (),
15-
new JavaInterop_xamarin_mono_cecil_TPN (),
1615
new JavaInterop_jbevain_mono_linq_expressions_TPN (),
1716
new JavaInterop_mono_csharp_TPN (),
1817
new JavaInterop_mono_LineEditor_TPN (),
@@ -71,17 +70,6 @@ POSSIBILITY OF SUCH DAMAGE.
7170
}
7271

7372
// git submodules of Java.Interop
74-
class JavaInterop_xamarin_mono_cecil_TPN : ThirdPartyNotice
75-
{
76-
static readonly Uri url = new Uri ("https://github.com/mono/cecil/");
77-
static readonly string licenseFile = Path.Combine (Configurables.Paths.ExternalJavaInteropDir, "external", "cecil", "LICENSE.txt");
78-
79-
public override string LicenseFile => licenseFile;
80-
public override string Name => "mono/cecil";
81-
public override Uri SourceUrl => url;
82-
public override string LicenseText => null;
83-
}
84-
8573
class JavaInterop_jbevain_mono_linq_expressions_TPN : ThirdPartyNotice
8674
{
8775
static readonly Uri url = new Uri ("https://github.com/jbevain/mono.linq.expressions/");

build-tools/xaprepare/xaprepare/ThirdPartyNotices/mono.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class mono_External_Dependencies_Group : ThirdPartyNoticeGroup
1111

1212
public override List<ThirdPartyNotice> Notices => new List <ThirdPartyNotice> {
1313
new mono_mono_mono_TPN (),
14+
new mono_mono_cecil_TPN (),
1415
new mono_mono_boringssl_TPN (),
1516
new mono_mono_ikdasm_TPN (),
1617
new mono_mono_ikvm_fork_TPN (),
@@ -23,6 +24,17 @@ class mono_External_Dependencies_Group : ThirdPartyNoticeGroup
2324
};
2425
}
2526

27+
class mono_mono_cecil_TPN : ThirdPartyNotice
28+
{
29+
static readonly Uri url = new Uri ("https://github.com/mono/cecil/");
30+
static readonly string licenseFile = Path.Combine (Configurables.Paths.MonoSdksTpnPath, "external", "cecil", "LICENSE.txt");
31+
32+
public override string LicenseFile => licenseFile;
33+
public override string Name => "mono/cecil";
34+
public override Uri SourceUrl => url;
35+
public override string LicenseText => null;
36+
}
37+
2638
class mono_mono_mono_TPN : ThirdPartyNotice
2739
{
2840
static readonly Uri url = new Uri ("https://github.com/mono/");

0 commit comments

Comments
 (0)