use of com.walmartlabs.concord.project.model.Resources in project concord by walmartlabs.
the class ProjectLoader method loadProject.
/**
* Loads the project definition using the supplied path. Processes the configured
* imports, templates and extra directories with project files.
*
* @param workDir the directory containing the project files. If {@code imports} are
* configured, the directory will be used as a target for repository
* checkouts.
*/
public Result loadProject(Path workDir, ImportsNormalizer importsNormalizer, ImportsListener listener) throws Exception {
workDir = workDir.normalize().toAbsolutePath();
ProjectDefinition initial = initialLoad(workDir);
Resources resources = initial.getResources();
Imports imports = importsNormalizer.normalize(initial.getImports());
List<Snapshot> snapshots = importManager.process(imports, workDir, listener);
ProjectDefinitionBuilder b = new ProjectDefinitionBuilder(parser);
List<String> projectPaths = resources.getProjectFilePaths();
if (projectPaths != null) {
for (String n : projectPaths) {
Path p = assertLocal(workDir, workDir.resolve(n));
if (Files.exists(p)) {
b.addProjects(p);
}
}
}
for (String n : Constants.Files.PROJECT_ROOT_FILE_NAMES) {
Path p = assertLocal(workDir, workDir.resolve(n));
if (Files.exists(p)) {
b.addProjectFile(workDir, p);
break;
}
}
List<String> definitionPaths = resources.getDefinitionPaths();
if (definitionPaths != null) {
for (String n : definitionPaths) {
Path p = assertLocal(workDir, workDir.resolve(n));
if (Files.exists(p)) {
b.addDefinitions(p);
}
}
}
List<String> profilesPaths = resources.getProfilesPaths();
if (profilesPaths != null) {
for (String n : profilesPaths) {
Path p = assertLocal(workDir, workDir.resolve(n));
if (Files.exists(p)) {
b.addProfiles(p);
}
}
}
ProjectDefinition pd = b.build();
// save the normalized imports, so the exact same workDir structure
// can be re-created later (e.g. by the Agent)
pd = new ProjectDefinition(pd, imports);
return new Result(snapshots, pd);
}
use of com.walmartlabs.concord.project.model.Resources in project concord by walmartlabs.
the class YamlProjectConverter method convert.
public static ProjectDefinition convert(YamlProject project) throws YamlConverterException {
Map<String, ProcessDefinition> flows = convertFlows(project.getFlows());
Set<String> publicFlows = project.getPublicFlows();
Map<String, FormDefinition> forms = convertForms(project.getForms());
Map<String, Object> cfg = project.getConfiguration();
Map<String, Profile> profiles = convertProfiles(project.getProfiles());
List<Trigger> triggers = YamlTriggersConverter.convert(project.getTriggers());
Imports imports = convertImports(project.getImports());
Resources resources = convertResources(project.getResources());
return new ProjectDefinition(flows, publicFlows, forms, cfg, profiles, triggers, imports, resources);
}
Aggregations