use of com.google.copybara.config.PathBasedConfigFile in project copybara by google.
the class Main method resolveLocalConfig.
/**
* Returns a {@link ConfigFile} resolving the {@code configLocation} in the local filesystem.
*/
protected ConfigFile<Path> resolveLocalConfig(GeneralOptions generalOptions, String configLocation) throws ValidationException {
Path configPath = generalOptions.getFileSystem().getPath(configLocation);
String fileName = configPath.getFileName().toString();
checkCondition(fileName.contentEquals(COPYBARA_SKYLARK_CONFIG_FILENAME), "Copybara config file filename should be '%s' but it is '%s'.", COPYBARA_SKYLARK_CONFIG_FILENAME, configPath.getFileName());
// Treat the top level element specially since it is passed thru the command line.
if (!Files.exists(configPath)) {
throw new CommandLineException("Configuration file not found: " + configPath);
}
Path root = generalOptions.getConfigRoot() != null ? generalOptions.getConfigRoot() : findConfigRootHeuristic(configPath.toAbsolutePath());
return new PathBasedConfigFile(configPath.toAbsolutePath(), root).withContentLogging();
}
Aggregations