use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class BuildCause method materials.
public Materials materials() {
final List<Material> materials = new ArrayList<>();
materialRevisions.accept(new ModificationVisitorAdapter() {
public void visit(Material material, Revision revision) {
materials.add(material);
}
});
return new Materials(materials);
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class MaterialDatabaseUpdater method initializeMaterialWithLatestRevision.
private void initializeMaterialWithLatestRevision(Material material) {
Materials materials = new Materials();
materialExpansionService.expandForHistory(material, materials);
for (Material expanded : materials) {
addNewMaterialWithModifications(folderFor(expanded), expanded, updater(expanded));
}
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class MaterialDatabaseUpdater method updateMaterialWithNewRevisions.
void updateMaterialWithNewRevisions(Material material) {
Materials materials = new Materials();
materialExpansionService.expandForHistory(material, materials);
for (Material expanded : materials) {
MaterialInstance expandedInstance = materialRepository.findMaterialInstance(expanded);
File expandedFolder = folderFor(expanded);
if (expandedInstance == null) {
addNewMaterialWithModifications(expandedFolder, expanded, updater(expanded));
} else {
insertLatestOrNewModifications(expanded, expandedInstance, expandedFolder, updater(expanded));
}
}
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class MaterialRepository method findLatestModification.
public MaterialRevisions findLatestModification(Material material) {
MaterialInstance materialInstance = findMaterialInstance(material);
if (materialInstance == null) {
return new MaterialRevisions();
}
Materials materials = new Materials();
materialExpansionService.expandForHistory(material, materials);
MaterialRevisions allModifications = new MaterialRevisions();
for (Material expanded : materials) {
final MaterialInstance expandedInstance = findOrCreateFrom(expanded);
Modification modification = findLatestModification(expandedInstance);
if (modification != null) {
allModifications.addRevision(expanded, modification);
}
}
return allModifications;
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class BuildComposer method updateMaterials.
private BuildCommand updateMaterials() {
if (!assignment.getPlan().shouldFetchMaterials()) {
return echoWithPrefix("Skipping material update since stage is configured not to fetch materials");
}
MaterialRevisions materialRevisions = assignment.materialRevisions();
Materials materials = materialRevisions.getMaterials();
return BuildCommand.compose(materials.cleanUpCommand(workingDirectory()), echoWithPrefix("Start to update materials \n"), materialRevisions.updateToCommand(workingDirectory()));
}
Aggregations