-
Notifications
You must be signed in to change notification settings - Fork 533
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
Rework Design Time Build to use .aar files directly. #9423
base: main
Are you sure you want to change the base?
Changes from all commits
84ca2ad
e957133
49b33b1
3962bbd
284b7d6
770c3e6
4fa59ae
70bc68a
665b7d3
deb85cc
60141c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,7 @@ _ResolveAssemblies MSBuild target. | |
<_AdditionalProperties> | ||
_ComputeFilesToPublishForRuntimeIdentifiers=true | ||
;SelfContained=true | ||
;DesignTimeBuild=$(DesignTimeBuild) | ||
Comment on lines
90
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the inner-build per RID run during a design-time build? Does it even need to? It's doing stuff related to the trimmer & AOT, it seems like should figure out how to skip it? |
||
;AppendRuntimeIdentifierToOutputPath=true | ||
;ResolveAssemblyReferencesFindRelatedSatellites=false | ||
;SkipCompilerExecution=true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
using Microsoft.Android.Build.Tasks; | ||
using Xamarin.Android.Tools; | ||
using Xamarin.Tools.Zip; | ||
|
||
namespace Xamarin.Android.Tasks | ||
{ | ||
|
@@ -22,6 +24,8 @@ public class GenerateResourceCaseMap : AndroidTask | |
|
||
public ITaskItem[] AdditionalResourceDirectories { get; set; } | ||
|
||
public string[] AarLibraries { get; set; } | ||
|
||
[Required] | ||
public ITaskItem OutputFile { get; set; } | ||
|
||
|
@@ -64,6 +68,38 @@ public override bool RunTask () | |
AddRename (tok [1].Replace ('/', Path.DirectorySeparatorChar), tok [0].Replace ('/', Path.DirectorySeparatorChar)); | ||
} | ||
} | ||
var resmap = ".net/__res_name_case_map.txt"; | ||
foreach (var aar in AarLibraries ?? Array.Empty<string>()) { | ||
Log.LogDebugMessage ($"Processing Aar file {aar}"); | ||
if (!File.Exists (aar)) { | ||
Log.LogDebugMessage ($"Skipping non-existent aar: {aar}"); | ||
continue; | ||
} | ||
using (var file = File.OpenRead (aar)) { | ||
using var zip = ZipArchive.Open (file); | ||
foreach (var entry in zip) { | ||
if (entry.IsDirectory) | ||
continue; | ||
if (entry.FullName != resmap) | ||
continue; | ||
Log.LogDebugMessage ($"Found: {entry.FullName}"); | ||
using var ms = new MemoryStream(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thought with |
||
entry.Extract (ms); | ||
ms.Position = 0; | ||
using var reader = new StreamReader (ms); | ||
string line; | ||
// Read each line until the end of the file | ||
while ((line = reader.ReadLine()) != null) { | ||
if (string.IsNullOrEmpty (line)) | ||
continue; | ||
string [] tok = line.Split (';'); | ||
AddRename (tok [1].Replace ('/', Path.DirectorySeparatorChar), tok [0].Replace ('/', Path.DirectorySeparatorChar)); | ||
} | ||
// no need to read the rest of the files we found the one we want | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if (MonoAndroidHelper.SaveMapFile (BuildEngine4, Path.GetFullPath (OutputFile.ItemSpec), resource_fixup)) { | ||
Log.LogDebugMessage ($"Writing to: {OutputFile.ItemSpec}"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions here:
Restore
?@(ProjectReference)
is a plainnet9.0
project or something old likenetstandard2.0
or PCL?