Commit fb637e0
authored
[.NET 5] support for binding projects (#4646)
The current idea for binding projects in .NET 5 is they won't be a
distinct project type at all anymore. It would be completely valid
to put this in a .NET 5 Xamarin.Android app with `$(OutputType)` of
`Exe`:
<InputJar Include="foo.jar" />
A project with an `$(OutputType)` of `Library` would likely do:
<EmbeddedJar Include="foo.jar" />
To make this work, I've split up `Xamarin.Android.Bindings.targets`
into a few different files:
* `Xamarin.Android.Bindings.Core.targets`: the targets shared
between .NET 5 and "legacy" binding projects. It imports the
other new files.
* `Xamarin.Android.Bindings.ClassParse.targets`: is only imported
when `$(AndroidClassParser)` is `class-parse`.
* `Xamarin.Android.Bindings.JarToXml.targets`: is only imported
when `$(AndroidClassParser)` is `jar2xml`.
* `Xamarin.Android.Bindings.Documentation.targets`: is imported by
"legacy" binding projects, contains targets related to
documentation extraction/generation. We will eventually use this
in .NET 5 when `mdoc.exe` is available or we have an alternative.
Once these were split up, to get bindings working in .NET 5 projects
I had to:
1. Import `Xamarin.Android.Bindings.Core.targets`.
2. Update `Microsoft.Android.Sdk.BuildOrder.targets` to include the
binding-specific targets.
3. Make the binding targets only run if there are any `@(InputJar)`
or `@(EmbeddedJar)`.
One hangup is that bindings require:
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
We probably don't want this set for all projects by default. I set
this if any of the binding targets run, so that once you add a
`@(InputJar)` it gets turned on.
I updated `XASdkTests` to verify binding `.jar` files works in a
library project and an app project.
Other changes:
* Added a new `AndroidDotnetToolTask` for swapping between
`generator.exe` and `dotnet generator.dll` calls.
* I ported `javadoc2mdoc.csproj` to use short-form projects, and
multi-target both `net472` and `netcoreapp3.1`.
* The `<ImportJavaDoc/>` task now extends `AndroidDotnetToolTask`.
* `$(ApplicationResolveReferencesDependsOn)` is unused, so I removed
usage of it.
* I removed the `_ResolveMonoAndroidFramework` target, it was not
needed.
TODO:
* Item groups like `@(JavaSourceJar)` can't fully work yet in .NET 5.
`Xamarin.Android.Documentation.targets` uses `mdoc.exe`, which
won't run under `dotnet` yet.
* For now, `Xamarin.Android.Documentation.targets` is not imported in
.NET 5 projects.1 parent 268c40d commit fb637e0
File tree
22 files changed
+673
-445
lines changed- Documentation/guides
- build-tools
- create-packs
- installers
- src/Xamarin.Android.Build.Tasks
- MSBuild/Xamarin/Android
- Microsoft.Android.Sdk/targets
- Tasks
- Tests/Xamarin.Android.Build.Tests
- Utilities
- tools/javadoc2mdoc
- Properties
22 files changed
+673
-445
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
25 | 51 | | |
26 | 52 | | |
27 | 53 | | |
| |||
45 | 71 | | |
46 | 72 | | |
47 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
48 | 84 | | |
49 | 85 | | |
50 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
124 | 124 | | |
125 | | - | |
126 | | - | |
| 125 | + | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
| 131 | + | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
| 135 | + | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
185 | 185 | | |
186 | | - | |
187 | | - | |
| 186 | + | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
217 | 221 | | |
218 | 222 | | |
219 | 223 | | |
| |||
369 | 373 | | |
370 | 374 | | |
371 | 375 | | |
372 | | - | |
| 376 | + | |
373 | 377 | | |
374 | 378 | | |
375 | 379 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
0 commit comments