Skip to content

Commit

Permalink
all: add jdk8 and 14 builds
Browse files Browse the repository at this point in the history
Added support for building an running with jdk14 and 8.   14 requires building with bytecode for java 7, so the target level must be raised for testing.  8 does not support building java 9 classes, so must be disabled.   These are mainly for testing.  Release will still be built with JDK 11, which supports both.
  • Loading branch information
carl-mastrangelo committed Apr 5, 2020
1 parent defa491 commit 9fe7f12
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 18 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
@@ -1,7 +1,11 @@
language: java

jdk:
- openjdk11
matrix:
include:
- jdk: openjdk8
- jdk: openjdk11
- jdk: openjdk14


notifications:
email: false
Expand Down
10 changes: 8 additions & 2 deletions agent/build.gradle
Expand Up @@ -16,9 +16,15 @@ dependencies {

}

import net.ltgt.gradle.errorprone.CheckSeverity

compileTestJava {
sourceCompatibility = 1.9
targetCompatibility = 1.9
// Broken in JDK12+. See https://github.com/google/error-prone/issues/1106
properties.put("errorProne", "false")
options.errorprone.check("SameNameButDifferent", CheckSeverity.OFF)

sourceCompatibility = 1.8
targetCompatibility = 1.8
}

jar {
Expand Down
Expand Up @@ -27,7 +27,9 @@
import io.perfmark.impl.Internal;
import io.perfmark.impl.Mark;
import io.perfmark.impl.Storage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.util.List;
import java.util.concurrent.Executor;
Expand Down Expand Up @@ -329,7 +331,16 @@ public void transform_toplevel() throws Exception {

private static byte[] getBytes(Class<?> clz) throws IOException {
String className = clz.getName().replace('.', '/') + ".class";
return clz.getClassLoader().getResourceAsStream(className).readAllBytes();
try (InputStream stream = clz.getClassLoader().getResourceAsStream(className);
ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
int read;
byte[] buf = new byte[1024];
while ((read = stream.read(buf)) != -1) {
baos.write(buf, 0, read);
}

return baos.toByteArray();
}
}

private static final class TestClassLoader extends ClassLoader {
Expand Down
14 changes: 9 additions & 5 deletions api/build.gradle
@@ -1,7 +1,12 @@
description = "PerfMark API"

sourceCompatibility = 1.6
targetCompatibility = 1.6
if (JavaVersion.current().isJava12Compatible()) {
sourceCompatibility = 1.7
targetCompatibility = 1.7
} else {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}

dependencies {
compileOnly libraries.jsr305,
Expand All @@ -14,15 +19,14 @@ dependencies {
project(':perfmark-java7')
}


compileTestJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}

compileJmhJava {
sourceCompatibility = 1.9
targetCompatibility = 1.9
sourceCompatibility = 1.8
targetCompatibility = 1.8
}

java {
Expand Down
5 changes: 1 addition & 4 deletions build.gradle
@@ -1,6 +1,5 @@
buildscript {
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
jcenter()
}
Expand Down Expand Up @@ -28,7 +27,6 @@ subprojects {
maven {
url "https://maven-central.storage-download.googleapis.com/repos/central/data/" }
mavenCentral()
mavenLocal()
}


Expand Down Expand Up @@ -108,7 +106,6 @@ subprojects {
}
}
}
mavenLocal()
}
}

Expand Down Expand Up @@ -138,7 +135,7 @@ subprojects {
}
}

jacoco { toolVersion = "0.8.2" }
jacoco { toolVersion = "0.8.5" }

group = "io.perfmark"
version = "0.22.0-SNAPSHOT"
Expand Down
9 changes: 7 additions & 2 deletions impl/build.gradle
@@ -1,7 +1,12 @@
description = "PerfMark Implementation API"

sourceCompatibility = 1.6
targetCompatibility = 1.6
if (JavaVersion.current().isJava12Compatible()) {
sourceCompatibility = 1.7
targetCompatibility = 1.7
} else {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}

dependencies {
implementation project(':perfmark-api')
Expand Down
9 changes: 7 additions & 2 deletions java6/build.gradle
@@ -1,7 +1,12 @@
description = "PerfMark Java6 API"

sourceCompatibility = 1.6
targetCompatibility = 1.6
if (JavaVersion.current().isJava12Compatible()) {
sourceCompatibility = 1.7
targetCompatibility = 1.7
} else {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}

dependencies {
implementation project(':perfmark-impl')
Expand Down
6 changes: 6 additions & 0 deletions java9/build.gradle
Expand Up @@ -2,6 +2,12 @@ apply plugin: 'jcstress'

description = "PerfMark Java9 API"

if (!JavaVersion.current().isJava9Compatible()) {
project.tasks.all {
task -> task.enabled = false
}
}

sourceCompatibility = 1.9
targetCompatibility = 1.9

Expand Down

0 comments on commit 9fe7f12

Please sign in to comment.