use of com.google.devtools.build.lib.packages.Package in project bazel by bazelbuild.
the class CircularDependencyTest method testInputOutputConflictDifferentPackage.
/**
* Test not to detect implicit input/output file overlap in rules,
* when coming from a different package.
*/
@Test
public void testInputOutputConflictDifferentPackage() throws Exception {
Package pkg = createScratchPackageForImplicitCycle("googledata/xxx", "genrule(name='geo',", " srcs = ['//googledata/geo:geo_info.txt'],", " outs = ['geoinfo.txt'],", " cmd = '$(SRCS) > $@')");
assertFalse(pkg.containsErrors());
}
use of com.google.devtools.build.lib.packages.Package in project bazel by bazelbuild.
the class PackageCacheTest method testASTIsNotRetained.
@Test
public void testASTIsNotRetained() throws Exception {
createPkg1();
Package pkg1 = getPackage("pkg1");
MoreAsserts.assertInstanceOfNotReachable(pkg1, BuildFileAST.class);
}
use of com.google.devtools.build.lib.packages.Package in project bazel by bazelbuild.
the class PackageCacheTest method assertPackageLoadingFails.
private void assertPackageLoadingFails(String pkgName, String expectedError) throws Exception {
Package pkg = getPackage(pkgName);
assertTrue(pkg.containsErrors());
assertContainsEvent(expectedError);
}
use of com.google.devtools.build.lib.packages.Package in project bazel by bazelbuild.
the class PackageCacheTest method testRepeatedAttemptsToParseMissingPackage.
/**
* A missing package is one for which no BUILD file can be found. The
* PackageCache caches failures of this kind until the next sync.
*/
@Test
public void testRepeatedAttemptsToParseMissingPackage() throws Exception {
checkGetPackageFails("missing", "no such package 'missing': " + "BUILD file not found on package path");
// Still missing:
checkGetPackageFails("missing", "no such package 'missing': " + "BUILD file not found on package path");
// Update the BUILD file on disk so "missing" is no longer missing:
scratch.file("missing/BUILD", "# an ok build file");
// Still missing:
checkGetPackageFails("missing", "no such package 'missing': " + "BUILD file not found on package path");
invalidatePackages();
// Found:
Package missing = getPackage("missing");
assertEquals("missing", missing.getName());
}
use of com.google.devtools.build.lib.packages.Package in project bazel by bazelbuild.
the class PackageCacheTest method testPackageInErrorReloadedWhenFixed.
@Test
public void testPackageInErrorReloadedWhenFixed() throws Exception {
reporter.removeHandler(failFastHandler);
Path build = scratch.file("a/BUILD", "cc_library(name='a', feet='stinky')");
build.setLastModifiedTime(1);
Package a1 = getPackage("a");
assertTrue(a1.containsErrors());
assertContainsEvent("//a:a: no such attribute 'feet'");
eventCollector.clear();
build.delete();
build = scratch.file("a/BUILD", "cc_library(name='a', srcs=['a.cc'])");
build.setLastModifiedTime(2);
invalidatePackages();
Package a2 = getPackage("a");
assertNotSame(a1, a2);
assertFalse(a2.containsErrors());
assertNoEvents();
}
Aggregations