Skip to content

Commit 2d1031a

Browse files
authored
[build] update to build on Java 11 with targetJVM 1.8 (ExpediaGroup#1254)
* [build] update to build on Java 11 with targetJVM 1.8 New version of Dokka supports Java 9+ so we can just run a single build using current LTS (11) with targetJVM 1.8 * remove unused imports
1 parent 43c649b commit 2d1031a

File tree

6 files changed

+18
-58
lines changed

6 files changed

+18
-58
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,25 @@ jobs:
1212
build:
1313
timeout-minutes: 30
1414
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
# test against latest update of each major Java version, as well as specific updates of LTS versions
18-
java: [ 8, 11.0.x ]
1915

2016
steps:
2117
- uses: actions/checkout@v2
2218

2319
- name: Validate Gradle wrapper
2420
uses: gradle/wrapper-validation-action@v1
2521

26-
- name: Set up Java ${{ matrix.java }}
22+
- name: Set up Java 11
2723
uses: actions/setup-java@v1
2824
with:
29-
java-version: ${{ matrix.java }}
25+
java-version: 11
3026

3127
- name: Set up Gradle cache
3228
uses: actions/cache@v1
3329
with:
3430
path: ~/.gradle/caches
35-
key: ${{ runner.os }}-${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
31+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
3632
restore-keys: |
37-
${{ runner.os }}-${{ matrix.java }}-gradle-
33+
${{ runner.os }}-gradle-
3834
3935
- name: Build libraries with Gradle
4036
run: ./gradlew clean build
@@ -43,7 +39,7 @@ jobs:
4339
uses: actions/upload-artifact@v2
4440
if: failure()
4541
with:
46-
name: build-reports-${{ matrix.java }}
42+
name: build-reports
4743
path: |
4844
./**/build/reports
4945
plugins/graphql-kotlin-maven-plugin/build/integration/**/build.log
@@ -58,7 +54,7 @@ jobs:
5854
uses: actions/upload-artifact@v2
5955
if: failure()
6056
with:
61-
name: build-examples-reports-${{ matrix.java }}
57+
name: build-examples-reports
6258
path: ./examples/**/build/reports
6359
retention-days: 7
6460

.github/workflows/pr-check.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,34 @@ jobs:
1313
build:
1414
timeout-minutes: 30
1515
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
# test against latest update of each major Java version, as well as specific updates of LTS versions
19-
java: [ 8, 11.0.x ]
2016

2117
steps:
2218
- uses: actions/checkout@v2
2319

2420
- name: Validate Gradle wrapper
2521
uses: gradle/wrapper-validation-action@v1
2622

27-
- name: Set up Java ${{ matrix.java }}
23+
- name: Set up Java 11
2824
uses: actions/setup-java@v1
2925
with:
30-
java-version: ${{ matrix.java }}
26+
java-version: 11
3127

3228
- name: Set up Gradle cache
3329
uses: actions/cache@v1
3430
with:
3531
path: ~/.gradle/caches
36-
key: ${{ runner.os }}-${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
32+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
3733
restore-keys: |
38-
${{ runner.os }}-${{ matrix.java }}-gradle-
34+
${{ runner.os }}-gradle-
3935
4036
# Used by maven-plugin integration tests
4137
- name: Set up Maven cache
4238
uses: actions/cache@v1
4339
with:
4440
path: ~/.m2/repository
45-
key: ${{ runner.os }}-${{ matrix.java }}-maven-${{ hashFiles('**/pom.xml') }}
41+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
4642
restore-keys: |
47-
${{ runner.os }}-${{ matrix.java }}-maven-
43+
${{ runner.os }}-maven-
4844
4945
- name: Build library with Gradle
5046
run: ./gradlew clean build
@@ -53,7 +49,7 @@ jobs:
5349
uses: actions/upload-artifact@v2
5450
if: failure()
5551
with:
56-
name: build-reports-${{ matrix.java }}
52+
name: build-reports
5753
path: |
5854
./**/build/reports
5955
plugins/graphql-kotlin-maven-plugin/build/integration/**/build.log
@@ -68,6 +64,6 @@ jobs:
6864
uses: actions/upload-artifact@v2
6965
if: failure()
7066
with:
71-
name: build-examples-reports-${{ matrix.java }}
67+
name: build-examples-reports
7268
path: ./examples/**/build/reports
7369
retention-days: 7

.github/workflows/release-code.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ jobs:
1515

1616
- uses: gradle/wrapper-validation-action@v1
1717

18-
- name: Set up Java 1.8
18+
- name: Set up Java 11
1919
uses: actions/setup-java@v1
20-
# dokka doesn't support Java 11
2120
with:
22-
java-version: 1.8
21+
java-version: 11
2322

2423
- name: Build library with Gradle
2524
run: ./gradlew clean build
@@ -41,7 +40,7 @@ jobs:
4140
uses: actions/upload-artifact@v2
4241
if: failure()
4342
with:
44-
name: build-reports-${{ matrix.java }}
43+
name: build-reports
4544
path: |
4645
./**/build/reports
4746
plugins/graphql-kotlin-maven-plugin/build/integration/**/build.log

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ subprojects {
108108
val dokka = named("dokkaJavadoc", DokkaTask::class)
109109
val javadocJar by registering(Jar::class) {
110110
archiveClassifier.set("javadoc")
111-
from("$buildDir/javadoc")
111+
from("$buildDir/dokka/javadoc")
112112
dependsOn(dokka)
113113
}
114114
publishing {

generator/graphql-kotlin-schema-generator/src/test/kotlin/com/expediagroup/graphql/generator/internal/extensions/KClassExtensionsTest.kt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import com.expediagroup.graphql.generator.exceptions.CouldNotGetNameOfKClassExce
2323
import com.expediagroup.graphql.generator.hooks.NoopSchemaGeneratorHooks
2424
import com.expediagroup.graphql.generator.hooks.SchemaGeneratorHooks
2525
import org.junit.jupiter.api.Test
26-
import org.junit.jupiter.api.condition.EnabledOnJre
27-
import org.junit.jupiter.api.condition.JRE
2826
import kotlin.reflect.KClass
2927
import kotlin.reflect.KFunction
3028
import kotlin.reflect.KProperty
@@ -294,27 +292,14 @@ open class KClassExtensionsTest {
294292
assertFalse(invalidAnnotationUnion.returnType.getKClass().isUnion(invalidAnnotationUnion.annotations))
295293
}
296294

297-
// TODO remove JUnit condition once we only build artifacts using Java 11
298-
// BLOCKED: in order to publish to Maven Central we need to generate javadoc jar, blocked until Dokka https://github.com/Kotlin/dokka/issues/294 is resolved
299-
// ISSUE: with Kotlin 1.3.40+ there is bug on JRE 1.8 that results in incorrect simple name of the anonymous classes, see https://youtrack.jetbrains.com/issue/KT-23072
300295
@Test
301-
@EnabledOnJre(JRE.JAVA_11)
302296
fun `test class simple name`() {
303297
assertEquals("MyTestClass", MyTestClass::class.getSimpleName())
304298
assertFailsWith(CouldNotGetNameOfKClassException::class) {
305299
object { }::class.getSimpleName()
306300
}
307301
}
308302

309-
// TODO remove this JUnit once we only build artifacts using Java 11
310-
// BLOCKED: in order to publish to Maven Central we need to generate javadoc jar, blocked until Dokka https://github.com/Kotlin/dokka/issues/294 is resolved
311-
// ISSUE: with Kotlin 1.3.40+ there is bug on JRE 1.8 that results in incorrect simple name of the anonymous classes, see https://youtrack.jetbrains.com/issue/KT-23072
312-
@Test
313-
@EnabledOnJre(JRE.JAVA_8)
314-
fun `test class simple name on JRE 8`() {
315-
assertEquals("MyTestClass", MyTestClass::class.getSimpleName())
316-
}
317-
318303
@Test
319304
fun `test class simple name with GraphQLName`() {
320305
assertEquals("MyTestClassRenamed", MyTestClassCustomName::class.getSimpleName())

generator/graphql-kotlin-schema-generator/src/test/kotlin/com/expediagroup/graphql/generator/internal/extensions/KTypeExtensionsKtTest.kt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import com.expediagroup.graphql.generator.exceptions.InvalidWrappedTypeException
2121
import io.mockk.every
2222
import io.mockk.mockk
2323
import org.junit.jupiter.api.Test
24-
import org.junit.jupiter.api.condition.EnabledOnJre
25-
import org.junit.jupiter.api.condition.JRE
2624
import kotlin.reflect.KType
2725
import kotlin.reflect.KTypeProjection
2826
import kotlin.reflect.full.createType
@@ -145,11 +143,7 @@ class KTypeExtensionsKtTest {
145143
}
146144
}
147145

148-
// TODO remove JUnit condition once we only build artifacts using Java 11
149-
// BLOCKED: in order to publish to Maven Central we need to generate javadoc jar, blocked until Dokka https://github.com/Kotlin/dokka/issues/294 is resolved
150-
// ISSUE: with Kotlin 1.3.40+ there is bug on JRE 1.8 that results in incorrect simple name of the anonymous classes, see https://youtrack.jetbrains.com/issue/KT-23072
151146
@Test
152-
@EnabledOnJre(JRE.JAVA_11)
153147
fun getSimpleName() {
154148
assertEquals("MyClass", MyClass::class.starProjectedType.getSimpleName())
155149
assertEquals("MyClassInput", MyClass::class.starProjectedType.getSimpleName(isInputType = true))
@@ -158,16 +152,6 @@ class KTypeExtensionsKtTest {
158152
}
159153
}
160154

161-
// TODO remove this JUnit once we only build artifacts using Java 11
162-
// BLOCKED: in order to publish to Maven Central we need to generate javadoc jar, blocked until Dokka https://github.com/Kotlin/dokka/issues/294 is resolved
163-
// ISSUE: with Kotlin 1.3.40+ there is bug on JRE 1.8 that results in incorrect simple name of the anonymous classes, see https://youtrack.jetbrains.com/issue/KT-23072
164-
@Test
165-
@EnabledOnJre(JRE.JAVA_8)
166-
fun getSimpleNameJava8() {
167-
assertEquals("MyClass", MyClass::class.starProjectedType.getSimpleName())
168-
assertEquals("MyClassInput", MyClass::class.starProjectedType.getSimpleName(isInputType = true))
169-
}
170-
171155
@Test
172156
fun qualifiedName() {
173157
assertEquals("com.expediagroup.graphql.generator.internal.extensions.KTypeExtensionsKtTest.MyClass", MyClass::class.starProjectedType.qualifiedName)

0 commit comments

Comments
 (0)