Skip to content

Commit

Permalink
Add ability to run build with JDK8, because Gradle Publishing Plugin …
Browse files Browse the repository at this point in the history
…has problems with JDK9...
  • Loading branch information
zyxist committed Oct 7, 2017
1 parent 1fe6cd6 commit 55aa46c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ plugins {
group = 'com.zyxist'
version = '0.1.2'

targetCompatibility = '1.9'
sourceCompatibility = '1.9'
targetCompatibility = '1.8'
sourceCompatibility = '1.8'

// Fix a bad interaction with IntelliJ and Gradle > 4.0
idea.module.inheritOutputDirs = true
Expand Down Expand Up @@ -37,7 +37,7 @@ pluginBundle {
website = 'https://github.com/zyxist/chainsaw'
vcsUrl = 'https://github.com/zyxist/chainsaw'
plugins {
experimentalJigsawPlugin {
chainsawPlugin {
id = 'com.zyxist.chainsaw'
displayName = 'Chainsaw: Java 9 Jigsaw support'
description = 'A plugin that adds the support for building and testing modular JDK9 applications with Gradle. '
Expand Down
4 changes: 4 additions & 0 deletions src/test/groovy/com/zyxist/chainsaw/ChainsawPluginSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
class ChainsawPluginSpec extends Specification {
@Rule
final TemporaryFolder tmpDir = new TemporaryFolder()
static final NOT_JAVA_9 = !System.getProperty("java.version").startsWith("9")

def setup() {
def buildFile = tmpDir.newFile("build.gradle")
Expand Down Expand Up @@ -96,6 +97,7 @@ public class AClassTest {
"""
}

@IgnoreIf({NOT_JAVA_9})
def "can assemble a module"() {
when:
def result = GradleRunner.create()
Expand All @@ -111,6 +113,7 @@ public class AClassTest {
new File(tmpDir.root, "build/classes/java/main/com/example/AClass.class").exists()
}

@IgnoreIf({NOT_JAVA_9})
def "can check a module"() {
when:
def result = GradleRunner.create()
Expand All @@ -124,6 +127,7 @@ public class AClassTest {
result.task(":test").outcome == SUCCESS
}

@IgnoreIf({NOT_JAVA_9})
def "can run with a module"() {
when:
def result = GradleRunner.create()
Expand Down
4 changes: 4 additions & 0 deletions src/test/groovy/com/zyxist/chainsaw/JUnit4TestSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ package com.zyxist.chainsaw
import org.gradle.testkit.runner.GradleRunner
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import spock.lang.IgnoreIf
import spock.lang.Specification

import static org.gradle.testkit.runner.TaskOutcome.SUCCESS

class JUnit4TestSpec extends Specification {
final static MOCKITO_MODULE = 'mockito.core'
static final NOT_JAVA_9 = !System.getProperty("java.version").startsWith("9")

@Rule
final TemporaryFolder tmpDir = new TemporaryFolder()
Expand Down Expand Up @@ -80,6 +82,7 @@ public class AClassTest {
"""
}

@IgnoreIf({NOT_JAVA_9})
def "run JUnit4 tests with Mockito - java plugin way"() {
given:
def buildFile = tmpDir.newFile("build.gradle")
Expand Down Expand Up @@ -113,6 +116,7 @@ javaModule.extraTestModules = ['${MOCKITO_MODULE}']
result.task(":test").outcome == SUCCESS
}

@IgnoreIf({NOT_JAVA_9})
def "run JUnit4 tests with Mockito - new way"() {
given:
def buildFile = tmpDir.newFile("build.gradle")
Expand Down
4 changes: 4 additions & 0 deletions src/test/groovy/com/zyxist/chainsaw/JUnit5TestSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ package com.zyxist.chainsaw
import org.gradle.testkit.runner.GradleRunner
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import spock.lang.IgnoreIf
import spock.lang.Specification

import static org.gradle.testkit.runner.TaskOutcome.SUCCESS

class JUnit5TestSpec extends Specification {
final static MOCKITO_MODULE = 'mockito.core'
static final NOT_JAVA_9 = !System.getProperty("java.version").startsWith("9")

@Rule
final TemporaryFolder tmpDir = new TemporaryFolder()
Expand Down Expand Up @@ -80,6 +82,7 @@ public class AClassTest {
"""
}

@IgnoreIf({NOT_JAVA_9})
def "run JUnit5 tests with Mockito - java plugin way"() {
given:
def buildFile = tmpDir.newFile("build.gradle")
Expand Down Expand Up @@ -127,6 +130,7 @@ javaModule.extraTestModules = ['${MOCKITO_MODULE}']
result.task(":junitPlatformTest").outcome == SUCCESS
}

@IgnoreIf({NOT_JAVA_9})
def "run JUnit5 tests with Mockito - new way"() {
given:
def buildFile = tmpDir.newFile("build.gradle")
Expand Down

0 comments on commit 55aa46c

Please sign in to comment.