org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact Java Examples

The following examples show how to use org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
    Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
    jar.getManifest().from(pluginConvention.getManifest());
    jar.setDescription("Assembles a jar archive containing the main classes.");
    jar.setGroup(BasePlugin.BUILD_GROUP);
    jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());
    jar.getMetaInf().from(new Callable() {
        public Object call() throws Exception {
            return pluginConvention.getMetaInf();
        }
    });

    ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
    Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);

    runtimeConfiguration.getArtifacts().add(jarArtifact);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
}
 
Example #2
Source File: JavaPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
    Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
    jar.getManifest().from(pluginConvention.getManifest());
    jar.setDescription("Assembles a jar archive containing the main classes.");
    jar.setGroup(BasePlugin.BUILD_GROUP);
    jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());
    jar.getMetaInf().from(new Callable() {
        public Object call() throws Exception {
            return pluginConvention.getMetaInf();
        }
    });

    ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
    Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);

    runtimeConfiguration.getArtifacts().add(jarArtifact);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
}
 
Example #3
Source File: AndroidComponetCreator.java    From atlas with Apache License 2.0 5 votes vote down vote up
public void createAndroidComponent(Zip bundleTask) {
    //Add a components. Android
    if (atlasExtension.getBundleConfig().isAwbBundle()) {
        Configuration compileConfiguration = project.getConfigurations()
            .getByName(COMPILE_CONFIGURATION_NAME);
        ArchivePublishArtifact bundleArtifact = new ArchivePublishArtifact(bundleTask);
        compileConfiguration.getArtifacts().add(bundleArtifact);
    }
}
 
Example #4
Source File: WarPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void apply(final Project project) {
    project.getPlugins().apply(JavaPlugin.class);
    final WarPluginConvention pluginConvention = new WarPluginConvention(project);
    project.getConvention().getPlugins().put("war", pluginConvention);

    project.getTasks().withType(War.class, new Action<War>() {
        public void execute(War task) {
            task.from(new Callable() {
                public Object call() throws Exception {
                    return pluginConvention.getWebAppDir();
                }
            });
            task.dependsOn(new Callable() {
                public Object call() throws Exception {
                    return project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName(
                            SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                }
            });
            task.classpath(new Object[] {new Callable() {
                public Object call() throws Exception {
                    FileCollection runtimeClasspath = project.getConvention().getPlugin(JavaPluginConvention.class)
                            .getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                    Configuration providedRuntime = project.getConfigurations().getByName(
                            PROVIDED_RUNTIME_CONFIGURATION_NAME);
                    return runtimeClasspath.minus(providedRuntime);
                }
            }});
        }
    });
    
    War war = project.getTasks().create(WAR_TASK_NAME, War.class);
    war.setDescription("Generates a war archive with all the compiled classes, the web-app content and the libraries.");
    war.setGroup(BasePlugin.BUILD_GROUP);
    ArchivePublishArtifact warArtifact = new ArchivePublishArtifact(war);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(warArtifact);
    configureConfigurations(project.getConfigurations());
    configureComponent(project, warArtifact);
}
 
Example #5
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTaskPath(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        return ((ArchivePublishArtifact) artifact).getArchiveTask().getPath();
    } else {
        String taskPath = null;
        Set<? extends Task> tasks = artifact.getBuildDependencies().getDependencies(null);
        if (!tasks.isEmpty()) {
            taskPath = tasks.iterator().next().getPath();
        }
        return taskPath;
    }
}
 
Example #6
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTypeIdentifier(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
        AbstractArchiveTask task = publishArtifact.getArchiveTask();

        // There is an inheritance hierarchy in play here, so the order
        // of the clauses is very important.

        if (task instanceof War) {
            return WAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Ear) {
            return EAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Jar) {
            return JAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Zip) {
            return ZIP_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Tar) {
            return TAR_ARTIFACT.getTypeIdentifier();
        } else {
            // we don't know about this kind of archive task
            return ARCHIVE_ARTIFACT.getTypeIdentifier();
        }
    } else {
        // This could very well be a zip (or something else we understand), but we can't know for sure.
        // The client may try to infer from the file extension.
        return UNKNOWN_ARTIFACT.getTypeIdentifier();
    }
}
 
