Commit a77aa33
authored
[Java.Interop] Conditionally call ManagedPeer.Init() (#761)
Context: dotnet/android#5400
Context: dotnet/android#5444
Don't call `ManagedPeer.Init()` from the `JniRuntime` constructor when
`XA_JI_EXCLUDE` is `#define`d.
The presence of `ManagedPeer.Init()` requires that *all*
Xamarin.Android apps contain `System.Linq.Expressions` types after
linking, because `ManagedPeer.Construct()` calls
`JniEnvironment.Runtime.MarshalMemberBuilder.CreateConstructActivationPeerFunc()`
which pulls in all the `System.Linq.Expressions` infrastructure.
Currently, *nothing* requires `ManagedPeer` *at all*; Java.Interop-
"style" "Java Activation" (8c83f64) is not used outside of unit tests.
Consequently, there is no need to pay the cost of
System.Linq.Expressions within all Xamarin.Android apps.
Wrap the `ManagedPeer.Init()` invocation with `XA_JI_EXCLUDE` so that
the Xamarin.Android build of `Java.Interop.dll` (893562c) *excludes*
the `ManagedPeer.Init()` invocation. This allows every Xamarin.Android
app to link out System.Linq.Expressions, unless the app is otherwise
using that namespace.
`XA_JI_EXCLUDE` is intended to be set by
`$(JavaInteropDefineConstants)` MSBUild property within the optional
file `bin/Build$(Configuration)/XAConfig.props`, which the
xamarin-android build will create before building `Java.Interop.csproj`.
Cleanup the `src/Java.Interop` source code to remove use of the
`XA_INTEGRATION` symbol. This symbol is no longer of use, and now
only adds noise.1 parent da12df4 commit a77aa33
File tree
11 files changed
+16
-40
lines changed- src/Java.Interop
- Java.Interop
11 files changed
+16
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | | - | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
42 | | - | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
8 | | - | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
44 | | - | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
67 | | - | |
68 | 66 | | |
69 | 67 | | |
70 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
| |||
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
28 | | - | |
29 | 27 | | |
30 | | - | |
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
| |||
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
123 | | - | |
124 | 122 | | |
125 | 123 | | |
126 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
| |||
47 | 45 | | |
48 | 46 | | |
49 | 47 | | |
50 | | - | |
51 | 48 | | |
52 | 49 | | |
53 | 50 | | |
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
57 | | - | |
58 | 54 | | |
59 | 55 | | |
60 | 56 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | | - | |
| 251 | + | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
329 | 328 | | |
330 | 329 | | |
331 | 330 | | |
332 | | - | |
333 | 331 | | |
334 | 332 | | |
335 | 333 | | |
| |||
389 | 387 | | |
390 | 388 | | |
391 | 389 | | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | 390 | | |
396 | | - | |
397 | 391 | | |
398 | 392 | | |
399 | 393 | | |
| |||
436 | 430 | | |
437 | 431 | | |
438 | 432 | | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | 433 | | |
445 | | - | |
446 | 434 | | |
447 | 435 | | |
448 | 436 | | |
| |||
0 commit comments