Skip to content

Commit b68f2e6

Browse files
committed
Merge remote-tracking branch 'origin/main' into dev/pjc/1estemp
2 parents e0cc0ab + 87d8914 commit b68f2e6

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ extends:
329329
- stage: maui_tests
330330
displayName: MAUI Tests
331331
dependsOn: mac_build
332-
condition: and(eq(dependencies.mac_build.result, 'Succeeded'), eq(variables['System.PullRequest.TargetBranch'], 'main'))
332+
condition: and(eq(dependencies.mac_build.result, 'Succeeded'), eq(variables['RunMAUITestJob'], 'true'))
333333
jobs:
334334
# Check - "Xamarin.Android (MAUI Tests MAUI Integration)"
335335
- job: maui_tests_integration

build-tools/automation/yaml-templates/variables.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ variables:
5656
value: 34
5757
- name: ExcludedNightlyNUnitCategories
5858
value: 'cat != SystemApplication & cat != TimeZoneInfo & cat != Localization'
59+
- name: RunMAUITestJob
60+
value: true

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/BuildApk.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public class BuildApk : AndroidTask
3333
[Required]
3434
public string ApkOutputPath { get; set; }
3535

36+
public string AppSharedLibrariesDir { get; set; }
37+
3638
[Required]
3739
public ITaskItem[] ResolvedUserAssemblies { get; set; }
3840

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)