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

support build-apks with mode=universal that baseline.prof packaging to apks #297

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ dependencies {
}

def osName = System.getProperty("os.name").toLowerCase()
def archName = System.getProperty("os.arch").toLowerCase()

// Use utf-8 instead of the platform default encoding.
compileJava.options.encoding = "UTF-8"
Expand Down Expand Up @@ -121,7 +122,11 @@ test {

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.4.0"
if (osName.contains("mac") && archName.contains("arch64")) {
artifact = "com.google.protobuf:protoc:3.4.0:osx-x86_64"
} else {
artifact = "com.google.protobuf:protoc:3.4.0"
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.android.tools.build.bundletool.model.SourceStamp;
import com.android.tools.build.bundletool.model.SourceStamp.StampType;
import com.android.tools.build.bundletool.optimizations.ApkOptimizations;
import com.android.tools.build.bundletool.splitters.BinaryArtProfilesInjector;
import com.android.tools.build.bundletool.splitters.CodeTransparencyInjector;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
Expand All @@ -45,6 +46,8 @@ public class StandaloneApksGenerator {
private final Sharder sharder;
private final ModuleSplitsToShardMerger shardsMerger;
private final CodeTransparencyInjector codeTransparencyInjector;
private final BinaryArtProfilesInjector binaryArtProfilesInjector;


@Inject
public StandaloneApksGenerator(
Expand All @@ -58,6 +61,7 @@ public StandaloneApksGenerator(
this.sharder = sharder;
this.shardsMerger = shardsMerger;
this.codeTransparencyInjector = new CodeTransparencyInjector(appBundle);
this.binaryArtProfilesInjector = new BinaryArtProfilesInjector(appBundle);
}

/**
Expand Down Expand Up @@ -99,6 +103,7 @@ public ImmutableList<ModuleSplit> generateStandaloneApks(
.map(StandaloneApksGenerator::setVariantTargetingAndSplitType)
.map(this::writeSourceStampInManifest)
.map(codeTransparencyInjector::inject)
.map(binaryArtProfilesInjector::inject)
.collect(toImmutableList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public BinaryArtProfilesInjector(AppBundle appBundle) {
}

public ModuleSplit inject(ModuleSplit split) {
if (!split.isMasterSplit() || !split.isBaseModuleSplit()) {
if (split.getSplitType() != ModuleSplit.SplitType.STANDALONE && (!split.isMasterSplit() || !split.isBaseModuleSplit())) {
return split;
}
if (!binaryArtProfileMetadata.isPresent() && !binaryArtProfile.isPresent()) {
Expand Down