private List<ModuleNameVersion> collectModulesFromLastPublishedBuildInfo(SBuildType buildType) throws Exception { List<ModuleNameVersion> modules = Lists.newArrayList(); Build latestBuildInfo = locateLatestBuildInfo(buildType); if (latestBuildInfo != null) { List<Module> buildInfoModules = latestBuildInfo.getModules(); if (buildInfoModules != null) { for (Module buildInfoModule : buildInfoModules) { String moduleId = buildInfoModule.getId(); // rely on module id format like groupId:artifactId:version String[] moduleIdTokens = moduleId.split(":"); if (moduleIdTokens.length == 3) { modules.add(new ModuleNameVersion(moduleIdTokens[0], moduleIdTokens[1], moduleIdTokens[2])); } } } } return modules; }
public void append(Build other) { Properties properties = other.getProperties(); Env otherEnv = new Env(); if (properties != null) { for (String key : properties.stringPropertyNames()) { boolean isEnvVar = StringUtils.startsWith(key, BuildInfoProperties.BUILD_INFO_ENVIRONMENT_PREFIX); if (isEnvVar) { otherEnv.getEnvVars().put(StringUtils.substringAfter(key, BuildInfoProperties.BUILD_INFO_ENVIRONMENT_PREFIX), properties.getProperty(key)); } else { otherEnv.getSysVars().put(key, properties.getProperty(key)); } } this.env.append(otherEnv); } if (other.getModules() != null) { other.getModules().forEach(this::addModule); } if (other.getBuildDependencies() != null) { this.buildDependencies.addAll(other.getBuildDependencies()); } }
private Set<DeployDetails> prepareDeployableArtifacts(Build build, Map<String, DeployDetails> deployableArtifactBuilders) { Set<DeployDetails> deployableArtifacts = Sets.newLinkedHashSet(); List<Module> modules = build.getModules(); for (Module module : modules) { List<Artifact> artifacts = module.getArtifacts(); if(artifacts!=null){ for (Artifact artifact : artifacts) { String artifactId = BuildInfoExtractorUtils.getArtifactId(module.getId(), artifact.getName()); DeployDetails deployable = deployableArtifactBuilders.get(artifactId); if (deployable != null) { File file = deployable.getFile(); setArtifactChecksums(file, artifact); deployableArtifacts.add(new DeployDetails.Builder().artifactPath(deployable.getArtifactPath()). file(file).md5(artifact.getMd5()).sha1(artifact.getSha1()). addProperties(deployable.getProperties()). targetRepository(deployable.getTargetRepository()).build()); } } } } return deployableArtifacts; }