Skip to content

Commit

Permalink
Merge pull request #778 from DataDog/mar-kolya/some-java11-prep
Browse files Browse the repository at this point in the history
Mar kolya/some java11 prep
  • Loading branch information
mar-kolya authored Mar 27, 2019
2 parents e4dcabe + 75643fe commit 722e6c4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def groovyVer = "2.5.2"
def groovyVer = "2.5.3"
def spockGroovyVer = groovyVer.replaceAll(/\.\d+$/, '')

ext {
Expand All @@ -15,7 +15,7 @@ ext {
logback : "1.2.3",
lombok : "1.18.4",
bytebuddy : "1.9.9",
scala : "2.11.12",
scala : "2.11.12", // Last version to support Java 7 (2.12+ require Java 8+)
kotlin : "1.3.11",
coroutines : "1.1.0"
]
Expand Down
15 changes: 13 additions & 2 deletions gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ if (project.parent && project.parent.hasProperty("javaExecutableVersionCache"))
project.ext.javaExecutableVersionCache = [:]
}

def getJavaExecutableVersion(String path) {
JavaVersion getJavaExecutableVersion(String path) {
def cache = project.ext.javaExecutableVersionCache

if (cache.containsKey(path)) {
Expand Down Expand Up @@ -221,14 +221,25 @@ for (def env : System.getenv().entrySet()) {
def javaPath = "$javaHome/bin/java"
def javaVersion = getJavaExecutableVersion(javaPath)

// This is slightly complicated because we need to dereference symlinks to make sure
// we are considering same JVM implementation
def currentJavaHome = new File(System.getProperty("java.home")).toPath().toRealPath()
if (currentJavaHome.endsWith("jre")) {
currentJavaHome = currentJavaHome.parent
}
if (currentJavaHome == new File(javaHome).toPath().toRealPath()) {
// Skip JVM implementation we are running gradle on
continue
}

def parentTask = task "testJava${javaName}"() {
group = 'Verification'
description = "Run tests for Java ${javaName}"
}
tasks.check.dependsOn parentTask

tasks.withType(Test).configureEach {
// if (name.endsWith("Generated")) {
//if (name.endsWith("Generated")) {
if (!name.equals("test")) {
// The way we're copying the test doesn't currently work with "test-sets" generated tests.
return
Expand Down
10 changes: 10 additions & 0 deletions gradle/test-with-scala.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

apply plugin: 'scala'

configurations {
all {
if (it.name != "zinc") {
resolutionStrategy {
force deps.scala
}
}
}
}

compileTestGroovy {
classpath = classpath.plus(files(compileTestScala.destinationDir))
dependsOn compileTestScala
Expand Down

0 comments on commit 722e6c4

Please sign in to comment.