Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] Extend the Aot Task to allow the passing of additional arguments #185

Merged
merged 1 commit into from
Aug 23, 2016

Conversation

dellis1972
Copy link
Contributor

Context https://bugzilla.xamarin.com/show_bug.cgi?id=43500

We need a way to pass additional arguments to the aot system.
This is so users can add additional parameters to tweak the
output. In the case of Bug 43500 we needed to be able to pass

'no-write-symbols' or 'no-debug'

Rather than just hardcoding those values we now provide a

$(AndroidAotAdditionalArguments)

msbuild property which defaults to empty but users can override
to pass any additional parameters that they need.

…g of additional arguments

Context https://bugzilla.xamarin.com/show_bug.cgi?id=43500

We need a way to pass additional arguments to the aot system.
This is so users can add additional parameters to tweak the
output. In the case of Bug 43500 we needed to be able to pass

	'no-write-symbols' or 'no-debug'

Rather than just hardcoding those values we now provide a

	$(AndroidAotAdditionalArguments)

msbuild property which defaults to empty but users can override
to pass any additional parameters that they need.
@atsushieno atsushieno merged commit da07038 into dotnet:master Aug 23, 2016
radical pushed a commit that referenced this pull request May 8, 2018
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=59472

Assume you have the following Java method:

```java
	class Example {
		public static CharSequence identity(CharSequence value) {
			return value;
		}
	}
```

When binding `Example.identity()`, we will *rename* it to have a
`Formatted` suffix, and "overload" it with a `string` overload:

```csharp
	partial class Example {
		public static ICharSequence IdentityFormatted (ICharSequence value)
		{
			// ...
		}

		public static string Identity (string value)
		{
			// ...
		}
	}
```

The purpose of this overloading is to make it easier to call the
method from C# code. It's not currently possible for interfaces to
contain static methods, which in turn means it's not possible for
interfaces to contain conversion operators. Thus, if a C# developer
wants to do:

	Example.Identity ("value");

there would be no way to have this Just Work™ while having only
`ICharSequence` running around.

