Skip to content

Commit 2a67bee

Browse files
committed
Merge branch 'main' into dev/grendel/blobs-in-lib
* main: [monodroid] typemaps may need to load assemblies (#8625) Bump $(AndroidNetPreviousVersion) to 34.0.79 (#8693) Bump to xamarin/java.interop/main@07c73009 (#8681) Bump to dotnet/installer@1c496970b7 9.0.100-preview.2.24078.1 (#8685)
2 parents d706ffe + 06b1d7f commit 2a67bee

21 files changed

+130
-63
lines changed

Configuration.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<DebugType Condition=" '$(DebugType)' == '' ">portable</DebugType>
4444
<Deterministic Condition=" '$(Deterministic)' == '' ">True</Deterministic>
4545
<LangVersion Condition=" '$(LangVersion)' == '' ">latest</LangVersion>
46-
<AndroidNetPreviousVersion Condition=" '$(AndroidNetPreviousVersion)' == '' ">34.0.56</AndroidNetPreviousVersion>
46+
<AndroidNetPreviousVersion Condition=" '$(AndroidNetPreviousVersion)' == '' ">34.0.79</AndroidNetPreviousVersion>
4747
</PropertyGroup>
4848
<PropertyGroup Condition=" '$(HostOS)' == '' ">
4949
<HostOS Condition="$([MSBuild]::IsOSPlatform('windows'))">Windows</HostOS>

eng/Version.Details.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<Dependencies>
22
<ProductDependencies>
3-
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="9.0.100-preview.2.24073.12">
3+
<Dependency Name="Microsoft.Dotnet.Sdk.Internal" Version="9.0.100-preview.2.24078.1">
44
<Uri>https://github.com/dotnet/installer</Uri>
5-
<Sha>5680e93cb251d7741e19f2d759f04141e9d95a93</Sha>
5+
<Sha>1c496970b7479284364bc7eaf5c30e59f1cdb2ec</Sha>
66
</Dependency>
7-
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-preview.2.24072.10" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
7+
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-preview.2.24076.4" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
88
<Uri>https://github.com/dotnet/runtime</Uri>
9-
<Sha>e3547f1d3ac768a14a0598abf7868641ecf0c9d7</Sha>
9+
<Sha>bcc1d3d6f00fbcea3f454b2e35bceeaa51e604b1</Sha>
1010
</Dependency>
11-
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.0-preview.2.24072.10" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
11+
<Dependency Name="Microsoft.NETCore.App.Ref" Version="9.0.0-preview.2.24076.4" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
1212
<Uri>https://github.com/dotnet/runtime</Uri>
13-
<Sha>e3547f1d3ac768a14a0598abf7868641ecf0c9d7</Sha>
13+
<Sha>bcc1d3d6f00fbcea3f454b2e35bceeaa51e604b1</Sha>
1414
</Dependency>
15-
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-alpha.1.24068.1" CoherentParentDependency="Microsoft.NETCore.App.Ref">
15+
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport" Version="9.0.0-alpha.1.24072.1" CoherentParentDependency="Microsoft.NETCore.App.Ref">
1616
<Uri>https://github.com/dotnet/emsdk</Uri>
17-
<Sha>fd99e59a43cfd6fe323c98ff267b620a67e71e67</Sha>
17+
<Sha>ae7c93e25ae596594b3b22d64115f374a3595912</Sha>
1818
</Dependency>
1919
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.4-alpha.24065.1" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
2020
<Uri>https://github.com/dotnet/cecil</Uri>

eng/Versions.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project>
22
<!--Package versions-->
33
<PropertyGroup>
4-
<MicrosoftDotnetSdkInternalPackageVersion>9.0.100-preview.2.24073.12</MicrosoftDotnetSdkInternalPackageVersion>
5-
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-preview.2.24072.10</MicrosoftNETILLinkTasksPackageVersion>
6-
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-preview.2.24072.10</MicrosoftNETCoreAppRefPackageVersion>
4+
<MicrosoftDotnetSdkInternalPackageVersion>9.0.100-preview.2.24078.1</MicrosoftDotnetSdkInternalPackageVersion>
5+
<MicrosoftNETILLinkTasksPackageVersion>9.0.0-preview.2.24076.4</MicrosoftNETILLinkTasksPackageVersion>
6+
<MicrosoftNETCoreAppRefPackageVersion>9.0.0-preview.2.24076.4</MicrosoftNETCoreAppRefPackageVersion>
77
<MicrosoftDotNetApiCompatPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetApiCompatPackageVersion>
88
<MicrosoftDotNetBuildTasksFeedPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetBuildTasksFeedPackageVersion>
9-
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-alpha.1.24068.1</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
9+
<MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>9.0.0-alpha.1.24072.1</MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion>
1010
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest90100TransportVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
1111
<MicrosoftTemplateEngineTasksPackageVersion>7.0.100-rc.1.22410.7</MicrosoftTemplateEngineTasksPackageVersion>
1212
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.24065.1</MicrosoftDotNetCecilPackageVersion>

external/Java.Interop

src/Mono.Android/Java.Interop/TypeManager.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ internal static IJavaPeerable CreateInstance (IntPtr handle, JniHandleOwnership
267267
{
268268
Type? type = null;
269269
IntPtr class_ptr = JNIEnv.GetObjectClass (handle);
270-
string class_name = GetClassName (class_ptr);
270+
string? class_name = GetClassName (class_ptr);
271271
lock (TypeManagerMapDictionaries.AccessLock) {
272272
while (class_ptr != IntPtr.Zero && !TypeManagerMapDictionaries.JniToManaged.TryGetValue (class_name, out type)) {
273273

@@ -279,23 +279,33 @@ internal static IJavaPeerable CreateInstance (IntPtr handle, JniHandleOwnership
279279

280280
IntPtr super_class_ptr = JNIEnv.GetSuperclass (class_ptr);
281281
JNIEnv.DeleteLocalRef (class_ptr);
282+
class_name = null;
282283
class_ptr = super_class_ptr;
283-
class_name = GetClassName (class_ptr);
284+
if (class_ptr != IntPtr.Zero) {
285+
class_name = GetClassName (class_ptr);
286+
}
284287
}
285288
}
286289

287-
JNIEnv.DeleteLocalRef (class_ptr);
290+
if (class_ptr != IntPtr.Zero) {
291+
JNIEnv.DeleteLocalRef (class_ptr);
292+
class_ptr = IntPtr.Zero;
293+
}
294+
295+
if (targetType != null &&
296+
(type == null ||
297+
!targetType.IsAssignableFrom (type))) {
298+
type = targetType;
299+
}
288300

289301
if (type == null) {
302+
class_name = JNIEnv.GetClassNameFromInstance (handle);
290303
JNIEnv.DeleteRef (handle, transfer);
291304
throw new NotSupportedException (
292-
FormattableString.Invariant ($"Internal error finding wrapper class for '{JNIEnv.GetClassNameFromInstance (handle)}'. (Where is the Java.Lang.Object wrapper?!)"),
305+
FormattableString.Invariant ($"Internal error finding wrapper class for '{class_name}'. (Where is the Java.Lang.Object wrapper?!)"),
293306
CreateJavaLocationException ());
294307
}
295308

296-
if (targetType != null && !targetType.IsAssignableFrom (type))
297-
type = targetType;
298-
299309
if (type.IsInterface || type.IsAbstract) {
300310
var invokerType = JavaObjectExtensions.GetInvokerType (type);
301311
if (invokerType == null)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void GenerateCompressedAssemblySources ()
9292

9393
void Generate (Dictionary<AndroidTargetArch, Dictionary<string, CompressedAssemblyInfo>> dict)
9494
{
95-
var composer = new CompressedAssembliesNativeAssemblyGenerator (dict);
95+
var composer = new CompressedAssembliesNativeAssemblyGenerator (Log, dict);
9696
LLVMIR.LlvmIrModule compressedAssemblies = composer.Construct ();
9797

9898
foreach (string abi in SupportedAbis) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override bool RunTask ()
5454

5555
void GenerateEmpty ()
5656
{
57-
Generate (new JniRemappingAssemblyGenerator (), typeReplacementsCount: 0);
57+
Generate (new JniRemappingAssemblyGenerator (Log), typeReplacementsCount: 0);
5858
}
5959

6060
void Generate ()
@@ -74,7 +74,7 @@ void Generate ()
7474
}
7575
}
7676

77-
Generate (new JniRemappingAssemblyGenerator (typeReplacements, methodReplacements), typeReplacements.Count);
77+
Generate (new JniRemappingAssemblyGenerator (Log, typeReplacements, methodReplacements), typeReplacements.Count);
7878
}
7979

8080
void Generate (JniRemappingAssemblyGenerator jniRemappingComposer, int typeReplacementsCount)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ private void GenerateResponseFile ()
9090
file.Replace (@"\", @"\\").Normalize (NormalizationForm.FormC)));
9191
}
9292
}
93+
Log.LogDebugMessage ($"javac response file contents: {TemporarySourceListFile}");
94+
foreach (var line in File.ReadLines (TemporarySourceListFile)) {
95+
Log.LogDebugMessage ($" {line}");
96+
}
9397
}
9498
}
9599
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using Microsoft.Build.Framework;
23
using Microsoft.Build.Utilities;
34
using System.Collections.Generic;
@@ -82,16 +83,15 @@ protected override CommandLineBuilder GetCommandLineBuilder ()
8283

