Skip to content

Commit

Permalink
Merge branch 'main' into dev/grendel/perfetto-integration
Browse files Browse the repository at this point in the history
* main:
  [Xamarin.Android.Build.Tasks] Fix `LogCodedWarning` usage (#9148)
  [xaprepare] Remove Mono as required component (#9144)
  $(AndroidPackVersionSuffix)=rc.1; net9 is 35.0.0-rc.1 (#9143)
  [monodroid] treat `LocalRefsAreIndirect` as always true (#9138)
  [Mono.Android] fix leaking lrefs in `TypeManager` (#9136)
  [ci] Ignore unsigned bundletool.jar content (#9139)
  Localized file check-in by OneLocBuild Task (#9140)
  [tests] fix 1,170 build warnings (#9137)
  LEGO: Merge pull request 9141
  Bump to xamarin/monodroid@d1d43ab161 (#9130)
  • Loading branch information
grendello committed Jul 26, 2024
2 parents b3d9bad + ba750a3 commit d42ce6b
Show file tree
Hide file tree
Showing 39 changed files with 266 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .external
Original file line number Diff line number Diff line change
@@ -1 +1 @@
xamarin/monodroid:main@038240c52a7dc2e66b9ad2ddb20b9886836eaec9
xamarin/monodroid:main@d1d43ab161bfd493d982f40fd3e49ebfb274a110
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* Bump first digit of the patch version for feature releases (and reset the first two digits to 0)
-->
<AndroidPackVersion>35.0.0</AndroidPackVersion>
<AndroidPackVersionSuffix>preview.7</AndroidPackVersionSuffix>
<AndroidPackVersionSuffix>rc.1</AndroidPackVersionSuffix>
<IsStableBuild>false</IsStableBuild>
<IsStableBuild Condition=" '$(AndroidPackVersionSuffix)' == 'rtm' ">true</IsStableBuild>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@
<Str Cat="Text">
<Val><![CDATA[NuGet package '{0}' version '{1}' contains a shared library '{2}' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Pakiet NuGet „{0}” w wersji „{1}” zawiera bibliotekę udostępnioną „{2}”, która nie jest poprawnie wyrównana. Zobacz https://developer.android.com/guide/practices/page-sizes for more details]]></Val>
<Val><![CDATA[Pakiet NuGet „{0}” w wersji „{1}” zawiera bibliotekę udostępnioną „{2}”, która nie jest poprawnie wyrównana. Zobacz https://developer.android.com/guide/practices/page-sizes, aby uzyskać więcej szczegółów]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
Expand Down
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ PREPARE_SCENARIO =
PREPARE_CI_PR ?= 0
PREPARE_CI ?= 0
PREPARE_AUTOPROVISION ?= 0
PREPARE_AUTOPROVISION_SKIP_MONO ?= 0

_PREPARE_CI_MODE_PR_ARGS = --no-emoji --run-mode=CI
_PREPARE_CI_MODE_ARGS = $(_PREPARE_CI_MODE_PR_ARGS) -a
Expand Down Expand Up @@ -59,10 +58,6 @@ ifneq ($(PREPARE_AUTOPROVISION),0)
_PREPARE_ARGS += --auto-provision=yes --auto-provision-uses-sudo=yes
endif

ifneq ($(PREPARE_AUTOPROVISION_SKIP_MONO),0)
_PREPARE_ARGS += --auto-provision-skip-mono=yes
endif

ifneq ($(PREPARE_SCENARIO),)
_PREPARE_ARGS += -s:"$(PREPARE_SCENARIO)"
endif
Expand Down
4 changes: 0 additions & 4 deletions build-tools/automation/yaml-templates/commercial-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ steps:
inputs:
forceReinstallCredentialProvider: true

- script: make prepare-update-mono CONFIGURATION=$(XA.Build.Configuration) PREPARE_CI=1 PREPARE_AUTOPROVISION=1
workingDirectory: ${{ parameters.xaSourcePath }}
displayName: make prepare-update-mono

# Always checkout a second resource to ensure we are using multi-repo checkout behavior
# https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops#checkout-path
- checkout: maui
Expand Down
1 change: 1 addition & 0 deletions build-tools/create-packs/SignVerifyIgnore.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**\*.xml,ignore unsigned xml
**\cab*.cab.cab,ignore unsigned .cab
**\com\sun\jna\win32-*\jnidispatch.dll, ignore external bundletool.jar content
3 changes: 0 additions & 3 deletions build-tools/xaprepare/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ You can append the following parameters to the command line:
If set to `0` (the default), the utility will take notice of missing/outdated software the build depends on and exit with an error
should any such condition is detected. Setting the property to `1` will let the utility install the software (installation **may**
use `sudo` on Unix so you will need administrator/root credentials for it to work)
- `PREPARE_AUTOPROVISION_SKIP_MONO=0|1`
If set to `0` (the default), the utility will ensure the Mono MDK is installed.
Setting the property to `1` will allow you to skip Mono MDK installation.
- `V=1`
Causes the run to output much more information (making output much more messy in the process) to the console. Normally this additional
information is placed only in the log files generated by the utility.
Expand Down
5 changes: 0 additions & 5 deletions build-tools/xaprepare/xaprepare/Application/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ partial class Context : AppObject
/// </summary>
public bool AutoProvisionUsesSudo { get; set; }

/// <summary>
/// Skip automatic provision of the Mono MDK if missing
/// </summary>
public bool AutoProvisionSkipMono { get; set; } = false;

/// <summary>
/// Current session execution mode. See <see cref="t:ExecutionMode" />
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected override void InitializeDependencies ()
{
Dependencies.AddRange (programs);

if (!Context.Instance.AutoProvisionSkipMono) {
if (Context.Instance.CheckCondition (KnownConditions.AllowMonoUpdate)) {
Dependencies.Add (
new MonoPkgProgram ("Mono", "com.xamarin.mono-MDK.pkg", new Uri (Context.Instance.Properties.GetRequiredValue (KnownProperties.MonoDarwinPackageUrl))) {
MinimumVersion = Context.Instance.Properties.GetRequiredValue (KnownProperties.MonoRequiredMinimumVersion),
Expand Down
3 changes: 0 additions & 3 deletions build-tools/xaprepare/xaprepare/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ sealed class ParsedOptions
public string? Configuration { get; set; }
public bool AutoProvision { get; set; }
public bool AutoProvisionUsesSudo { get; set; }
public bool AutoProvisionSkipMono { get; set; }
public RefreshableComponent RefreshList { get; set; }
public IEnumerable<string> AndroidSdkPlatforms { get; set; } = new [] { "latest" };
}
Expand Down Expand Up @@ -101,7 +100,6 @@ static async Task<int> Run (string[] args)
"",
{"auto-provision=", $"Automatically install software required by .NET for Android", v => parsedOptions.AutoProvision = ParseBoolean (v)},
{"auto-provision-uses-sudo=", $"Allow use of sudo(1) when provisioning", v => parsedOptions.AutoProvisionUsesSudo = ParseBoolean (v)},
{"auto-provision-skip-mono=", $"Do not automatically install the Mono MDK", v => parsedOptions.AutoProvisionSkipMono = ParseBoolean (v)},
{"android-sdk-platforms=", "Comma separated list of Android SDK platform levels to be installed or 'latest' or 'all'. Defaults to 'latest' if no value is provided.", v => parsedOptions.AndroidSdkPlatforms = ParseAndroidSdkPlatformLevels (v?.Trim () ?? String.Empty) },
"",
{"h|help", "Show this help message", v => parsedOptions.ShowHelp = true },
Expand Down Expand Up @@ -132,7 +130,6 @@ static async Task<int> Run (string[] args)
Context.Instance.DebugFileExtension = parsedOptions.DebugFileExtension;
Context.Instance.AutoProvision = parsedOptions.AutoProvision;
Context.Instance.AutoProvisionUsesSudo = parsedOptions.AutoProvisionUsesSudo;
Context.Instance.AutoProvisionSkipMono = parsedOptions.AutoProvisionSkipMono;
Context.Instance.ComponentsToRefresh = parsedOptions.RefreshList;
Context.Instance.AndroidSdkPlatforms = parsedOptions.AndroidSdkPlatforms;

Expand Down
2 changes: 1 addition & 1 deletion src/Mono.Android/Android.Runtime/JNIEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static Type MakeArrayType (Type type) =>

internal static IntPtr IdentityHash (IntPtr v)
{
return JNIEnvInit.LocalRefsAreIndirect ? RuntimeNativeMethods._monodroid_get_identity_hash_code (Handle, v) : v;
return RuntimeNativeMethods._monodroid_get_identity_hash_code (Handle, v);
}

public static void CheckHandle (IntPtr jnienv)
Expand Down
4 changes: 0 additions & 4 deletions src/Mono.Android/Android.Runtime/JNIEnvInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ internal struct JnienvInitializeArgs {
public uint logCategories;
public int version; // TODO: remove, not needed anymore
public int androidSdkVersion;
public int localRefsAreIndirect;
public int grefGcThreshold;
public IntPtr grefIGCUserPeer;
public int isRunningOnDesktop;
Expand All @@ -40,7 +39,6 @@ internal struct JnienvInitializeArgs {
internal static bool AllocObjectSupported;
internal static bool IsRunningOnDesktop;
internal static bool jniRemappingInUse;
internal static bool LocalRefsAreIndirect;
internal static bool LogAssemblyCategory;
internal static bool MarshalMethodsEnabled;
internal static bool PropagateExceptions;
Expand Down Expand Up @@ -96,8 +94,6 @@ internal static unsafe void Initialize (JnienvInitializeArgs* args)

mid_Class_forName = new JniMethodInfo (args->Class_forName, isStatic: true);

LocalRefsAreIndirect = args->localRefsAreIndirect == 1;

bool androidNewerThan10 = args->androidSdkVersion > 10;
BoundExceptionType = (BoundExceptionType)args->ioExceptionType;
androidRuntime = new AndroidRuntime (args->env, args->javaVm, androidNewerThan10, args->grefLoader, args->Loader_loadClass, args->jniAddNativeMethodRegistrationAttributePresent != 0);
Expand Down
27 changes: 16 additions & 11 deletions src/Mono.Android/Java.Interop/TypeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,21 +322,26 @@ internal static IJavaPeerable CreateInstance (IntPtr handle, JniHandleOwnership
if (!typeSig.IsValid || typeSig.SimpleReference == null) {
throw new ArgumentException ($"Could not determine Java type corresponding to `{type.AssemblyQualifiedName}`.", nameof (targetType));
}
JniObjectReference typeClass;

JniObjectReference typeClass = default;
JniObjectReference handleClass = default;
try {
typeClass = JniEnvironment.Types.FindClass (typeSig.SimpleReference);
} catch (Exception e) {
throw new ArgumentException ($"Could not find Java class `{typeSig.SimpleReference}`.",
nameof (targetType),
e);
}
try {
typeClass = JniEnvironment.Types.FindClass (typeSig.SimpleReference);
} catch (Exception e) {
throw new ArgumentException ($"Could not find Java class `{typeSig.SimpleReference}`.",
nameof (targetType),
e);
}

var handleClass = JniEnvironment.Types.GetObjectClass (new JniObjectReference (handle));
if (!JniEnvironment.Types.IsAssignableFrom (handleClass, typeClass)) {
Logger.Log (LogLevel.Info, "*jonp*", $"# jonp: can't assign `{GetClassName(handleClass.Handle)}` to `{GetClassName(typeClass.Handle)}`");
handleClass = JniEnvironment.Types.GetObjectClass (new JniObjectReference (handle));
if (!JniEnvironment.Types.IsAssignableFrom (handleClass, typeClass)) {
Logger.Log (LogLevel.Info, "*jonp*", $"# jonp: can't assign `{GetClassName(handleClass.Handle)}` to `{GetClassName(typeClass.Handle)}`");
return null;
}
} finally {
JniObjectReference.Dispose (ref handleClass);
JniObjectReference.Dispose (ref typeClass);
return null;
}

IJavaPeerable? result = null;
Expand Down
Loading

0 comments on commit d42ce6b

Please sign in to comment.