Skip to content

Commit

Permalink
Use LegacyLevel to detect setMain
Browse files Browse the repository at this point in the history
  • Loading branch information
ysb33r committed Dec 30, 2022
1 parent df63128 commit 9b8c0e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ package org.asciidoctor.gradle.jvm

import org.asciidoctor.gradle.internal.FunctionalSpecification
import org.gradle.testkit.runner.GradleRunner
import org.gradle.testkit.runner.TaskOutcome
import spock.lang.Issue
import spock.lang.Timeout
import spock.lang.Unroll

import static org.asciidoctor.gradle.testfixtures.AsciidoctorjTestVersions.SERIES_20
@java.lang.SuppressWarnings('NoWildcardImports')
import static org.asciidoctor.gradle.testfixtures.JRubyTestVersions.*
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS

class AsciidoctorTaskFunctionalSpec extends FunctionalSpecification {

Expand Down Expand Up @@ -223,7 +221,7 @@ class AsciidoctorTaskFunctionalSpec extends FunctionalSpecification {
@Issue('https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/368')
void 'Docinfo files are processed'() {
given:
getBuildFile( '''
getBuildFile('''
asciidoctor {
attributes docinfo: 'shared'
baseDirFollowsSourceDir()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import static org.asciidoctor.gradle.base.internal.ConfigurationUtils.asConfigur
import static org.gradle.api.tasks.PathSensitivity.RELATIVE
import static org.gradle.workers.IsolationMode.CLASSLOADER
import static org.gradle.workers.IsolationMode.PROCESS
import static org.ysb33r.grolifant.api.core.LegacyLevel.PRE_6_4

/** Base class for all AsciidoctorJ tasks.
*
Expand Down Expand Up @@ -584,7 +585,7 @@ class AbstractAsciidoctorTask extends AbstractAsciidoctorBaseTask {
configureForkOptions(jes)
logger.debug "Running AsciidoctorJ instance with environment: ${jes.environment}"
jes.with {
setExecClass(jes, AsciidoctorJavaExec.canonicalName, project.gradle.gradleVersion)
setExecClass(jes, AsciidoctorJavaExec.canonicalName)
classpath = javaExecClasspath
args execConfigurationData.absolutePath
}
Expand All @@ -606,11 +607,11 @@ class AbstractAsciidoctorTask extends AbstractAsciidoctorBaseTask {
* the mainClass property that was added in 6.4.
*/
@CompileDynamic
private void setExecClass(JavaExecSpec jes, String execClass, String gradleVersion) {
if (gradleVersion >= GradleVersion.version(('6.4'))) {
jes.mainClass = execClass
} else {
private void setExecClass(JavaExecSpec jes, String execClass) {
if (PRE_6_4) {
jes.main = execClass
} else {
jes.mainClass = execClass
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.asciidoctor.gradle.jvm


import org.asciidoctor.gradle.internal.ExecutorConfiguration
import org.gradle.api.Action
import org.gradle.api.GradleException
Expand Down Expand Up @@ -509,8 +508,6 @@ class AsciidoctorTaskSpec extends Specification {
AsciidoctorTask asciidoctorTask(Closure cfg) {
project.tasks.create(name: ASCIIDOCTOR, type: AsciidoctorTask).configure cfg
}
}
class ExecutorConfigurationInspectingAsciidoctorTask extends AsciidoctorTask {
Expand Down

0 comments on commit 9b8c0e8

Please sign in to comment.