Example #7
Source File: EarPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setupEarTask(final Project project, EarPluginConvention convention) {
    Ear ear = project.getTasks().create(EAR_TASK_NAME, Ear.class);
    ear.setDescription("Generates a ear archive with all the modules, the application descriptor and the libraries.");
    DeploymentDescriptor deploymentDescriptor = convention.getDeploymentDescriptor();
    if (deploymentDescriptor != null) {
        if (deploymentDescriptor.getDisplayName() == null) {
            deploymentDescriptor.setDisplayName(project.getName());
        }
        if (deploymentDescriptor.getDescription() == null) {
            deploymentDescriptor.setDescription(project.getDescription());
        }
    }
    ear.setGroup(BasePlugin.BUILD_GROUP);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(new ArchivePublishArtifact(ear));

    project.getTasks().withType(Ear.class, new Action<Ear>() {
        public void execute(Ear task) {
            task.getLib().from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    return project.getConfigurations().getByName(EARLIB_CONFIGURATION_NAME);
                }
            });
            task.from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    // add the module configuration's files
                    return project.getConfigurations().getByName(DEPLOY_CONFIGURATION_NAME);
                }
            });
        }
    });
}
 
Example #8
Source File: WarPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void apply(final Project project) {
    project.getPlugins().apply(JavaPlugin.class);
    final WarPluginConvention pluginConvention = new WarPluginConvention(project);
    project.getConvention().getPlugins().put("war", pluginConvention);

    project.getTasks().withType(War.class, new Action<War>() {
        public void execute(War task) {
            task.from(new Callable() {
                public Object call() throws Exception {
                    return pluginConvention.getWebAppDir();
                }
            });
            task.dependsOn(new Callable() {
                public Object call() throws Exception {
                    return project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName(
                            SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                }
            });
            task.classpath(new Object[] {new Callable() {
                public Object call() throws Exception {
                    FileCollection runtimeClasspath = project.getConvention().getPlugin(JavaPluginConvention.class)
                            .getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                    Configuration providedRuntime = project.getConfigurations().getByName(
                            PROVIDED_RUNTIME_CONFIGURATION_NAME);
                    return runtimeClasspath.minus(providedRuntime);
                }
            }});
        }
    });
    
    War war = project.getTasks().create(WAR_TASK_NAME, War.class);
    war.setDescription("Generates a war archive with all the compiled classes, the web-app content and the libraries.");
    war.setGroup(BasePlugin.BUILD_GROUP);
    ArchivePublishArtifact warArtifact = new ArchivePublishArtifact(war);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(warArtifact);
    configureConfigurations(project.getConfigurations());
    configureComponent(project, warArtifact);
}
 
Example #9
Source File: JavaPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
    Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
    jar.setDescription("Assembles a jar archive containing the main classes.");
    jar.setGroup(BasePlugin.BUILD_GROUP);
    jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());

    ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
    Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);

    runtimeConfiguration.getArtifacts().add(jarArtifact);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
}
 
Example #10
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTaskPath(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        return ((ArchivePublishArtifact) artifact).getArchiveTask().getPath();
    } else {
        String taskPath = null;
        Set<? extends Task> tasks = artifact.getBuildDependencies().getDependencies(null);
        if (!tasks.isEmpty()) {
            taskPath = tasks.iterator().next().getPath();
        }
        return taskPath;
    }
}
 
Example #11
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTypeIdentifier(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
        AbstractArchiveTask task = publishArtifact.getArchiveTask();

        // There is an inheritance hierarchy in play here, so the order
        // of the clauses is very important.

        if (task instanceof War) {
            return WAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Ear) {
            return EAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Jar) {
            return JAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Zip) {
            return ZIP_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Tar) {
            return TAR_ARTIFACT.getTypeIdentifier();
        } else {
            // we don't know about this kind of archive task
            return ARCHIVE_ARTIFACT.getTypeIdentifier();
        }
    } else {
        // This could very well be a zip (or something else we understand), but we can't know for sure.
        // The client may try to infer from the file extension.
        return UNKNOWN_ARTIFACT.getTypeIdentifier();
    }
}
 
Example #12
Source File: EarPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setupEarTask(final Project project, EarPluginConvention convention) {
    Ear ear = project.getTasks().create(EAR_TASK_NAME, Ear.class);
    ear.setDescription("Generates a ear archive with all the modules, the application descriptor and the libraries.");
    DeploymentDescriptor deploymentDescriptor = convention.getDeploymentDescriptor();
    if (deploymentDescriptor != null) {
        if (deploymentDescriptor.getDisplayName() == null) {
            deploymentDescriptor.setDisplayName(project.getName());
        }
        if (deploymentDescriptor.getDescription() == null) {
            deploymentDescriptor.setDescription(project.getDescription());
        }
    }
    ear.setGroup(BasePlugin.BUILD_GROUP);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(new ArchivePublishArtifact(ear));

    project.getTasks().withType(Ear.class, new Action<Ear>() {
        public void execute(Ear task) {
            task.getLib().from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    return project.getConfigurations().getByName(EARLIB_CONFIGURATION_NAME);
                }
            });
            task.from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    // add the module configuration's files
                    return project.getConfigurations().getByName(DEPLOY_CONFIGURATION_NAME);
                }
            });
        }
    });
}
 
