Search in sources :

Example 1 with DefaultPublishArtifact

use of org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact 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);
}
Also used : Task(org.gradle.api.Task) DefaultPublishArtifact(org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact) PublishArtifactLocalArtifactMetadata(org.gradle.internal.component.local.model.PublishArtifactLocalArtifactMetadata) DefaultPublishArtifact(org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact) PublishArtifact(org.gradle.api.artifacts.PublishArtifact) File(java.io.File)

Example 2 with DefaultPublishArtifact

use of org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact in project gradle by gradle.

the class IdeaPlugin method createImlArtifact.

private static LocalComponentArtifactMetadata createImlArtifact(ProjectComponentIdentifier projectId, Project project) {
    String moduleName = project.getExtensions().getByType(IdeaModel.class).getModule().getName();
    File imlFile = new File(project.getProjectDir(), moduleName + ".iml");
    Task byName = project.getTasks().getByName("ideaModule");
    PublishArtifact publishArtifact = new DefaultPublishArtifact(moduleName, "iml", "iml", null, null, imlFile, byName);
    return new PublishArtifactLocalArtifactMetadata(projectId, publishArtifact);
}
Also used : Task(org.gradle.api.Task) DefaultPublishArtifact(org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact) PublishArtifactLocalArtifactMetadata(org.gradle.internal.component.local.model.PublishArtifactLocalArtifactMetadata) DefaultPublishArtifact(org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact) PublishArtifact(org.gradle.api.artifacts.PublishArtifact) File(java.io.File)

Example 3 with DefaultPublishArtifact

use of org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact in project gradle by gradle.

the class JvmLocalLibraryMetaDataAdapter method addArtifact.

private static void addArtifact(UsageKind usage, Set<File> directories, EnumMap<UsageKind, List<PublishArtifact>> artifacts, JvmAssembly assembly) {
    List<PublishArtifact> publishArtifacts = artifacts.get(usage);
    for (File dir : directories) {
        DefaultPublishArtifact publishArtifact = new DefaultPublishArtifact("assembly", "", "", "", new Date(dir.lastModified()), dir);
        publishArtifact.builtBy(assembly);
        publishArtifacts.add(publishArtifact);
    }
}
Also used : DefaultPublishArtifact(org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact) PublishArtifact(org.gradle.api.artifacts.PublishArtifact) DefaultPublishArtifact(org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact) JarFile(org.gradle.jvm.internal.JarFile) File(java.io.File) Date(java.util.Date)

Aggregations

File (java.io.File)3 PublishArtifact (org.gradle.api.artifacts.PublishArtifact)3 DefaultPublishArtifact (org.gradle.api.internal.artifacts.publish.DefaultPublishArtifact)3 Task (org.gradle.api.Task)2 PublishArtifactLocalArtifactMetadata (org.gradle.internal.component.local.model.PublishArtifactLocalArtifactMetadata)2 Date (java.util.Date)1 JarFile (org.gradle.jvm.internal.JarFile)1