use of org.eclipse.aether.util.artifact.SubArtifact in project buck by facebook.
the class Publisher method publish.
/**
* @param descriptor an {@link Artifact}, holding the maven coordinates for the published files
* less the extension that is to be derived from the files.
* The {@code descriptor} itself will not be published as is, and the
* {@link File} attached to it (if any) will be ignored.
* @param toPublish {@link File}(s) to be published using the given coordinates. The filename
* extension of each given file will be used as a maven "extension" coordinate
*/
public DeployResult publish(Artifact descriptor, List<File> toPublish) throws DeploymentException {
String providedExtension = descriptor.getExtension();
if (!providedExtension.isEmpty()) {
LOG.warn("Provided extension %s of artifact %s to be published will be ignored. The extensions " + "of the provided file(s) will be used", providedExtension, descriptor);
}
List<Artifact> artifacts = new ArrayList<>(toPublish.size());
for (File file : toPublish) {
artifacts.add(new SubArtifact(descriptor, descriptor.getClassifier(), Files.getFileExtension(file.getAbsolutePath()), file));
}
return publish(artifacts);
}
use of org.eclipse.aether.util.artifact.SubArtifact in project buck by facebook.
the class Resolver method downloadSources.
private void downloadSources(Artifact artifact, Path project, Prebuilt library) throws IOException {
Artifact srcs = new SubArtifact(artifact, "sources", "jar");
try {
Path relativePath = resolveArtifact(srcs, project);
library.setSourceJar(relativePath);
} catch (ArtifactResolutionException e) {
System.err.println("Skipping sources for: " + srcs);
}
}
Aggregations