use of com.google.devtools.build.lib.packages.NoSuchPackageException in project bazel by bazelbuild.
the class PackageCacheTest method assertLabelValidity.
private void assertLabelValidity(boolean expected, String labelString) throws Exception {
Label label = Label.parseAbsolute(labelString);
boolean actual = false;
String error = null;
try {
getTarget(label);
actual = true;
} catch (NoSuchPackageException | NoSuchTargetException e) {
error = e.getMessage();
}
if (actual != expected) {
fail("assertLabelValidity(" + label + ") " + actual + ", not equal to expected value " + expected + " (error=" + error + ")");
}
}
use of com.google.devtools.build.lib.packages.NoSuchPackageException in project bazel by bazelbuild.
the class PathPackageLocatorTest method testExists.
@Test
public void testExists() throws Exception {
Path nonExistentRoot1 = setLocator("/non/existent/1/workspace");
// Now let's create the root:
createBuildFile(nonExistentRoot1, "X");
// The package is found, because we didn't drop the root:
try {
locator.getPackageBuildFile(PackageIdentifier.createInMainRepo("X"));
fail("Exception expected");
} catch (NoSuchPackageException e) {
}
Path nonExistentRoot2 = setLocator("/non/existent/2/workspace");
// Now let's create the root:
createBuildFile(nonExistentRoot2, "X");
// ...but the package is still not found, because we dropped the root:
checkFails("X", "no such package 'X': BUILD file not found on package path");
}
Aggregations