Skip to content

Commit

Permalink
Populate v3 sign min api for rotation in ApkInfo.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 423981347
  • Loading branch information
Googler authored and copybara-github committed Jan 25, 2022
1 parent 2b7ced8 commit f6dbd1e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,8 @@ public static RuleConfiguredTargetBuilder createAndroidBinary(
getCoverageInstrumentationJarForApk(ruleContext),
resourceApk.getManifest(),
signingKeys,
signingLineage))
signingLineage,
keyRotationMinSdk))
.addNativeDeclaredProvider(new AndroidPreDexJarProvider(jarToDex))
.addNativeDeclaredProvider(
AndroidFeatureFlagSetProvider.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class ApkInfo extends NativeInfo implements ApkInfoApi<Artifact> {
private final Artifact mergedManifest;
private final ImmutableList<Artifact> signingKeys;
@Nullable private final Artifact signingLineage;
@Nullable private final String signingMinV3RotationApiVersion;

ApkInfo(
Artifact apk,
Expand All @@ -51,14 +52,16 @@ public class ApkInfo extends NativeInfo implements ApkInfoApi<Artifact> {
@Nullable Artifact coverageMetadata,
Artifact mergedManifest,
List<Artifact> signingKeys,
@Nullable Artifact signingLineage) {
@Nullable Artifact signingLineage,
@Nullable String signingMinV3RotationApiVersion) {
this.apk = apk;
this.unsignedApk = unsignedApk;
this.deployJar = deployJar;
this.coverageMetadata = coverageMetadata;
this.mergedManifest = mergedManifest;
this.signingKeys = ImmutableList.copyOf(signingKeys);
this.signingLineage = signingLineage;
this.signingMinV3RotationApiVersion = signingMinV3RotationApiVersion;
}

@Override
Expand Down Expand Up @@ -112,6 +115,12 @@ public Artifact getSigningLineage() {
return signingLineage;
}

@Nullable
@Override
public String getSigningMinV3RotationApiVersion() {
return signingMinV3RotationApiVersion;
}

/** Provider for {@link ApkInfo}. */
public static class ApkInfoProvider extends BuiltinProvider<ApkInfo>
implements ApkInfoApiProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ public interface ApkInfoApi<FileT extends FileApi> extends StructApi {
@Nullable
FileT getSigningLineage();

/** Returns the minimum API version for signing the APK with key rotation. */
@StarlarkMethod(
name = "signing_min_v3_rotation_api_version",
doc = "Returns the minimum API version for signing the APK with key rotation.",
documented = false,
structField = true,
allowReturnNones = true)
@Nullable
String getSigningMinV3RotationApiVersion();

/** Provider for {@link ApkInfoApi}. */
@StarlarkBuiltin(
name = "ApkInfoApiProvider",
Expand Down

0 comments on commit f6dbd1e

Please sign in to comment.