Search in sources :

Example 6 with ParsedManifest

use of com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest in project intellij by bazelbuild.

the class BlazeApkDeployInfoProtoHelperTest method readDeployInfoForNormalBuild_withTestTargetManifest.

@Test
public void readDeployInfoForNormalBuild_withTestTargetManifest() throws Exception {
    // setup
    AndroidDeployInfo deployInfoProto = AndroidDeployInfo.newBuilder().setMergedManifest(makeArtifact("path/to/manifest")).addAdditionalMergedManifests(makeArtifact("path/to/testtarget/manifest")).addApksToDeploy(makeArtifact("path/to/apk")).addApksToDeploy(makeArtifact("path/to/testtarget/apk")).build();
    File mainApk = new File("execution_root/path/to/apk");
    File testApk = new File("execution_root/path/to/testtarget/apk");
    File mainManifest = new File("execution_root/path/to/manifest");
    File testTargetManifest = new File("execution_root/path/to/testtarget/manifest");
    ParsedManifest parsedMainManifest = new ParsedManifest("main", null, null);
    ParsedManifest parsedTestManifest = new ParsedManifest("testtarget", null, null);
    when(mockParsedManifestService.getParsedManifest(mainManifest)).thenReturn(parsedMainManifest);
    when(mockParsedManifestService.getParsedManifest(testTargetManifest)).thenReturn(parsedTestManifest);
    // perform
    BlazeAndroidDeployInfo deployInfo = new BlazeApkDeployInfoProtoHelper().extractDeployInfoAndInvalidateManifests(getProject(), new File("execution_root"), deployInfoProto);
    // verify
    assertThat(deployInfo.getApksToDeploy()).containsExactly(mainApk, testApk).inOrder();
    assertThat(deployInfo.getMergedManifest()).isEqualTo(parsedMainManifest);
    assertThat(deployInfo.getTestTargetMergedManifest()).isEqualTo(parsedTestManifest);
    ArgumentCaptor<File> expectedArgs = ArgumentCaptor.forClass(File.class);
    verify(mockParsedManifestService, times(2)).invalidateCachedManifest(expectedArgs.capture());
    assertThat(expectedArgs.getAllValues()).containsExactly(mainManifest, testTargetManifest).inOrder();
}
Also used : AndroidDeployInfo(com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.AndroidDeployInfo) ParsedManifest(com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest) File(java.io.File) Test(org.junit.Test)

Aggregations

ParsedManifest (com.google.idea.blaze.android.manifest.ManifestParser.ParsedManifest)6 AndroidDeployInfo (com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.AndroidDeployInfo)4 File (java.io.File)4 Test (org.junit.Test)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 ImmutableList (com.google.common.collect.ImmutableList)2 Artifact (com.google.devtools.build.lib.rules.android.deployinfo.AndroidDeployInfoOuterClass.Artifact)2 ParsedManifestService (com.google.idea.blaze.android.manifest.ParsedManifestService)2 BlazeAndroidDeployInfo (com.google.idea.blaze.android.run.deployinfo.BlazeAndroidDeployInfo)2 ApkBuildStep (com.google.idea.blaze.android.run.runner.ApkBuildStep)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 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2