Skip to content

Bump to xamarin/Java.Interop/master@2abfc1e0 #3504

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Aug 19, 2019

Conversation

jonpryor
Copy link
Contributor

Changes: dotnet/java-interop@be58159...2abfc1e

Context: dotnet/java-interop#459

Updates generator so that all bound Java interfaces also implement
IJavaPeerable in addition to IJavaObject, for eventual future
C#8 Default Interface Member support.

[generator] Remove extraneous slash when creating .projitems.

[generator] Always use XAPeerMembers for XAJavaInterop1

Drop dependency on DylibMono when building for Xamarin.Android

[jnienv-gen] fix p/invoke usage for .NET framework

Add jnimarshalmethod-gen.exe -r ASSEMBLY option.

@jonpryor
Copy link
Contributor Author

The build broke: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2944884&view=logs&s=1afc3bfe-122c-538b-e9ad-2a86c2efcfef&j=96fd57f5-f69e-53c7-3d47-f67e6cf9b93e

  In file included from /Users/vsts/agent/2.155.1/work/1/s/external/Java.Interop/src/java-interop/java-interop-mono.cc:2: (TaskId:1377)
  ../../../../../external/Java.Interop/src/java-interop/java-interop-mono.h:10:11: fatal error: 'mono/metadata/assembly.h' file not found (Task
Id:1377)
          #include <mono/metadata/assembly.h> (TaskId:1377)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~ (TaskId:1377)
  1 error generated. (TaskId:1377)

@grendello: could this be related to/caused by this? dotnet/java-interop@285a32b

Do we need to merge PR#3223 in order to bump Java.Interop to dotnet/java-interop@285a32b3?

jonpryor added a commit to jonpryor/java.interop that referenced this pull request Aug 16, 2019
Context: dotnet/android#3504
Context: dotnet/android#3223

When bumping xamarin-android/master to 2abfc1e, the build broke
because of commit 285a32b:

	  In file included from /Users/vsts/agent/2.155.1/work/1/s/external/Java.Interop/src/java-interop/java-interop-mono.cc:2:
	  ../../../../../external/Java.Interop/src/java-interop/java-interop-mono.h:10:11: fatal error: 'mono/metadata/assembly.h' file not found
	          #include <mono/metadata/assembly.h>
	                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
	  1 error generated.

