use of org.gradle.api.artifacts.PublishArtifact in project gradle by gradle.
the class EclipsePlugin method createArtifact.
private static LocalComponentArtifactMetadata createArtifact(String extension, ProjectComponentIdentifier projectId, String projectName, Project project) {
File projectFile = new File(project.getProjectDir(), "." + extension);
Task byName = project.getTasks().getByName("eclipseProject");
String type = "eclipse." + extension;
PublishArtifact publishArtifact = new DefaultPublishArtifact(projectName, extension, type, null, null, projectFile, byName);
return new PublishArtifactLocalArtifactMetadata(projectId, publishArtifact);
}
use of org.gradle.api.artifacts.PublishArtifact in project gradle by gradle.
the class JvmLocalLibraryMetaDataAdapter method createResolvedMetaData.
private DefaultLibraryLocalComponentMetadata createResolvedMetaData(BinarySpecInternal selectedBinary, String projectPath, EnumMap<UsageKind, Iterable<DependencySpec>> dependenciesPerUsage, EnumMap<UsageKind, List<PublishArtifact>> artifacts) {
DefaultLibraryLocalComponentMetadata metadata = newResolvedLibraryMetadata(selectedBinary.getId(), toStringMap(dependenciesPerUsage), projectPath);
for (Map.Entry<UsageKind, List<PublishArtifact>> entry : artifacts.entrySet()) {
UsageKind usage = entry.getKey();
final List<PublishArtifact> publishArtifacts = entry.getValue();
metadata.addArtifacts(usage.getConfigurationName(), publishArtifacts);
metadata.addVariant(usage.getConfigurationName(), new OutgoingVariant() {
@Override
public AttributeContainerInternal getAttributes() {
return ImmutableAttributes.EMPTY;
}
@Override
public Set<? extends PublishArtifact> getArtifacts() {
return new LinkedHashSet<PublishArtifact>(publishArtifacts);
}
@Override
public Set<? extends OutgoingVariant> getChildren() {
return ImmutableSet.of();
}
});
}
return metadata;
}
use of org.gradle.api.artifacts.PublishArtifact in project gradle by gradle.
the class JvmLocalLibraryMetaDataAdapter method createLocalComponentMetaData.
@Override
@SuppressWarnings("unchecked")
public DefaultLibraryLocalComponentMetadata createLocalComponentMetaData(Binary selectedBinary, String projectPath, boolean toAssembly) {
EnumMap<UsageKind, Iterable<DependencySpec>> dependenciesPerUsage = new EnumMap<UsageKind, Iterable<DependencySpec>>(UsageKind.class);
EnumMap<UsageKind, List<PublishArtifact>> artifacts = new EnumMap<UsageKind, List<PublishArtifact>>(UsageKind.class);
initializeUsages(dependenciesPerUsage, artifacts);
if (selectedBinary instanceof JarBinarySpecInternal) {
JarBinarySpecInternal jarBinarySpec = (JarBinarySpecInternal) selectedBinary;
createJarBinarySpecLocalComponentMetaData(artifacts, jarBinarySpec, dependenciesPerUsage, toAssembly);
}
if (selectedBinary instanceof WithJvmAssembly) {
// a local component that provides a JVM assembly
JvmAssembly assembly = ((WithJvmAssembly) selectedBinary).getAssembly();
createJvmAssemblyLocalComponentMetaData(artifacts, assembly, dependenciesPerUsage, toAssembly);
}
return createResolvedMetaData((BinarySpecInternal) selectedBinary, projectPath, dependenciesPerUsage, artifacts);
}
use of org.gradle.api.artifacts.PublishArtifact in project gradle by gradle.
the class DefaultConfiguration method dump.
/**
* Print a formatted representation of a Configuration
*/
public String dump() {
StringBuilder reply = new StringBuilder();
reply.append("\nConfiguration:");
reply.append(" class='" + this.getClass() + "'");
reply.append(" name='" + this.getName() + "'");
reply.append(" hashcode='" + this.hashCode() + "'");
reply.append("\nLocal Dependencies:");
if (getDependencies().size() > 0) {
for (Dependency d : getDependencies()) {
reply.append("\n " + d);
}
} else {
reply.append("\n none");
}
reply.append("\nLocal Artifacts:");
if (getArtifacts().size() > 0) {
for (PublishArtifact a : getArtifacts()) {
reply.append("\n " + a);
}
} else {
reply.append("\n none");
}
reply.append("\nAll Dependencies:");
if (getAllDependencies().size() > 0) {
for (Dependency d : getAllDependencies()) {
reply.append("\n " + d);
}
} else {
reply.append("\n none");
}
reply.append("\nAll Artifacts:");
if (getAllArtifacts().size() > 0) {
for (PublishArtifact a : getAllArtifacts()) {
reply.append("\n " + a);
}
} else {
reply.append("\n none");
}
return reply.toString();
}
use of org.gradle.api.artifacts.PublishArtifact in project gradle by gradle.
the class Sign method sign.
/**
* Configures the task to sign every artifact of the given configurations
*/
public void sign(Configuration... configurations) {
for (Configuration configuration : configurations) {
configuration.getAllArtifacts().all(new Action<PublishArtifact>() {
@Override
public void execute(PublishArtifact artifact) {
if (artifact instanceof Signature) {
return;
}
signArtifact(artifact);
}
});
configuration.getAllArtifacts().whenObjectRemoved(new Action<PublishArtifact>() {
@Override
public void execute(final PublishArtifact publishArtifact) {
signatures.remove(Iterables.find(signatures, new Predicate<Signature>() {
@Override
public boolean apply(Signature input) {
return input.getToSignArtifact().equals(publishArtifact);
}
}));
}
});
}
}
Aggregations