(Additionally, we rename the method so that we don't need to worry
about return types. In the above example, the return type is
converted, so if we didn't rename to `IdentityFormatted()`, we
couldn't overload for many interesting use cases.)

This feature has existed for quite some time, but there's a bug:
`Example.Identity()` would do:

```csharp
	partial class Example {
		public static string Identity (string value)
		{
			var jls_value = value == null ? null : new Java.Lang.String (value)
			var __result  = IdentityFormatted (jls_value);
			jls_value?.Dispose ();
			return __result?.ToString ();
		}
	}
```

This seems acceptable, but this will break when
`Example.IdentityFormatted()` -- `Example.identity()` -- returns the
parameter. When that happens, `jls_value` and `__result` are
*the same instance*, and thus the `jls_value?.Dispose()` *also*
disposes of `__result`. In this case, `__result.ToString()` will be
`null`, which is *not* what is desired.

The fix is to grab `__result.ToString()` *before* disposing of the
temporary parameters:

```csharp
	partial class Example {
		public static string Identity (string value)
		{
			var jls_value = value == null ? null : new Java.Lang.String (value)
			var __result  = IdentityFormatted (jls_value);
			var __rsval   = __result?.ToString ();
			jls_value?.Dispose ();
			return __rsval;
		}
	}
```

This way we ensure that we get a copy before the source is disposed.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Aug 24, 2022
Changes: TODO Java.Interop

Changes: dotnet/android-tools@9c641b3...7cfe683

  * dotnet/android-tools@7cfe683: [ci] Use Microsoft.SourceLink.GitHub (dotnet#192)
  * dotnet/android-tools@01a0dde: [Localization] Import translated resx files (dotnet#189)
  * dotnet/android-tools@cc715d9: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (dotnet#190)
  * dotnet/android-tools@3c55e9a: Avoid `Environment.SpecialFolder.ApplicationData` (dotnet#188)
  * dotnet/android-tools@0d55472: LEGO: Merge pull request 187
  * dotnet/android-tools@6946512: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (dotnet#186)
  * dotnet/android-tools@6e3433a: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (dotnet#185)
  * dotnet/android-tools@73c4388: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (dotnet#184)
  * dotnet/android-tools@da3653e: [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433: [ci] Run OneLocBuild on a schedule (dotnet#180)
  * dotnet/android-tools@8ab60e4: [ci] Use latest macOS and Windows images (dotnet#181)
  * dotnet/android-tools@4dd3292: LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1: [Localization] Add OneLocBuild job (dotnet#175)
  * dotnet/android-tools@14076a6: [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
jonpryor pushed a commit that referenced this pull request Aug 26, 2022
…7309)

Changes: mono/mono.posix@e1269a5...d8994ca

  * mono/mono.posix@d8994ca: Remove Windows support completely for now

    Fixes an issue in which Mono.Unix would try to resolve `libc`
    P/Invokes by looking for the `msvcrt` library on Unix machines.

  * mono/mono.posix@74d504f: Fix yaml template path
  * mono/mono.posix@127cf9e: [build] Don't rebuild managed code on packaging time on Windows

Changes: dotnet/android-libzipsharp@2.0.4...2.0.7

  * dotnet/android-libzipsharp@98e9173: Bump version to 2.0.7
  * dotnet/android-libzipsharp@6e1e1b3: Localized file check-in by OneLocBuild Task: Build definition ID 11678: Build ID 6581869 (#119)
  * dotnet/android-libzipsharp@1c05430: LEGO: Merge pull request 118
  * dotnet/android-libzipsharp@06d44d8: Localized file check-in by OneLocBuild Task: Build definition ID 11678: Build ID 6570668 (#117)
  * dotnet/android-libzipsharp@37f3894: LEGO: Merge pull request 116
  * dotnet/android-libzipsharp@6c0edc5: Update libzip and zlib submodules (#115)
  * dotnet/android-libzipsharp@acd9a54: [Localization] Switch from xlf to resx files  (#112)
  * dotnet/android-libzipsharp@3cece80: LEGO: Merge pull request 114
  * dotnet/android-libzipsharp@fe336b4: LEGO: Merge pull request 113
  * dotnet/android-libzipsharp@9aee99a: [Localization] Add OneLocBuild job (#111)
  * dotnet/android-libzipsharp@bdfa9f8: Bump Mono.Unix to 7.1.0-final.1.21458.1 (#110)

Changes: xamarin/monodroid@210073e...100ccf9

  * xamarin/monodroid@100ccf969: Bump to xamarin/androidtools@81486ab, xamarin/android-sdk-installer@8cac7ea (#1264)

Changes: dotnet/android-tools@9c641b3...29f11f2

  * dotnet/android-tools@29f11f2 Bump to mono/mono.posix@d8994ca, dotnet/android-libzipsharp@98e9173 (#193)
  * dotnet/android-tools@7cfe683 [ci] Use Microsoft.SourceLink.GitHub (#192)
  * dotnet/android-tools@01a0dde [Localization] Import translated resx files (#189)
  * dotnet/android-tools@cc715d9 [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (#190)
  * dotnet/android-tools@3c55e9a Avoid `Environment.SpecialFolder.ApplicationData` (#188)
  * dotnet/android-tools@0d55472 LEGO: Merge pull request 187
  * dotnet/android-tools@6946512 Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (#186)
  * dotnet/android-tools@6e3433a Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (#185)
  * dotnet/android-tools@73c4388 [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (#184)
  * dotnet/android-tools@da3653e [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433 [ci] Run OneLocBuild on a schedule (#180)
  * dotnet/android-tools@8ab60e4 [ci] Use latest macOS and Windows images (#181)
  * dotnet/android-tools@4dd3292 LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1 [Localization] Add OneLocBuild job (#175)
  * dotnet/android-tools@14076a6 [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants