Search in sources :

Example 1 with Artifact

use of com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.Artifact in project intellij by bazelbuild.

the class BlazeApkDeployInfoProtoHelper method extractDeployInfoAndInvalidateManifests.

public BlazeAndroidDeployInfo extractDeployInfoAndInvalidateManifests(Project project, File executionRoot, AndroidDeployInfo deployInfoProto) throws GetDeployInfoException {
    File mergedManifestFile = new File(executionRoot, deployInfoProto.getMergedManifest().getExecRootPath());
    ParsedManifest mergedManifest = getParsedManifestSafe(project, mergedManifestFile);
    ParsedManifestService.getInstance(project).invalidateCachedManifest(mergedManifestFile);
    // android_test targets uses additional merged manifests field of the deploy info proto to hold
    // the manifest of the test target APK.
    ParsedManifest testTargetMergedManifest = null;
    List<Artifact> additionalManifests = deployInfoProto.getAdditionalMergedManifestsList();
    if (additionalManifests.size() == 1) {
        File testTargetMergedManifestFile = new File(executionRoot, additionalManifests.get(0).getExecRootPath());
        testTargetMergedManifest = getParsedManifestSafe(project, testTargetMergedManifestFile);
        ParsedManifestService.getInstance(project).invalidateCachedManifest(testTargetMergedManifestFile);
    }
    ImmutableList<File> apksToDeploy = deployInfoProto.getApksToDeployList().stream().map(artifact -> new File(executionRoot, artifact.getExecRootPath())).collect(ImmutableList.toImmutableList());
    return new BlazeAndroidDeployInfo(mergedManifest, testTargetMergedManifest, apksToDeploy);
}
Also used : Predicate(java.util.function.Predicate) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) BuildResultHelper(com.google.idea.blaze.base.command.buildresult.BuildResultHelper) GetArtifactsException(com.google.idea.blaze.base.command.buildresult.BuildResultHelper.GetArtifactsException) ParsedBepOutput(com.google.idea.blaze.base.command.buildresult.ParsedBepOutput) Collectors(java.util.stream.Collectors) File(java.io.File) BlazeArtifact(com.google.idea.blaze.base.command.buildresult.BlazeArtifact) OutputArtifact(com.google.idea.blaze.base.command.buildresult.OutputArtifact) ParsedManifest(com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest) List(java.util.List) Stream(java.util.stream.Stream) ImmutableList(com.google.common.collect.ImmutableList) ParsedManifestService(com.google.idea.blaze.android.manifest.ParsedManifestService) Label(com.google.idea.blaze.base.model.primitives.Label) AndroidDeployInfo(com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.AndroidDeployInfo) Project(com.intellij.openapi.project.Project) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Logger(com.intellij.openapi.diagnostic.Logger) Artifact(com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.Artifact) InputStream(java.io.InputStream) ParsedManifest(com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest) File(java.io.File) BlazeArtifact(com.google.idea.blaze.base.command.buildresult.BlazeArtifact) OutputArtifact(com.google.idea.blaze.base.command.buildresult.OutputArtifact) Artifact(com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.Artifact)

Example 2 with Artifact

use of com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.Artifact in project intellij by bazelbuild.

the class BlazeApkDeployInfoProtoHelper method extractInstrumentationTestDeployInfoAndInvalidateManifests.

public BlazeAndroidDeployInfo extractInstrumentationTestDeployInfoAndInvalidateManifests(Project project, File executionRoot, AndroidDeployInfo instrumentorProto, AndroidDeployInfo appProto) throws GetDeployInfoException {
    File instrumentorManifest = new File(executionRoot, instrumentorProto.getMergedManifest().getExecRootPath());
    ParsedManifest parsedInstrumentorManifest = getParsedManifestSafe(project, instrumentorManifest);
    ParsedManifestService.getInstance(project).invalidateCachedManifest(instrumentorManifest);
    File appManifest = new File(executionRoot, appProto.getMergedManifest().getExecRootPath());
    ParsedManifest parsedAppManifest = getParsedManifestSafe(project, appManifest);
    ParsedManifestService.getInstance(project).invalidateCachedManifest(appManifest);
    ImmutableList<File> apksToDeploy = Stream.concat(instrumentorProto.getApksToDeployList().stream(), appProto.getApksToDeployList().stream()).map(artifact -> new File(executionRoot, artifact.getExecRootPath())).collect(ImmutableList.toImmutableList());
    return new BlazeAndroidDeployInfo(parsedInstrumentorManifest, parsedAppManifest, apksToDeploy);
}
Also used : Predicate(java.util.function.Predicate) IOException(java.io.IOException) FileInputStream(java.io.FileInputStream) BuildResultHelper(com.google.idea.blaze.base.command.buildresult.BuildResultHelper) GetArtifactsException(com.google.idea.blaze.base.command.buildresult.BuildResultHelper.GetArtifactsException) ParsedBepOutput(com.google.idea.blaze.base.command.buildresult.ParsedBepOutput) Collectors(java.util.stream.Collectors) File(java.io.File) BlazeArtifact(com.google.idea.blaze.base.command.buildresult.BlazeArtifact) OutputArtifact(com.google.idea.blaze.base.command.buildresult.OutputArtifact) ParsedManifest(com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest) List(java.util.List) Stream(java.util.stream.Stream) ImmutableList(com.google.common.collect.ImmutableList) ParsedManifestService(com.google.idea.blaze.android.manifest.ParsedManifestService) Label(com.google.idea.blaze.base.model.primitives.Label) AndroidDeployInfo(com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.AndroidDeployInfo) Project(com.intellij.openapi.project.Project) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Logger(com.intellij.openapi.diagnostic.Logger) Artifact(com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.Artifact) InputStream(java.io.InputStream) ParsedManifest(com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest) File(java.io.File)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 ImmutableList (com.google.common.collect.ImmutableList)2 AndroidDeployInfo (com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.AndroidDeployInfo)2 Artifact (com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.Artifact)2 ParsedManifest (com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest)2 ParsedManifestService (com.google.idea.blaze.android.manifest.ParsedManifestService)2 BlazeArtifact (com.google.idea.blaze.base.command.buildresult.BlazeArtifact)2 BuildResultHelper (com.google.idea.blaze.base.command.buildresult.BuildResultHelper)2 GetArtifactsException (com.google.idea.blaze.base.command.buildresult.BuildResultHelper.GetArtifactsException)2 OutputArtifact (com.google.idea.blaze.base.command.buildresult.OutputArtifact)2 ParsedBepOutput (com.google.idea.blaze.base.command.buildresult.ParsedBepOutput)2 Label (com.google.idea.blaze.base.model.primitives.Label)2 Logger (com.intellij.openapi.diagnostic.Logger)2 Project (com.intellij.openapi.project.Project)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 List (java.util.List)2 Predicate (java.util.function.Predicate)2