Commit 85be94f
[Java.Interop] Target .NET Standard 2.0
We would like to be able to build [xamarin-android][0]'s
`Xamarin.Android.sln` within Visual Studio (Windows).
@joj believes that the difficulty is "caused" by
`src/Java.Interop/Java.Interop.csproj` being a PCL project, and thus
if we migrated our PCL projects to instead use .NET Standard the
difficulties would be resolved.
Update `Java.Interop`, `Java.Interop.Dynamic`, `Java.Interop.Export`,
and `Java.Interop.GenericMarshaler` to be .NET Standard 2.0 projects
instead of PCL projects.
This in turn requires updating *every other project* to have a
`$(TargetFrameworkVersion)` value of v4.6.1 (or later) so that they
can reference .NET Standard 2.0 libraries.
Additionally, `make fxcop` and related need to be updated, as the
output paths for .NET Standard 2.0 builds has changed.
Migrating to .NET Standard 2 *also* impacts the downstream
xamarin-android repo: building `xamarin-android/src/Mono.Android`
would fail:
Microsoft.NuGet.targets(184,5): error : Your project is not referencing the "MonoAndroid,Version=v1.0" framework. Add a reference to "MonoAndroid,Version=v1.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
The fix for this is twofold:
1. Provide a new `Java.Interop-MonoAndroid.csproj` file for use by
the `xamarin-android/src/Mono.Android` build [^1], and
2. *Override* the `$(BaseIntermediateOutputPath)` MSBuild property.
`$(BaseIntermediateOutputPath)` is used to find the
`project*.json` files within `Microsoft.NuGet.targets`, and
altering `$(BaseIntermediateOutputPath)` thus prevents the
`project*.json` files from being found, allowing the build to
succeed.
Finally, building .NET Standard 2 projects often requires that the
`msbuild /restore` or `msbuild /t:Restore` commands be used.
Integrate `msbuild /t:Restore` into `make prepare`, and fix the
`src/java-interop` project so that `msbuild /t:Restore` works without
emitting errors.
[0]: https://github.com/xamarin/xamarin-android/
[^1]: The following patch needs to be applied to `xamarin-android`
when performing the next `Java.Interop` submodule bump:
diff --git a/src/Mono.Android/Mono.Android.targets b/src/Mono.Android/Mono.Android.targets
index 1d7e0c1a..848a3f63 100644
--- a/src/Mono.Android/Mono.Android.targets
+++ b/src/Mono.Android/Mono.Android.targets
@@ -20,7 +20,7 @@
</_GlobalProperties>
</PropertyGroup>
<MSBuild
- Projects="$(JavaInteropFullPath)\src\Java.Interop\Java.Interop.csproj"
+ Projects="$(JavaInteropFullPath)\src\Java.Interop\Java.Interop-MonoAndroid.csproj"
Properties="$(_GlobalProperties)"
/>
<ItemGroup>1 parent 706e4cc commit 85be94f
File tree
43 files changed
+265
-428
lines changed- build-tools/Java.Interop.BootstrapTasks
- samples/Hello
- src
- Java.Interop.Dynamic
- Properties
- Tests
- Java.Interop.Export
- Properties
- Java.Interop.GenericMarshaler
- Properties
- Java.Interop.Tools.Cecil
- Java.Interop.Tools.Diagnostics
- Java.Interop.Tools.JavaCallableWrappers
- Test
- Java.Interop
- Properties
- Java.Runtime.Environment
- Xamarin.Android.Tools.AnnotationSupport.Cecil
- Xamarin.Android.Tools.AnnotationSupport
- Xamarin.Android.Tools.ApiXmlAdjuster
- Tests
- Xamarin.Android.Tools.Bytecode
- Tests
- java-interop
- tests
- Java.Interop-PerformanceTests
- Java.Interop-Tests
- Java.Interop.Dynamic-Tests
- Java.Interop.Export-Tests
- TestJVM
- tools
- class-parse
- generator
- Tests
- Integration-Tests
- jcw-gen
- jnimarshalmethod-gen
- logcat-parse
- Tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
43 files changed
+265
-428
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | | - | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
85 | | - | |
86 | | - | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | | - | |
| 131 | + | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
8 | 5 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 6 | + | |
15 | 7 | | |
16 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
17 | 13 | | |
18 | 14 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 15 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 16 | | |
29 | 17 | | |
30 | | - | |
31 | | - | |
32 | 18 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 19 | | |
38 | 20 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 21 | + | |
50 | 22 | | |
51 | | - | |
52 | 23 | | |
53 | 24 | | |
54 | 25 | | |
| |||
This file was deleted.
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
8 | 5 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 6 | | |
16 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
17 | 12 | | |
18 | 13 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 14 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 15 | | |
28 | 16 | | |
29 | | - | |
30 | | - | |
31 | 17 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 18 | | |
36 | 19 | | |
37 | | - | |
38 | | - | |
39 | | - | |
| 20 | + | |
| 21 | + | |
40 | 22 | | |
41 | | - | |
42 | 23 | | |
43 | 24 | | |
44 | 25 | | |
| |||
This file was deleted.
Lines changed: 7 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
8 | 5 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 6 | + | |
15 | 7 | | |
16 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
17 | 13 | | |
18 | 14 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 15 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 16 | | |
28 | 17 | | |
29 | | - | |
30 | 18 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 19 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | 20 | | |
42 | 21 | | |
43 | 22 | | |
44 | 23 | | |
45 | 24 | | |
46 | 25 | | |
47 | | - | |
48 | 26 | | |
49 | 27 | | |
50 | 28 | | |
| |||
Lines changed: 0 additions & 26 deletions
This file was deleted.
0 commit comments