Example #13
Source File: EarPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setupEarTask(final Project project, EarPluginConvention convention) {
    Ear ear = project.getTasks().create(EAR_TASK_NAME, Ear.class);
    ear.setDescription("Generates a ear archive with all the modules, the application descriptor and the libraries.");
    DeploymentDescriptor deploymentDescriptor = convention.getDeploymentDescriptor();
    if (deploymentDescriptor != null) {
        if (deploymentDescriptor.getDisplayName() == null) {
            deploymentDescriptor.setDisplayName(project.getName());
        }
        if (deploymentDescriptor.getDescription() == null) {
            deploymentDescriptor.setDescription(project.getDescription());
        }
    }
    ear.setGroup(BasePlugin.BUILD_GROUP);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(new ArchivePublishArtifact(ear));

    project.getTasks().withType(Ear.class, new Action<Ear>() {
        public void execute(Ear task) {
            task.getLib().from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    return project.getConfigurations().getByName(EARLIB_CONFIGURATION_NAME);
                }
            });
            task.from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    // add the module configuration's files
                    return project.getConfigurations().getByName(DEPLOY_CONFIGURATION_NAME);
                }
            });
        }
    });
}
 
Example #14
Source File: WarPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void apply(final Project project) {
    project.getPlugins().apply(JavaPlugin.class);
    final WarPluginConvention pluginConvention = new WarPluginConvention(project);
    project.getConvention().getPlugins().put("war", pluginConvention);

    project.getTasks().withType(War.class, new Action<War>() {
        public void execute(War task) {
            task.from(new Callable() {
                public Object call() throws Exception {
                    return pluginConvention.getWebAppDir();
                }
            });
            task.dependsOn(new Callable() {
                public Object call() throws Exception {
                    return project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName(
                            SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                }
            });
            task.classpath(new Object[] {new Callable() {
                public Object call() throws Exception {
                    FileCollection runtimeClasspath = project.getConvention().getPlugin(JavaPluginConvention.class)
                            .getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                    Configuration providedRuntime = project.getConfigurations().getByName(
                            PROVIDED_RUNTIME_CONFIGURATION_NAME);
                    return runtimeClasspath.minus(providedRuntime);
                }
            }});
        }
    });
    
    War war = project.getTasks().create(WAR_TASK_NAME, War.class);
    war.setDescription("Generates a war archive with all the compiled classes, the web-app content and the libraries.");
    war.setGroup(BasePlugin.BUILD_GROUP);
    ArchivePublishArtifact warArtifact = new ArchivePublishArtifact(war);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(warArtifact);
    configureConfigurations(project.getConfigurations());
    configureComponent(project, warArtifact);
}
 
Example #15
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTaskPath(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        return ((ArchivePublishArtifact) artifact).getArchiveTask().getPath();
    } else {
        String taskPath = null;
        Set<? extends Task> tasks = artifact.getBuildDependencies().getDependencies(null);
        if (!tasks.isEmpty()) {
            taskPath = tasks.iterator().next().getPath();
        }
        return taskPath;
    }
}
 
Example #16
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTypeIdentifier(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
        AbstractArchiveTask task = publishArtifact.getArchiveTask();

        // There is an inheritance hierarchy in play here, so the order
        // of the clauses is very important.

        if (task instanceof War) {
            return WAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Ear) {
            return EAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Jar) {
            return JAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Zip) {
            return ZIP_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Tar) {
            return TAR_ARTIFACT.getTypeIdentifier();
        } else {
            // we don't know about this kind of archive task
            return ARCHIVE_ARTIFACT.getTypeIdentifier();
        }
    } else {
        // This could very well be a zip (or something else we understand), but we can't know for sure.
        // The client may try to infer from the file extension.
        return UNKNOWN_ARTIFACT.getTypeIdentifier();
    }
}
 
Example #17
Source File: EarPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setupEarTask(final Project project, EarPluginConvention convention) {
    Ear ear = project.getTasks().create(EAR_TASK_NAME, Ear.class);
    ear.setDescription("Generates a ear archive with all the modules, the application descriptor and the libraries.");
    DeploymentDescriptor deploymentDescriptor = convention.getDeploymentDescriptor();
    if (deploymentDescriptor != null) {
        if (deploymentDescriptor.getDisplayName() == null) {
            deploymentDescriptor.setDisplayName(project.getName());
        }
        if (deploymentDescriptor.getDescription() == null) {
            deploymentDescriptor.setDescription(project.getDescription());
        }
    }
    ear.setGroup(BasePlugin.BUILD_GROUP);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(new ArchivePublishArtifact(ear));

    project.getTasks().withType(Ear.class, new Action<Ear>() {
        public void execute(Ear task) {
            task.getLib().from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    return project.getConfigurations().getByName(EARLIB_CONFIGURATION_NAME);
                }
            });
            task.from(new Callable<FileCollection>() {
                public FileCollection call() throws Exception {
                    // add the module configuration's files
                    return project.getConfigurations().getByName(DEPLOY_CONFIGURATION_NAME);
                }
            });
        }
    });
}
 
