blob: 2e742edbab5fac101a73b41921d0f316f1db7b4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package com.amadornes.artifactural.gradle;
import com.amadornes.artifactural.api.artifact.Artifact;
import com.amadornes.artifactural.api.artifact.ArtifactIdentifier;
import com.amadornes.artifactural.api.artifact.ArtifactType;
import com.amadornes.artifactural.base.artifact.StreamableArtifact;
import java.io.File;
import java.util.Set;
public class GradleArtifact {
public static Artifact maven(DependencyResolver resolver, ArtifactIdentifier identifier, ArtifactType type) {
Set<File> files = resolver.resolveDependency(
identifier.getGroup()
+ ":" + identifier.getName()
+ ":" + identifier.getVersion()
+ (identifier.getClassifier().isEmpty() ? "" : ":" + identifier.getClassifier())
+ (identifier.getExtension().isEmpty() ? "" : "@" + identifier.getExtension()),
false
);
if (files.isEmpty()) return Artifact.none();
return StreamableArtifact.ofJar(identifier, type, files.iterator().next());
}
}
|