Skip to content

Commit d045829

Browse files
authored
Upgrade gradle & kotlin (#44)
* Update gradle from 6.5 to 7.3.3 * Update kotlin version to 1.9.23 * Bump jvm target to Java 11 * Update gradle to 8.6, set jvm version to 11, switch buildconfig plugin
1 parent c4dfe77 commit d045829

File tree

9 files changed

+283
-254
lines changed

9 files changed

+283
-254
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
test:
1111
strategy:
1212
matrix:
13-
java: [ '8', '11' ]
13+
java: [ '11' ]
1414

1515
name: test with java ${{ matrix.java }}
1616

Lines changed: 33 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,39 @@
1-
buildscript {
2-
ext.kotlin_version = '1.5.30'
3-
4-
repositories {
5-
google()
6-
maven {
7-
url "https://plugins.gradle.org/m2/"
8-
}
9-
}
10-
dependencies {
11-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12-
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.17"
13-
}
14-
}
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
152

163
plugins {
17-
id 'de.fuerstenau.buildconfig' version '1.1.8'
4+
id 'java-library'
5+
id 'java-test-fixtures'
6+
id 'jacoco'
7+
id 'org.jetbrains.kotlin.jvm'
8+
id 'org.jetbrains.kotlin.kapt'
9+
id 'com.google.protobuf' version '0.9.4'
10+
id 'com.github.gmazzo.buildconfig' version "5.3.5"
11+
id 'org.gradle.idea'
1812
}
19-
apply plugin: 'java-library'
20-
apply plugin: 'java-test-fixtures'
21-
apply plugin: 'jacoco'
22-
apply plugin: 'kotlin'
23-
apply plugin: 'kotlin-kapt'
24-
apply plugin: 'idea'
25-
apply plugin: 'com.google.protobuf'
2613
apply from: 'versions.gradle'
2714

15+
repositories {
16+
google()
17+
mavenCentral()
18+
}
19+
2820
group 'eu.pretix.pretixdesk'
2921
version '1.0'
3022

3123
buildConfig {
32-
appName = "libpretixsync"
33-
version = "0.0"
34-
clsName = 'BuildConfig'
35-
packageName = "eu.pretix.libpretixsync"
36-
charset = 'UTF-8'
37-
buildConfigField 'String', 'DB', 'postgres'
38-
buildConfigField 'String', 'BOOLEAN_TYPE', 'boolean'
39-
buildConfigField 'String', 'BOOLEAN_FALSE', 'false'
24+
className('BuildConfig')
25+
packageName('eu.pretix.libpretixsync')
26+
useJavaOutput()
27+
28+
buildConfigField(String, 'DB', 'postgres')
29+
buildConfigField(String, 'BOOLEAN_TYPE', 'boolean')
30+
buildConfigField(String, 'BOOLEAN_FALSE', 'false')
4031
}
4132

42-
sourceCompatibility = 1.8
43-
targetCompatibility = 1.8
33+
java {
34+
sourceCompatibility = JavaVersion.VERSION_11
35+
targetCompatibility = JavaVersion.VERSION_11
36+
}
4437

4538
idea {
4639
module {
@@ -59,30 +52,26 @@ configurations {
5952
maybeCreate("compile")
6053
}
6154

62-
compileKotlin {
63-
kotlinOptions {
64-
jvmTarget = "1.8"
65-
}
66-
}
67-
compileTestKotlin {
68-
kotlinOptions {
69-
jvmTarget = "1.8"
55+
kotlin {
56+
compilerOptions {
57+
jvmTarget = JvmTarget.JVM_11
7058
}
7159
}
7260

7361
jacoco {
7462
toolVersion = "0.8.7"
7563
}
64+
7665
jacocoTestReport {
7766
reports {
78-
xml.enabled true
79-
html.enabled true
67+
xml.required = true
68+
html.required = true
8069
}
8170
}
8271

8372
protobuf {
8473
protoc {
85-
artifact = 'com.google.protobuf:protoc:3.21.1'
74+
artifact = "com.google.protobuf:protoc:$protobuf_version"
8675
}
8776
generateProtoTasks {
8877
all().each { task ->
@@ -109,7 +98,7 @@ dependencies {
10998
implementation "org.json:json:$json_version"
11099
testFixturesImplementation "org.json:json:$json_version"
111100

112-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
101+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
113102
implementation "net.sourceforge.streamsupport:streamsupport-cfuture:$cfuture_version"
114103
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_core_version"
115104
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_kotlin_version"
@@ -132,10 +121,3 @@ task copyTestResources(type: Copy) {
132121
into "${buildDir}/classes/test"
133122
}
134123
processTestResources.dependsOn copyTestResources
135-
136-
sourceSets {
137-
main {
138-
java.srcDirs += file("$buildDir/generated/source/kapt/main")
139-
kotlin.srcDirs += file("$buildDir/generated/source/kapt/main")
140-
}
141-
}

libpretixsync/build.gradle

Lines changed: 35 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,46 @@
1-
buildscript {
2-
ext.kotlin_version = '1.5.30'
3-
4-
repositories {
5-
google()
6-
maven {
7-
url "https://plugins.gradle.org/m2/"
8-
}
9-
}
10-
dependencies {
11-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12-
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.17"
13-
}
14-
}
15-
161
plugins {
17-
id 'de.fuerstenau.buildconfig' version '1.1.8'
2+
id 'java-library'
3+
id 'java-test-fixtures'
4+
id 'jacoco'
5+
id 'org.jetbrains.kotlin.jvm'
6+
id 'org.jetbrains.kotlin.kapt'
7+
id 'com.google.protobuf' version '0.9.4'
8+
id 'com.github.gmazzo.buildconfig' version '5.3.5'
9+
id 'org.gradle.idea'
1810
}
19-
apply plugin: 'java-library'
20-
apply plugin: 'java-test-fixtures'
21-
apply plugin: 'jacoco'
22-
apply plugin: 'kotlin'
23-
apply plugin: 'kotlin-kapt'
24-
apply plugin: 'idea'
25-
apply plugin: 'com.google.protobuf'
2611
apply from: 'versions.gradle'
2712

13+
repositories {
14+
google()
15+
mavenCentral()
16+
}
17+
2818
group 'eu.pretix.pretixdesk'
2919
version '1.0'
3020

3121
compileJava.options.encoding = 'UTF-8'
3222
compileTestJava.options.encoding = 'UTF-8'
3323

3424
buildConfig {
35-
appName = "libpretixsync"
36-
version = "0.0"
37-
clsName = 'BuildConfig'
38-
packageName = "eu.pretix.libpretixsync"
39-
charset = 'UTF-8'
40-
buildConfigField 'String', 'DB', 'sqlite'
41-
buildConfigField 'String', 'BOOLEAN_TYPE', 'NUMERIC'
42-
buildConfigField 'String', 'BOOLEAN_FALSE', '0'
25+
className('BuildConfig')
26+
packageName('eu.pretix.libpretixsync')
27+
useJavaOutput()
28+
29+
buildConfigField(String, 'DB', 'sqlite')
30+
buildConfigField(String, 'BOOLEAN_TYPE', 'NUMERIC')
31+
buildConfigField(String, 'BOOLEAN_FALSE', '0')
4332
}
4433

45-
sourceCompatibility = 1.8
46-
targetCompatibility = 1.8
34+
kotlin {
35+
jvmToolchain {
36+
languageVersion.set(JavaLanguageVersion.of(11))
37+
}
38+
}
39+
java {
40+
toolchain {
41+
languageVersion.set(JavaLanguageVersion.of(11))
42+
}
43+
}
4744

4845
idea {
4946
module {
@@ -54,38 +51,24 @@ idea {
5451
}
5552
}
5653

57-
repositories {
58-
mavenCentral()
59-
}
60-
6154
configurations {
6255
maybeCreate("compile")
6356
}
6457

65-
compileKotlin {
66-
kotlinOptions {
67-
jvmTarget = "1.8"
68-
}
69-
}
70-
compileTestKotlin {
71-
kotlinOptions {
72-
jvmTarget = "1.8"
73-
}
74-
}
75-
7658
jacoco {
7759
toolVersion = "0.8.7"
7860
}
61+
7962
jacocoTestReport {
8063
reports {
81-
xml.enabled true
82-
html.enabled true
64+
xml.required = true
65+
html.required = true
8366
}
8467
}
8568

8669
protobuf {
8770
protoc {
88-
artifact = 'com.google.protobuf:protoc:3.21.1'
71+
artifact = "com.google.protobuf:protoc:$protobuf_version"
8972
}
9073
generateProtoTasks {
9174
all().each { task ->
@@ -112,7 +95,7 @@ dependencies {
11295
implementation "org.json:json:$json_version"
11396
testFixturesImplementation "org.json:json:$json_version"
11497

115-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
98+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
11699
implementation "net.sourceforge.streamsupport:streamsupport-cfuture:$cfuture_version"
117100
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_core_version"
118101
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_kotlin_version"
@@ -135,10 +118,3 @@ task copyTestResources(type: Copy) {
135118
into "${buildDir}/classes/test"
136119
}
137120
processTestResources.dependsOn copyTestResources
138-
139-
sourceSets {
140-
main {
141-
java.srcDirs += file("$buildDir/generated/source/kapt/main")
142-
kotlin.srcDirs += file("$buildDir/generated/source/kapt/main")
143-
}
144-
}
-15.1 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)