Search in sources :

Example 1 with ProcessResources

use of org.gradle.language.jvm.tasks.ProcessResources in project gradle by gradle.

the class JavaPlugin method configureArchivesAndComponent.

private void configureArchivesAndComponent(Project project, 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 apiElementConfiguration = project.getConfigurations().getByName(API_ELEMENTS_CONFIGURATION_NAME);
    Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);
    Configuration runtimeElementsConfiguration = project.getConfigurations().getByName(RUNTIME_ELEMENTS_CONFIGURATION_NAME);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    JavaCompile javaCompile = (JavaCompile) project.getTasks().getByPath(COMPILE_JAVA_TASK_NAME);
    ProcessResources processResources = (ProcessResources) project.getTasks().getByPath(PROCESS_RESOURCES_TASK_NAME);
    addJar(apiElementConfiguration, jarArtifact);
    addJar(runtimeConfiguration, jarArtifact);
    addRuntimeVariants(runtimeElementsConfiguration, jarArtifact, javaCompile, processResources);
    project.getComponents().add(objectFactory.newInstance(JavaLibrary.class, project.getConfigurations(), jarArtifact));
    project.getComponents().add(objectFactory.newInstance(JavaLibraryPlatform.class, project.getConfigurations()));
}
Also used : DefaultArtifactPublicationSet(org.gradle.api.internal.plugins.DefaultArtifactPublicationSet) ArchivePublishArtifact(org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact) Configuration(org.gradle.api.artifacts.Configuration) JavaLibrary(org.gradle.api.internal.java.JavaLibrary) JavaLibraryPlatform(org.gradle.api.internal.java.JavaLibraryPlatform) ProcessResources(org.gradle.language.jvm.tasks.ProcessResources) Jar(org.gradle.api.tasks.bundling.Jar) JavaCompile(org.gradle.api.tasks.compile.JavaCompile)

Example 2 with ProcessResources

use of org.gradle.language.jvm.tasks.ProcessResources in project gradle by gradle.

the class JavaPlugin method configureArchivesAndComponent.

private void configureArchivesAndComponent(Project project, final JavaPluginExtension pluginExtension) {
    PublishArtifact jarArtifact = new LazyPublishArtifact(registerJarTaskFor(project, pluginExtension), ((ProjectInternal) project).getFileResolver());
    Configuration apiElementConfiguration = project.getConfigurations().getByName(API_ELEMENTS_CONFIGURATION_NAME);
    Configuration runtimeElementsConfiguration = project.getConfigurations().getByName(RUNTIME_ELEMENTS_CONFIGURATION_NAME);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    Provider<ProcessResources> processResources = project.getTasks().named(PROCESS_RESOURCES_TASK_NAME, ProcessResources.class);
    addJar(apiElementConfiguration, jarArtifact);
    addRuntimeVariants(runtimeElementsConfiguration, jarArtifact, mainSourceSetOf(pluginExtension), processResources);
    registerSoftwareComponents(project);
}
Also used : LazyPublishArtifact(org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact) DefaultArtifactPublicationSet(org.gradle.api.internal.plugins.DefaultArtifactPublicationSet) DeprecatableConfiguration(org.gradle.internal.deprecation.DeprecatableConfiguration) Configuration(org.gradle.api.artifacts.Configuration) ProcessResources(org.gradle.language.jvm.tasks.ProcessResources) LazyPublishArtifact(org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact) PublishArtifact(org.gradle.api.artifacts.PublishArtifact)

Aggregations

Configuration (org.gradle.api.artifacts.Configuration)2 DefaultArtifactPublicationSet (org.gradle.api.internal.plugins.DefaultArtifactPublicationSet)2 ProcessResources (org.gradle.language.jvm.tasks.ProcessResources)2 PublishArtifact (org.gradle.api.artifacts.PublishArtifact)1 LazyPublishArtifact (org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact)1 ArchivePublishArtifact (org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact)1 JavaLibrary (org.gradle.api.internal.java.JavaLibrary)1 JavaLibraryPlatform (org.gradle.api.internal.java.JavaLibraryPlatform)1 Jar (org.gradle.api.tasks.bundling.Jar)1 JavaCompile (org.gradle.api.tasks.compile.JavaCompile)1 DeprecatableConfiguration (org.gradle.internal.deprecation.DeprecatableConfiguration)1