use of com.google.devtools.build.lib.rules.android.apkmanifest.ApkManifestOuterClass.ApkManifest in project bazel by bazelbuild.
the class ApkManifestAction method newDeterministicWriter.
@Override
public DeterministicWriter newDeterministicWriter(final ActionExecutionContext ctx) throws IOException {
ApkManifestCreator manifestCreator = new ApkManifestCreator(new ArtifactDigester() {
@Override
public byte[] getDigest(Artifact artifact) throws IOException {
return ctx.getMetadataHandler().getMetadata(artifact).digest;
}
});
final ApkManifest manifest = manifestCreator.createManifest();
return new DeterministicWriter() {
@Override
public void writeOutputFile(OutputStream out) throws IOException {
if (textOutput) {
TextFormat.print(manifest, new PrintStream(out));
} else {
manifest.writeTo(out);
}
}
};
}
use of com.google.devtools.build.lib.rules.android.apkmanifest.ApkManifestOuterClass.ApkManifest in project bazel by bazelbuild.
the class ApkManifestAction method computeKey.
@Override
protected String computeKey() {
// Use fake hashes for the purposes of the action's key, because the hashes are retrieved from
// the MetadataHandler, which is available at only action-execution time. This should be ok
// because if an input artifact changes (and hence its hash changes), the action should be rerun
// anyway. This is more for the purpose of putting the structure of the output data into the
// key.
ApkManifestCreator manifestCreator = new ApkManifestCreator(new ArtifactDigester() {
@Override
public byte[] getDigest(Artifact artifact) {
return Ints.toByteArray(artifact.getExecPathString().hashCode());
}
});
ApkManifest manifest;
try {
manifest = manifestCreator.createManifest();
} catch (IOException e) {
// ArtifactDigester that uses the MetadataHandler.
throw new IllegalStateException(e);
}
return new Fingerprint().addString(GUID).addBoolean(textOutput).addBytes(manifest.toByteArray()).hexDigestAndReset();
}
Aggregations