Skip to content
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

Add multiplex worker support to dexbuilder #15321

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ public enum WorkerProtocolFormat {
public static final ImmutableMap<String, String> WORKER_MODE_ENABLED =
ImmutableMap.of(SUPPORTS_WORKERS, "1");

public static final ImmutableMap<String, String> WORKER_MULTIPLEX_MODE_ENABLED =
ImmutableMap.of(SUPPORTS_MULTIPLEX_WORKERS, "1");

/**
* Requires local execution without sandboxing for a spawn.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,14 @@ public static class Options extends FragmentOptions {
help = "Whether dexbuilder supports being run in local worker mode.")
public boolean useWorkersWithDexbuilder;

@Option(
name = "use_multiplex_workers_with_dexbuilder",
defaultValue = "false",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
effectTags = {OptionEffectTag.EXECUTION},
help = "Whether dexbuilder supports being run in local multiplex worker mode.")
public boolean useMultiplexWorkersWithDexbuilder;

@Option(
name = "experimental_android_rewrite_dexes_with_rex",
defaultValue = "false",
Expand Down Expand Up @@ -1016,6 +1024,7 @@ public FragmentOptions getHost() {
host.dexoptsSupportedInDexMerger = dexoptsSupportedInDexMerger;
host.dexoptsSupportedInDexSharder = dexoptsSupportedInDexSharder;
host.useWorkersWithDexbuilder = useWorkersWithDexbuilder;
host.useMultiplexWorkersWithDexbuilder = useMultiplexWorkersWithDexbuilder;
host.manifestMerger = manifestMerger;
host.manifestMergerOrder = manifestMergerOrder;
host.allowAndroidLibraryDepsWithoutSrcs = allowAndroidLibraryDepsWithoutSrcs;
Expand All @@ -1042,6 +1051,7 @@ public FragmentOptions getHost() {
private final ImmutableList<String> dexoptsSupportedInDexMerger;
private final ImmutableList<String> dexoptsSupportedInDexSharder;
private final boolean useWorkersWithDexbuilder;
private final boolean useMultiplexWorkersWithDexbuilder;
private final boolean desugarJava8;
private final boolean desugarJava8Libs;
private final boolean checkDesugarDeps;
Expand Down Expand Up @@ -1096,6 +1106,7 @@ public AndroidConfiguration(BuildOptions buildOptions) throws InvalidConfigurati
this.dexoptsSupportedInDexMerger = ImmutableList.copyOf(options.dexoptsSupportedInDexMerger);
this.dexoptsSupportedInDexSharder = ImmutableList.copyOf(options.dexoptsSupportedInDexSharder);
this.useWorkersWithDexbuilder = options.useWorkersWithDexbuilder;
this.useMultiplexWorkersWithDexbuilder = options.useMultiplexWorkersWithDexbuilder;
this.desugarJava8 = options.desugarJava8;
this.desugarJava8Libs = options.desugarJava8Libs;
this.checkDesugarDeps = options.checkDesugarDeps;
Expand Down Expand Up @@ -1234,6 +1245,12 @@ public boolean useWorkersWithDexbuilder() {
return useWorkersWithDexbuilder;
}

/** Whether to assume the dexbuilder tool supports local multiplexed worker mode. */
@Override
public boolean useMultiplexWorkersWithDexbuilder() {
return useMultiplexWorkersWithDexbuilder;
}

@Override
public boolean desugarJava8() {
return desugarJava8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ static Artifact createDexArchiveAction(
if (getAndroidConfig(ruleContext).useWorkersWithDexbuilder()) {
dexbuilder.setExecutionInfo(ExecutionRequirements.WORKER_MODE_ENABLED);
}
if (getAndroidConfig(ruleContext).useMultiplexWorkersWithDexbuilder()) {
dexbuilder.setExecutionInfo(ExecutionRequirements.WORKER_MULTIPLEX_MODE_ENABLED);
}
ruleContext.registerAction(dexbuilder.build(ruleContext));
return dexArchive;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ public interface AndroidConfigurationApi extends StarlarkValue {
documented = false)
boolean useWorkersWithDexbuilder();

@StarlarkMethod(
name = "use_multiplex_workers_with_dexbuilder",
structField = true,
doc = "",
documented = false)
boolean useMultiplexWorkersWithDexbuilder();

@StarlarkMethod(name = "desugar_java8", structField = true, doc = "", documented = false)
boolean desugarJava8();

Expand Down