Skip to content

Commit 00ebd76

Browse files
committed
Merge branch 'main' into dev/grendel/extended-timing
* main: [xamarin-android-tools] import $(LibZipSharpVersion) value (#8738) Bump to xamarin/Java.Interop/main@c825dcad (#8701) Bump to xamarin/monodroid@cb01503327 (#8742)
2 parents e5d4b7f + d21f6db commit 00ebd76

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

.external

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
xamarin/monodroid:main@848d1277b76a599d8a280d58ec06e95477b4a7e5
1+
xamarin/monodroid:main@cb01503327f7723ec138ec4cc051610fecee1bf7

external/Java.Interop

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<Project>
2+
<!-- Import $(LibZipSharpVersion) -->
3+
<Import Project="..\Directory.Build.props" />
4+
</Project>

src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
using Xamarin.Android.Tools;
2222
using Microsoft.Android.Build.Tasks;
23+
using Java.Interop.Tools.JavaCallableWrappers.Adapters;
2324

2425
namespace Xamarin.Android.Tasks
2526
{
@@ -463,6 +464,16 @@ bool CreateJavaSources (IEnumerable<JavaType> newJavaTypes, TypeDefinitionCache
463464
bool hasExportReference = ResolvedAssemblies.Any (assembly => Path.GetFileName (assembly.ItemSpec) == "Mono.Android.Export.dll");
464465
bool generateOnCreateOverrides = int.Parse (AndroidSdkPlatform) <= 10;
465466

467+
var reader_options = new CallableWrapperReaderOptions {
468+
DefaultApplicationJavaClass = ApplicationJavaClass,
469+
DefaultGenerateOnCreateOverrides = generateOnCreateOverrides,
470+
DefaultMonoRuntimeInitialization = monoInit,
471+
MethodClassifier = classifier,
472+
};
473+
var writer_options = new CallableWrapperWriterOptions {
474+
CodeGenerationTarget = JavaPeerStyle.XAJavaInterop1
475+
};
476+
466477
bool ok = true;
467478
foreach (JavaType jt in newJavaTypes) {
468479
TypeDefinition t = jt.Type; // JCW generator doesn't care about ABI-specific types or token ids
@@ -473,23 +484,21 @@ bool CreateJavaSources (IEnumerable<JavaType> newJavaTypes, TypeDefinitionCache
473484

474485
using (var writer = MemoryStreamPool.Shared.CreateStreamWriter ()) {
475486
try {
476-
var jti = new JavaCallableWrapperGenerator (t, Log.LogWarning, cache, classifier) {
477-
GenerateOnCreateOverrides = generateOnCreateOverrides,
478-
ApplicationJavaClass = ApplicationJavaClass,
479-
MonoRuntimeInitialization = monoInit,
480-
};
487+
var jcw_type = CecilImporter.CreateType (t, cache, reader_options);
488+
489+
jcw_type.Generate (writer, writer_options);
481490

482-
jti.Generate (writer);
483491
if (useMarshalMethods) {
484492
if (classifier.FoundDynamicallyRegisteredMethods (t)) {
485493
Log.LogWarning ($"Type '{t.GetAssemblyQualifiedName (cache)}' will register some of its Java override methods dynamically. This may adversely affect runtime performance. See preceding warnings for names of dynamically registered methods.");
486494
}
487495
}
496+
488497
writer.Flush ();
489498

490-
var path = jti.GetDestinationPath (outputPath);
499+
var path = jcw_type.GetDestinationPath (outputPath);
491500
Files.CopyIfStreamChanged (writer.BaseStream, path);
492-
if (jti.HasExport && !hasExportReference)
501+
if (jcw_type.HasExport && !hasExportReference)
493502
Diagnostic.Error (4210, Properties.Resources.XA4210);
494503
} catch (XamarinAndroidException xae) {
495504
ok = false;

0 commit comments

Comments
 (0)