Skip to content

Commit dd49af3

Browse files
dellis1972jonathanpeppers
authored andcommitted
[Xamarin.Android.Build.Tasks] Add Ability to include additional Modules (#3917)
AppBundles can support multiple modules. This PR adds the ability to specify additional modules to the `bundle-tool`. These options might be used in the future to help support Dynamic features. Added a new `@(AndroidAppBundleModules)` item group.
1 parent 853b367 commit dd49af3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System;
66
using System.Collections.Generic;
77
using System.IO;
8+
using System.Linq;
89

910
namespace Xamarin.Android.Tasks
1011
{
@@ -61,6 +62,8 @@ public class BuildAppBundle : BundleTool
6162
public string BaseZip { get; set; }
6263

6364
public string CustomBuildConfigFile { get; set; }
65+
66+
public string [] Modules { get; set; }
6467

6568
[Required]
6669
public string Output { get; set; }
@@ -119,7 +122,11 @@ protected override CommandLineBuilder GetCommandLineBuilder ()
119122
{
120123
var cmd = base.GetCommandLineBuilder ();
121124
cmd.AppendSwitch ("build-bundle");
122-
cmd.AppendSwitchIfNotNull ("--modules ", BaseZip);
125+
var modules = new List<string> ();
126+
modules.Add (BaseZip);
127+
if (Modules != null && Modules.Any ())
128+
modules.AddRange (Modules);
129+
cmd.AppendSwitchIfNotNull ("--modules ", string.Join (",", modules));
123130
cmd.AppendSwitchIfNotNull ("--output ", Output);
124131
cmd.AppendSwitchIfNotNull ("--config ", temp);
125132
return cmd;

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2767,6 +2767,7 @@ because xbuild doesn't support framework reference assemblies.
27672767
JavaOptions="$(JavaOptions)"
27682768
JarPath="$(AndroidBundleToolJarPath)"
27692769
BaseZip="$(_BaseZipIntermediate)"
2770+
Modules="@(AndroidAppBundleModules)"
27702771
Output="$(_AppBundleIntermediate)"
27712772
UncompressedFileExtensions="$(AndroidStoreUncompressedFileExtensions)"
27722773
CustomBuildConfigFile="$(AndroidBundleConfigurationFile)"

0 commit comments

Comments
 (0)