Skip to content

Commit

Permalink
Roll back setting main class in manifest
Browse files Browse the repository at this point in the history
This change can be considered breaking and is postponed to Gradle 7.0.

Fixes #13057
  • Loading branch information
ljacomet committed May 15, 2020
1 parent e2b7721 commit 6c00c57
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -18,6 +18,7 @@ package org.gradle.api.tasks

import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import org.gradle.integtests.fixtures.ToBeFixedForInstantExecution
import spock.lang.Ignore
import spock.lang.Issue

class JavaExecWithExecutableJarIntegrationTest extends AbstractIntegrationSpec {
Expand Down Expand Up @@ -101,6 +102,7 @@ class JavaExecWithExecutableJarIntegrationTest extends AbstractIntegrationSpec {
file("out.txt").text == """helloworld"""
}

@Ignore("Change rolled back, to be added again in 7.0")
@ToBeFixedForInstantExecution(because = "Task.getProject() during execution")
def "can run JavaExec with an executable jar configured in the application plugin"() {

Expand All @@ -118,6 +120,7 @@ class JavaExecWithExecutableJarIntegrationTest extends AbstractIntegrationSpec {
file("out.txt").text == """helloworld"""
}

@Ignore("Change rolled back, to be added again in 7.0")
@ToBeFixedForInstantExecution
def "can run javaexec with executable jar configured in the application plugin"() {

Expand Down
Expand Up @@ -69,7 +69,6 @@ public void apply(final Project project) {
addRunTask(project, pluginExtension, pluginConvention);
addCreateScriptsTask(project, pluginExtension, pluginConvention);
configureJavaCompileTask(tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile.class), pluginExtension);
configureJarTask(tasks.named(JavaPlugin.JAR_TASK_NAME, Jar.class), pluginExtension);
configureInstallTask(tasks.named(TASK_INSTALL_NAME, Sync.class), pluginConvention);

DistributionContainer distributions = (DistributionContainer) project.getExtensions().getByName("distributions");
Expand All @@ -81,6 +80,7 @@ private void configureJavaCompileTask(TaskProvider<JavaCompile> javaCompile, Jav
javaCompile.configure(j -> j.getOptions().getJavaModuleMainClass().convention(pluginExtension.getMainClass()));
}

// Enable this back for Gradle 7.0
private void configureJarTask(TaskProvider<Jar> jar, JavaApplication pluginExtension) {
jar.configure(j -> j.getManifest().attributes(Collections.singletonMap("Main-Class", pluginExtension.getMainClass())));
}
Expand Down

0 comments on commit 6c00c57

Please sign in to comment.