Search in sources :

Example 21 with Materials

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);
}
Also used : MaterialRevision(com.thoughtworks.go.domain.MaterialRevision) Revision(com.thoughtworks.go.domain.materials.Revision) Materials(com.thoughtworks.go.config.materials.Materials) ArrayList(java.util.ArrayList) Material(com.thoughtworks.go.domain.materials.Material) ModificationVisitorAdapter(com.thoughtworks.go.domain.ModificationVisitorAdapter)

Example 22 with 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));
    }
}
Also used : Materials(com.thoughtworks.go.config.materials.Materials) PackageMaterial(com.thoughtworks.go.config.materials.PackageMaterial) Material(com.thoughtworks.go.domain.materials.Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) PluggableSCMMaterial(com.thoughtworks.go.config.materials.PluggableSCMMaterial)

Example 23 with Materials

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));
        }
    }
}
Also used : Materials(com.thoughtworks.go.config.materials.Materials) PackageMaterial(com.thoughtworks.go.config.materials.PackageMaterial) Material(com.thoughtworks.go.domain.materials.Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) PluggableSCMMaterial(com.thoughtworks.go.config.materials.PluggableSCMMaterial) MaterialInstance(com.thoughtworks.go.domain.MaterialInstance) File(java.io.File)

Example 24 with Materials

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;
}
Also used : Materials(com.thoughtworks.go.config.materials.Materials) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) AbstractMaterial(com.thoughtworks.go.config.materials.AbstractMaterial) DependencyMaterialInstance(com.thoughtworks.go.domain.materials.dependency.DependencyMaterialInstance)

Example 25 with Materials

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()));
}
Also used : Materials(com.thoughtworks.go.config.materials.Materials)

Aggregations

Materials (com.thoughtworks.go.config.materials.Materials)58 Test (org.junit.Test)48 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)24 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)19 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)19 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)16 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)14 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)13 Material (com.thoughtworks.go.domain.materials.Material)10 Modification (com.thoughtworks.go.domain.materials.Modification)10 File (java.io.File)10 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)9 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)9 Date (java.util.Date)9 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)8 MaterialRevisionsMatchers.containsModifiedFile (com.thoughtworks.go.config.MaterialRevisionsMatchers.containsModifiedFile)5 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)5 Stage (com.thoughtworks.go.domain.Stage)5 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)5 PackageMaterial (com.thoughtworks.go.config.materials.PackageMaterial)4