We need to continue supporting the DylibMono backend for integration
purposes (dotnet/android#3504) *while also* allowing for the
*removal* of DylibMono (dotnet/android#3223).

Attempt to support these divergent needs by replacing this:

	#if defined (ANDROID) || defined (XAMARIN_ANDROID_DYLIB_MONO)

with this:

	#if defined (XAMARIN_ANDROID_DYLIB_MONO)

removing the check for the `ANDROID` define.

This will allow xamrin/xamarin-android#3223 to *remove* the
`XAMARIN_ANDROID_DYLIB_MONO` definition in order to introduce it's
desired behavior, removing DylibMono use.

This partially reverts commit 285a32b.
jonpryor added a commit to jonpryor/java.interop that referenced this pull request Aug 16, 2019
Context: dotnet/android#3504
Context: dotnet/android#3223

When bumping xamarin-android/master to 2abfc1e, the build broke
because of commit 285a32b:

	  In file included from /Users/vsts/agent/2.155.1/work/1/s/external/Java.Interop/src/java-interop/java-interop-mono.cc:2:
	  ../../../../../external/Java.Interop/src/java-interop/java-interop-mono.h:10:11: fatal error: 'mono/metadata/assembly.h' file not found
	          #include <mono/metadata/assembly.h>
	                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
	  1 error generated.

We need to continue supporting the DylibMono backend for integration
purposes (dotnet/android#3504) *while also* allowing for the
*removal* of DylibMono (dotnet/android#3223).

Attempt to support these divergent needs by replacing this:

	#if defined (ANDROID) || defined (XAMARIN_ANDROID_DYLIB_MONO)

with this:

	#if defined (XAMARIN_ANDROID_DYLIB_MONO)

removing the check for the `ANDROID` define.

This will allow xamrin/xamarin-android#3223 to *remove* the
`XAMARIN_ANDROID_DYLIB_MONO` definition in order to introduce it's
desired behavior, removing DylibMono use.

This partially reverts commit 285a32b.
jonpryor added a commit to jonpryor/java.interop that referenced this pull request Aug 16, 2019
Context: dotnet/android#3504
Context: dotnet/android#3223

When bumping xamarin-android/master to 2abfc1e, the build broke
because of commit 285a32b:

	  In file included from /Users/vsts/agent/2.155.1/work/1/s/external/Java.Interop/src/java-interop/java-interop-mono.cc:2:
	  ../../../../../external/Java.Interop/src/java-interop/java-interop-mono.h:10:11: fatal error: 'mono/metadata/assembly.h' file not found
	          #include <mono/metadata/assembly.h>
	                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
	  1 error generated.

We need to continue supporting the DylibMono backend for integration
purposes (dotnet/android#3504) *while also* allowing for the
*removal* of DylibMono (dotnet/android#3223).

Attempt to support these divergent needs by replacing this:

	#if defined (ANDROID) || defined (XAMARIN_ANDROID_DYLIB_MONO)

with this:

	#if defined (XAMARIN_ANDROID_DYLIB_MONO)

removing the check for the `ANDROID` define.

This will allow dotnet/android#3223 to *remove* the
`XAMARIN_ANDROID_DYLIB_MONO` definition in order to introduce it's
desired behavior, removing DylibMono use.

This partially reverts commit 285a32b.
jonpryor added a commit to dotnet/java-interop that referenced this pull request Aug 16, 2019
Context: dotnet/android#3504
Context: dotnet/android#3223

When bumping xamarin-android/master to 2abfc1e, the build broke
because of commit 285a32b:

	  In file included from /Users/vsts/agent/2.155.1/work/1/s/external/Java.Interop/src/java-interop/java-interop-mono.cc:2:
	  ../../../../../external/Java.Interop/src/java-interop/java-interop-mono.h:10:11: fatal error: 'mono/metadata/assembly.h' file not found
	          #include <mono/metadata/assembly.h>
	                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
	  1 error generated.

We need to continue supporting the DylibMono backend for integration
purposes (dotnet/android#3504) *while also* allowing for the
*removal* of DylibMono (dotnet/android#3223).

Attempt to support these divergent needs by replacing this:

	#if defined (ANDROID) || defined (XAMARIN_ANDROID_DYLIB_MONO)

with this:

	#if defined (XAMARIN_ANDROID_DYLIB_MONO)

removing the check for the `ANDROID` define.

This will allow dotnet/android#3223 to *remove* the
`XAMARIN_ANDROID_DYLIB_MONO` definition in order to introduce it's
desired behavior, removing DylibMono use.

This partially reverts commit 285a32b.
@jonpryor jonpryor force-pushed the jonp-bump-ji-2abfc1e0 branch from 856e6d3 to 915064e Compare August 16, 2019 16:12
@jonpryor
Copy link
Contributor Author

The DylibMono build failure should be fixed by: dotnet/java-interop@5fe28cd

jonpryor added a commit to jonpryor/java.interop that referenced this pull request Aug 16, 2019
Context: dotnet/android#3504
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2950467&view=results

Commit 5fe28cd didn't go far enough.  While the xamarin-android build
is no longer trying to include `<mono/metadata/assembly.h>`, we get a
new set of compilation errors:

	/Users/vsts/agent/2.155.1/work/1/s/external/Java.Interop/src/java-interop/java-interop-gc-bridge-mono.cc(34,2): error GF2D19E48: unknown type name 'MonoClass'; did you mean 'xamarin::android::MonoClass'?
	          MonoClass          *klass;
	          ^~~~~~~~~
	          xamarin::android::MonoClass
	  ../../../jni/dylib-mono.h:101:31: note: 'xamarin::android::MonoClass' declared here
	          typedef struct _MonoClass {} MonoClass;
	                                       ^

This is because the `using namespace xamarin::android` on
`java-interop-gc-bridge-mono.cc` line 30 isn't evaluated, as `ANDROID`
isn't defined during *host* builds of xamarin-android/src/monodroid
(which builds e.g. `libmono-android.debug.*` for macOS & Windows).

Add `XAMARIN_ANDROID_DYLIB_MONO` to the `#if` list, so that the
`using namespace` statement is used on host builds.
jonpryor added a commit to dotnet/java-interop that referenced this pull request Aug 16, 2019
Context: dotnet/android#3504
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2950467&view=results

Commit 5fe28cd didn't go far enough.  While the xamarin-android build
is no longer trying to include `<mono/metadata/assembly.h>`, we get a
new set of compilation errors:

	/Users/vsts/agent/2.155.1/work/1/s/external/Java.Interop/src/java-interop/java-interop-gc-bridge-mono.cc(34,2): error GF2D19E48: unknown type name 'MonoClass'; did you mean 'xamarin::android::MonoClass'?
	          MonoClass          *klass;
	          ^~~~~~~~~
	          xamarin::android::MonoClass
	  ../../../jni/dylib-mono.h:101:31: note: 'xamarin::android::MonoClass' declared here
	          typedef struct _MonoClass {} MonoClass;
	                                       ^

This is because the `using namespace xamarin::android` on
`java-interop-gc-bridge-mono.cc` line 30 isn't evaluated, as `ANDROID`
isn't defined during *host* builds of xamarin-android/src/monodroid
(which builds e.g. `libmono-android.debug.*` for macOS & Windows).

Add `XAMARIN_ANDROID_DYLIB_MONO` to the `#if` list, so that the
`using namespace` statement is used on host builds.
@jonpryor jonpryor force-pushed the jonp-bump-ji-2abfc1e0 branch from 915064e to 8f3c43b Compare August 16, 2019 20:05
jonpryor added a commit to jonpryor/java.interop that referenced this pull request Aug 17, 2019
Context: dotnet/android#3504
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2951424&view=ms.vss-test-web.build-test-results-tab&runId=7990780&resultId=100107&paneView=attachments

The attempt to bump the Java.Interop submodule within xamarin-android
hit a snag, as unit tests failed:

	The "ClassParse" task failed unexpectedly.
	System.NullReferenceException: Object reference not set to an instance of an object
	  at Xamarin.Android.Tools.Bytecode.ClassFile.TryGetEnclosingMethodInfo (System.String& declaringClass, System.String& declaringMethod, System.String& declaringDescriptor)
	  at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.GetEnclosingMethod ()
	  at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.ToXElement ()
	  at Xamarin.Android.Tools.Bytecode.ClassPath+<>c.<ToXElement>b__36_3 (Xamarin.Android.Tools.Bytecode.ClassFile c)
	  at System.Linq.Enumerable+SelectIPartitionIterator`2[TSource,TResult].MoveNext ()
	  at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content)
	  at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content)

The cause?  The [`material-menu`][0] library has `.class` files which
have an `EnclosingMethod` attribute blob, but doesn't mention method
name information, only an enclosing type:

	$ mono class-parse.exe com/balysv/material/drawable/menu/MaterialMenuDrawable\$5.class --dump
	...
	    1: EnclosingMethod(Class(nameIndex=58 Name="com/balysv/material/drawable/menu/MaterialMenuDrawable"), )
	# Behold! No method information!

Support generating an XML description of this type by adding
appropriate `null` checks around `EnclosingMethodAttribute`.

[0]: https://repo.jfrog.org/artifactory/libs-release-bintray/com/balysv/material-menu/1.1.0/material-menu-1.1.0.aar
jonpryor added a commit to dotnet/java-interop that referenced this pull request Aug 18, 2019
Context: dotnet/android#3504
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2951424&view=ms.vss-test-web.build-test-results-tab&runId=7990780&resultId=100107&paneView=attachments

The attempt to bump the Java.Interop submodule within xamarin-android
hit a snag, as unit tests failed:

	The "ClassParse" task failed unexpectedly.
	System.NullReferenceException: Object reference not set to an instance of an object
	  at Xamarin.Android.Tools.Bytecode.ClassFile.TryGetEnclosingMethodInfo (System.String& declaringClass, System.String& declaringMethod, System.String& declaringDescriptor)
	  at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.GetEnclosingMethod ()
	  at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.ToXElement ()
	  at Xamarin.Android.Tools.Bytecode.ClassPath+<>c.<ToXElement>b__36_3 (Xamarin.Android.Tools.Bytecode.ClassFile c)
	  at System.Linq.Enumerable+SelectIPartitionIterator`2[TSource,TResult].MoveNext ()
	  at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content)
	  at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content)

The cause?  The [`material-menu`][0] library has `.class` files which
have an `EnclosingMethod` attribute blob, but doesn't mention method
name information, only an enclosing type:

	$ mono class-parse.exe com/balysv/material/drawable/menu/MaterialMenuDrawable\$5.class --dump
	...
	    1: EnclosingMethod(Class(nameIndex=58 Name="com/balysv/material/drawable/menu/MaterialMenuDrawable"), )
	# Behold! No method information!

Support generating an XML description of this type by adding
appropriate `null` checks around `EnclosingMethodAttribute`.

[0]: https://repo.jfrog.org/artifactory/libs-release-bintray/com/balysv/material-menu/1.1.0/material-menu-1.1.0.aar
@jonpryor jonpryor force-pushed the jonp-bump-ji-2abfc1e0 branch from 8f3c43b to 8c05e81 Compare August 18, 2019 01:39
Changes: dotnet/java-interop@be58159...f7d97c2

Context: dotnet/java-interop#459

Updates `generator` so that all bound Java interfaces also implement
`IJavaPeerable` in addition to `IJavaObject`, for eventual future
C#8 Default Interface Member support.

[generator] Remove extraneous slash when creating .projitems.

[generator] Always use XAPeerMembers for XAJavaInterop1

Drop dependency on DylibMono when building for Xamarin.Android

[jnienv-gen] fix p/invoke usage for .NET framework

Add `jnimarshalmethod-gen.exe -r ASSEMBLY` option.

Improve support for binding package-private interfaces.

Parse EnclosingMethod, SourceFile annotation blobs.

Emit events for addListener(Listener,Handler) pattern

Fix `jnimarshalmethod-gen.exe`-related build error:

	Instance property 'PeerReference' is not defined for type 'Android.Widget.IListAdapter'
	Parameter name: propertyName
	System.ArgumentException: Instance property 'PeerReference' is not defined for type 'Android.Widget.IListAdapter'
	Parameter name: propertyName
	    at System.Linq.Expressions.Expression.Property (System.Linq.Expressions.Expression expression, System.String propertyName)
	    at Java.Interop.JavaPeerableValueMarshaler.CreateIntermediaryExpressionFromManagedExpression (Java.Interop.Expressions.JniValueMarshalerContext context, System.Linq.Expressions.ParameterExpression sourceValue)
	    at Java.Interop.JavaPeerableValueMarshaler.CreateReturnValueFromManagedExpression (Java.Interop.Expressions.JniValueMarshalerContext context, System.Linq.Expressions.ParameterExpression sourceValue)

Fix DylibMono build issues which prevented `src/monodroid` from
building.
@jonpryor jonpryor force-pushed the jonp-bump-ji-2abfc1e0 branch from 8c05e81 to 8e92871 Compare August 18, 2019 22:37
I added `external/Java.Interop/build-tools/jnienv-gen.csproj` to the solution using VS 2019.

It also "fixed" a few things.
This change causes build failures, it should not be needed:

    "src\Mono.Android\Mono.Android.csproj" (default target) (24:2) ->
    (CoreCompile target) ->
        Android.Runtime\JNIEnv.g.cs(120,141): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(138,138): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(156,138): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(174,139): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(192,137): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(210,138): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(246,140): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(264,131): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(282,183): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(300,184): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(318,181): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(336,181): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(354,182): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(372,180): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(390,181): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(408,182): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(426,183): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(444,174): error CS1503: Argument 4: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(580,143): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(616,140): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(634,141): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(652,139): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(670,140): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(688,141): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(706,142): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
        Android.Runtime\JNIEnv.g.cs(724,133): error CS1503: Argument 3: cannot convert from 'System.IntPtr' to 'Java.Interop.JniArgumentValue*'
@jonpryor jonpryor merged commit bfaedff into dotnet:master Aug 19, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants