Skip to content

Commit

Permalink
Add suppport for multiple Asset directories
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Jan 17, 2024
1 parent 68a8988 commit 207ed62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
DaemonMaxInstanceCount="$(Aapt2DaemonMaxInstanceCount)"
DaemonKeepInDomain="$(_Aapt2DaemonKeepInDomain)"
OutputArchive="%(_AssetPacks.AssetPackOutput)"
AssetDirectory="$(MonoAndroidAssetPacksDirIntermediate)\%(_AssetPacks.AssetPack)\assets"
AssetDirectories="$(MonoAndroidAssetPacksDirIntermediate)\%(_AssetPacks.AssetPack)\assets"
Manifest="%(_AssetPacks.ManifestFile)"
PackageName="$(_AndroidPackage).%(_AssetPacks.AssetPack)"
ToolPath="$(Aapt2ToolPath)"
Expand Down
12 changes: 7 additions & 5 deletions src/Xamarin.Android.Build.Tasks/Tasks/Aapt2LinkAssetPack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Aapt2LinkAssetPack : Aapt2 {
public ITaskItem Manifest { get; set; }

[Required]
public ITaskItem AssetDirectory { get; set; }
public ITaskItem[] AssetDirectories { get; set; }

[Required]
public string PackageName { get; set; }
Expand All @@ -38,7 +38,7 @@ protected override int GetRequiredDaemonInstances ()

public async override System.Threading.Tasks.Task RunTaskAsync ()
{
RunAapt (GenerateCommandLineCommands (Manifest, AssetDirectory, OutputArchive), OutputArchive.ItemSpec);
RunAapt (GenerateCommandLineCommands (Manifest, OutputArchive), OutputArchive.ItemSpec);
ProcessOutput ();
if (OutputFormat == "proto" && File.Exists (OutputArchive.ItemSpec)) {
// move the manifest to the right place.
Expand All @@ -49,7 +49,7 @@ public async override System.Threading.Tasks.Task RunTaskAsync ()
}
}

protected string[] GenerateCommandLineCommands (ITaskItem manifest, ITaskItem assetDirectory, ITaskItem output)
protected string[] GenerateCommandLineCommands (ITaskItem manifest, ITaskItem output)
{
//link --manifest AndroidManifest.xml --proto-format --custom-package $(Package) -A $(AssetsDirectory) -o $(_TempOutputFile)
List<string> cmd = new List<string> ();
Expand All @@ -63,8 +63,10 @@ protected string[] GenerateCommandLineCommands (ITaskItem manifest, ITaskItem as
}
cmd.Add ("--custom-package");
cmd.Add (PackageName);
cmd.Add ("-A");
cmd.Add (GetFullPath (assetDirectory.ItemSpec));
foreach (var assetDirectory in AssetDirectories) {
cmd.Add ("-A");
cmd.Add (GetFullPath (assetDirectory.ItemSpec));
}
cmd.Add ($"-o");
cmd.Add (GetFullPath (output.ItemSpec));
return cmd.ToArray ();
Expand Down

0 comments on commit 207ed62

Please sign in to comment.