public String getId() { return module.getId(); }
public boolean apply(Module input) { return input.getId().equals(moduleKey); } }, null);
/** * Returns the module object by the given ID * * @param moduleId ID of module to locate * @return Module object if found. Null if not */ public Module getModule(String moduleId) { if (modules != null) { for (Module module : modules) { if (module.getId().equals(moduleId)) { return module; } } } return null; }
/** * Returns the module object by the given ID * * @param moduleId ID of module to locate * @return Module object if found. Null if not */ public Module getModule(String moduleId) { if (modules != null) { for (Module module : modules) { if (module.getId().equals(moduleId)) { return module; } } } return null; } }
private void addModule(Module other) { List<Module> modules = getModules(); Module currentModule = modules.stream() // Check if there's already a module with the same name. .filter(module -> StringUtils.equals(module.getId(), other.getId())) .findAny() .orElse(null); if (currentModule == null) { // Append new module. modules.add(other); } else { // Append the other module into the existing module with the same name. currentModule.append(other); } }
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; }
private void mergeModule(Module moduleToMerge) { Module existingModule = findModule(moduleToMerge.getId()); if (existingModule == null) { modules.add(moduleToMerge); return; } mergeModuleArtifacts(existingModule, moduleToMerge); mergeModuleDependencies(existingModule, moduleToMerge); }
private void addDeployableArtifact(org.jfrog.build.api.Artifact artifact, File artifactFile, String groupId, String artifactId, String version, String classifier, String fileExtension) { String deploymentPath = getDeploymentPath(groupId, artifactId, version, classifier, fileExtension); // deploy to snapshots or releases repository based on the deploy version String targetRepository = getTargetRepository(deploymentPath); DeployDetails deployable = new DeployDetails.Builder().artifactPath(deploymentPath).file(artifactFile). targetRepository(targetRepository).addProperties(conf.publisher.getMatrixParams()).build(); String myArtifactId = BuildInfoExtractorUtils.getArtifactId(currentModule.get().build().getId(), artifact.getName()); deployableArtifactBuilderMap.put(myArtifactId, deployable); }
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; }