8384
if (EnableShrinking) {
8485
if (!string.IsNullOrEmpty (AcwMapFile)) {
85-
var acwLines = File.ReadAllLines (AcwMapFile);
86+
var acwMap = MonoAndroidHelper.LoadMapFile (BuildEngine4, Path.GetFullPath (AcwMapFile), StringComparer.OrdinalIgnoreCase);
87+
var javaTypes = new List<string> (acwMap.Values.Count);
88+
foreach (var v in acwMap.Values) {
89+
javaTypes.Add (v);
90+
}
91+
javaTypes.Sort (StringComparer.Ordinal);
8692
using (var appcfg = File.CreateText (ProguardGeneratedApplicationConfiguration)) {
87-
for (int i = 0; i + 2 < acwLines.Length; i += 3) {
88-
try {
89-
var line = acwLines [i + 2];
90-
var java = line.Substring (line.IndexOf (';') + 1);
91-
appcfg.WriteLine ("-keep class " + java + " { *; }");
92-
} catch {
93-
// skip invalid lines
94-
}
93+
foreach (var java in javaTypes) {
94+
appcfg.WriteLine ($"-keep class {java} {{ *; }}");
9595
}
9696
}
9797
}

src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfigNativeAssemblyGenerator.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Java.Interop.Tools.TypeNameMappings;
77
using Microsoft.Build.Framework;
88
using Microsoft.Build.Utilities;
9+
using Microsoft.Android.Build.Tasks;
910
using Xamarin.Android.Tasks.LLVMIR;
1011

1112
namespace Xamarin.Android.Tasks
@@ -153,7 +154,6 @@ sealed class XamarinAndroidBundledAssembly
153154

154155
SortedDictionary <string, string>? environmentVariables;
155156
SortedDictionary <string, string>? systemProperties;
156-
TaskLoggingHelper log;
157157
StructureInstance? application_config;
158158
List<StructureInstance<DSOCacheEntry>>? dsoCache;
159159
List<StructureInstance<XamarinAndroidBundledAssembly>>? xamarinAndroidBundledAssemblies;
@@ -190,6 +190,7 @@ sealed class XamarinAndroidBundledAssembly
190190
public bool MarshalMethodsEnabled { get; set; }
191191

192192
public ApplicationConfigNativeAssemblyGenerator (IDictionary<string, string> environmentVariables, IDictionary<string, string> systemProperties, TaskLoggingHelper log)
193+
: base (log)
193194
{
194195
if (environmentVariables != null) {
195196
this.environmentVariables = new SortedDictionary<string, string> (environmentVariables, StringComparer.Ordinal);
@@ -198,8 +199,6 @@ public ApplicationConfigNativeAssemblyGenerator (IDictionary<string, string> env
198199
if (systemProperties != null) {
199200
this.systemProperties = new SortedDictionary<string, string> (systemProperties, StringComparer.Ordinal);
200201
}
201-
202-
this.log = log;
203202
}
204203

205204
protected override void Construct (LlvmIrModule module)
@@ -353,7 +352,7 @@ List<StructureInstance<DSOCacheEntry>> InitDSOCache ()
353352
continue;
354353
}
355354

356-
dsos.Add ((name, $"dsoName{dsos.Count.ToString (CultureInfo.InvariantCulture)}", ELFHelper.IsEmptyAOTLibrary (log, item.ItemSpec)));
355+
dsos.Add ((name, $"dsoName{dsos.Count.ToString (CultureInfo.InvariantCulture)}", ELFHelper.IsEmptyAOTLibrary (Log, item.ItemSpec)));
357356
}
358357

359358
var dsoCache = new List<StructureInstance<DSOCacheEntry>> ();

0 commit comments

Comments
 (0)