use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testSimpleCCBinary.
@Test
public void testSimpleCCBinary() throws Exception {
scratch.file("com/google/example/BUILD", "cc_binary(", " name = 'simple',", " srcs = ['simple/simple.cc'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:simple");
assertThat(targetIdeInfos).hasSize(2);
TargetIdeInfo targetIdeInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
ArtifactLocation location = targetIdeInfo.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString()).isEqualTo(Paths.get("com/google/example/BUILD").toString());
assertThat(targetIdeInfo.getKindString()).isEqualTo("cc_binary");
assertThat(targetIdeInfo.getDependenciesCount()).isEqualTo(1);
assertThat(relativePathsForCSourcesOf(targetIdeInfo)).containsExactly("com/google/example/simple/simple.cc");
assertThat(targetIdeInfo.hasCIdeInfo()).isTrue();
assertThat(targetIdeInfo.hasJavaIdeInfo()).isFalse();
assertThat(targetIdeInfo.hasAndroidIdeInfo()).isFalse();
CIdeInfo cTargetIdeInfo = targetIdeInfo.getCIdeInfo();
assertThat(cTargetIdeInfo.getTargetCoptList()).isEmpty();
assertThat(cTargetIdeInfo.getTargetDefineList()).isEmpty();
assertThat(cTargetIdeInfo.getTargetIncludeList()).isEmpty();
assertThat(targetIdeInfo.getJavaIdeInfo().getJarsList()).isEmpty();
assertThat(getIdeResolveFiles()).isEmpty();
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testSimpleCCLibrary.
@Test
public void testSimpleCCLibrary() throws Exception {
scratch.file("com/google/example/BUILD", "cc_library(", " name = 'simple',", " srcs = ['simple/simple.cc'],", " hdrs = ['simple/simple.h'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:simple");
assertThat(targetIdeInfos).hasSize(2);
TargetIdeInfo targetIdeInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
ArtifactLocation location = targetIdeInfo.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString()).isEqualTo(Paths.get("com/google/example/BUILD").toString());
assertThat(targetIdeInfo.getKindString()).isEqualTo("cc_library");
assertThat(targetIdeInfo.getDependenciesCount()).isEqualTo(1);
assertThat(relativePathsForCSourcesOf(targetIdeInfo)).containsExactly("com/google/example/simple/simple.cc");
assertThat(targetIdeInfo.hasCIdeInfo()).isTrue();
assertThat(targetIdeInfo.hasJavaIdeInfo()).isFalse();
assertThat(targetIdeInfo.hasAndroidIdeInfo()).isFalse();
CIdeInfo cTargetIdeInfo = targetIdeInfo.getCIdeInfo();
assertThat(cTargetIdeInfo.getTargetCoptList()).isEmpty();
assertThat(cTargetIdeInfo.getTargetDefineList()).isEmpty();
assertThat(cTargetIdeInfo.getTargetIncludeList()).isEmpty();
ProtocolStringList transQuoteIncludeDirList = cTargetIdeInfo.getTransitiveQuoteIncludeDirectoryList();
assertThat(transQuoteIncludeDirList).contains(".");
assertThat(targetIdeInfo.getJavaIdeInfo().getJarsList()).isEmpty();
assertThat(getIdeResolveFiles()).containsExactly("com/google/example/simple/simple.h");
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testSimpleCCLibraryForCCToolchainExistence.
@Test
public void testSimpleCCLibraryForCCToolchainExistence() throws Exception {
scratch.file("com/google/example/BUILD", "cc_library(", " name = 'simple',", " srcs = ['simple/simple.cc'],", " hdrs = ['simple/simple.h'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:simple");
assertThat(targetIdeInfos).hasSize(2);
TargetIdeInfo target = getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
Entry<String, TargetIdeInfo> toolchainEntry = getCcToolchainRuleAndVerifyThereIsOnlyOne(targetIdeInfos);
TargetIdeInfo toolchainInfo = toolchainEntry.getValue();
ArtifactLocation location = target.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString()).isEqualTo(Paths.get("com/google/example/BUILD").toString());
assertThat(target.hasCIdeInfo()).isTrue();
assertThat(target.getDependenciesList()).hasSize(1);
assertThat(toolchainInfo.hasCToolchainIdeInfo()).isTrue();
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testNonExternalRootCorrectlyIdentified.
@Test
public void testNonExternalRootCorrectlyIdentified() throws Exception {
ArtifactLocation location = AndroidStudioInfoAspect.makeArtifactLocation(Root.asSourceRoot(rootDirectory, true), new PathFragment("foo/bar.jar"), false);
assertThat(location.getIsExternal()).isFalse();
}
use of com.google.devtools.intellij.ideinfo.IntellijIdeInfo.ArtifactLocation in project bazel by bazelbuild.
the class AndroidStudioInfoAspectTest method testCcToolchainInfoIsOnlyPresentForToolchainRules.
@Test
public void testCcToolchainInfoIsOnlyPresentForToolchainRules() throws Exception {
scratch.file("com/google/example/BUILD", "cc_library(", " name = 'simple',", " srcs = ['simple/simple.cc'],", " hdrs = ['simple/simple.h'],", ")");
Map<String, TargetIdeInfo> targetIdeInfos = buildIdeInfo("//com/google/example:simple");
assertThat(targetIdeInfos).hasSize(2);
TargetIdeInfo targetIdeInfo = getTargetIdeInfoAndVerifyLabel("//com/google/example:simple", targetIdeInfos);
Entry<String, TargetIdeInfo> toolchainEntry = getCcToolchainRuleAndVerifyThereIsOnlyOne(targetIdeInfos);
TargetIdeInfo toolchainInfo = toolchainEntry.getValue();
ArtifactLocation location = targetIdeInfo.getBuildFileArtifactLocation();
assertThat(Paths.get(location.getRelativePath()).toString()).isEqualTo(Paths.get("com/google/example/BUILD").toString());
assertThat(targetIdeInfo.hasCToolchainIdeInfo()).isFalse();
assertThat(toolchainInfo.hasCToolchainIdeInfo()).isTrue();
}
Aggregations