Example #18
Source File: WarPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void apply(final Project project) {
    project.getPlugins().apply(JavaPlugin.class);
    final WarPluginConvention pluginConvention = new WarPluginConvention(project);
    project.getConvention().getPlugins().put("war", pluginConvention);

    project.getTasks().withType(War.class, new Action<War>() {
        public void execute(War task) {
            task.from(new Callable() {
                public Object call() throws Exception {
                    return pluginConvention.getWebAppDir();
                }
            });
            task.dependsOn(new Callable() {
                public Object call() throws Exception {
                    return project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName(
                            SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                }
            });
            task.classpath(new Object[] {new Callable() {
                public Object call() throws Exception {
                    FileCollection runtimeClasspath = project.getConvention().getPlugin(JavaPluginConvention.class)
                            .getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRuntimeClasspath();
                    Configuration providedRuntime = project.getConfigurations().getByName(
                            PROVIDED_RUNTIME_CONFIGURATION_NAME);
                    return runtimeClasspath.minus(providedRuntime);
                }
            }});
        }
    });
    
    War war = project.getTasks().create(WAR_TASK_NAME, War.class);
    war.setDescription("Generates a war archive with all the compiled classes, the web-app content and the libraries.");
    war.setGroup(BasePlugin.BUILD_GROUP);
    ArchivePublishArtifact warArtifact = new ArchivePublishArtifact(war);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(warArtifact);
    configureConfigurations(project.getConfigurations());
    configureComponent(project, warArtifact);
}
 
Example #19
Source File: JavaPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
    Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
    jar.setDescription("Assembles a jar archive containing the main classes.");
    jar.setGroup(BasePlugin.BUILD_GROUP);
    jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());

    ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
    Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);

    runtimeConfiguration.getArtifacts().add(jarArtifact);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
}
 
Example #20
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTaskPath(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        return ((ArchivePublishArtifact) artifact).getArchiveTask().getPath();
    } else {
        String taskPath = null;
        Set<? extends Task> tasks = artifact.getBuildDependencies().getDependencies(null);
        if (!tasks.isEmpty()) {
            taskPath = tasks.iterator().next().getPath();
        }
        return taskPath;
    }
}
 
Example #21
Source File: PublishArtifactToFileBuildOutcomeTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private String getTypeIdentifier(PublishArtifact artifact) {
    if (artifact instanceof ArchivePublishArtifact) {
        ArchivePublishArtifact publishArtifact = (ArchivePublishArtifact) artifact;
        AbstractArchiveTask task = publishArtifact.getArchiveTask();

        // There is an inheritance hierarchy in play here, so the order
        // of the clauses is very important.

        if (task instanceof War) {
            return WAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Ear) {
            return EAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Jar) {
            return JAR_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Zip) {
            return ZIP_ARTIFACT.getTypeIdentifier();
        } else if (task instanceof Tar) {
            return TAR_ARTIFACT.getTypeIdentifier();
        } else {
            // we don't know about this kind of archive task
            return ARCHIVE_ARTIFACT.getTypeIdentifier();
        }
    } else {
        // This could very well be a zip (or something else we understand), but we can't know for sure.
        // The client may try to infer from the file extension.
        return UNKNOWN_ARTIFACT.getTypeIdentifier();
    }
}
 
Example #22
Source File: PublishArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected PublishArtifact parseType(AbstractArchiveTask notation) {
    return instantiator.newInstance(ArchivePublishArtifact.class, notation);
}
 
Example #23
Source File: PublishArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected PublishArtifact parseType(AbstractArchiveTask notation) {
    return instantiator.newInstance(ArchivePublishArtifact.class, notation);
}
 
Example #24
Source File: PublishArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected PublishArtifact parseType(AbstractArchiveTask notation) {
    return instantiator.newInstance(ArchivePublishArtifact.class, notation);
}
 
Example #25
Source File: PublishArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected PublishArtifact parseType(AbstractArchiveTask notation) {
    return instantiator.newInstance(ArchivePublishArtifact.class, notation);
}