public String getName() { return artifact.getName(); }
public boolean apply(Artifact input) { return input.getName().equals(artifactKey); } }, null);
private void setArtifactChecksums(File artifactFile, org.jfrog.build.api.Artifact artifact) { if ((artifactFile != null) && (artifactFile.isFile())) { try { Map<String, String> checksums = FileChecksumCalculator.calculateChecksums(artifactFile, "md5", "sha1"); artifact.setMd5(checksums.get("md5")); artifact.setSha1(checksums.get("sha1")); } catch (Exception e) { logger.error("Could not set checksum values on '" + artifact.getName() + "': " + e.getMessage(), e); } } }
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 void mergeModuleArtifacts(Module existingModule, Module moduleToMerge) { List<Artifact> existingArtifacts = existingModule.getArtifacts(); List<Artifact> artifactsToMerge = moduleToMerge.getArtifacts(); if (existingArtifacts == null || existingArtifacts.isEmpty()) { existingModule.setArtifacts(artifactsToMerge); return; } if (artifactsToMerge == null || artifactsToMerge.isEmpty()) { return; } for (Artifact artifactToMerge : artifactsToMerge) { Artifact foundArtifact = findArtifact(existingArtifacts, artifactToMerge.getName()); if (foundArtifact == null) { existingArtifacts.add(artifactToMerge); } else { if (StringUtils.isBlank(foundArtifact.getMd5()) && StringUtils.isBlank(foundArtifact.getSha1())) { foundArtifact.setType(artifactToMerge.getType()); foundArtifact.setMd5(artifactToMerge.getMd5()); foundArtifact.setSha1(artifactToMerge.getSha1()); foundArtifact.setProperties(artifactToMerge.getProperties()); } } } }
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; }