Skip to content

Commit

Permalink
Upgrade gradle & kotlin (#44)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
robbi5 authored Jul 18, 2024
1 parent c4dfe77 commit d045829
Show file tree
Hide file tree
Showing 9 changed files with 283 additions and 254 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
test:
strategy:
matrix:
java: [ '8', '11' ]
java: [ '11' ]

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

Expand Down
84 changes: 33 additions & 51 deletions libpretixsync/build-postgres.gradle
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
buildscript {
ext.kotlin_version = '1.5.30'

repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.17"
}
}
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id 'de.fuerstenau.buildconfig' version '1.1.8'
id 'java-library'
id 'java-test-fixtures'
id 'jacoco'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.kapt'
id 'com.google.protobuf' version '0.9.4'
id 'com.github.gmazzo.buildconfig' version "5.3.5"
id 'org.gradle.idea'
}
apply plugin: 'java-library'
apply plugin: 'java-test-fixtures'
apply plugin: 'jacoco'
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'idea'
apply plugin: 'com.google.protobuf'
apply from: 'versions.gradle'

repositories {
google()
mavenCentral()
}

group 'eu.pretix.pretixdesk'
version '1.0'

buildConfig {
appName = "libpretixsync"
version = "0.0"
clsName = 'BuildConfig'
packageName = "eu.pretix.libpretixsync"
charset = 'UTF-8'
buildConfigField 'String', 'DB', 'postgres'
buildConfigField 'String', 'BOOLEAN_TYPE', 'boolean'
buildConfigField 'String', 'BOOLEAN_FALSE', 'false'
className('BuildConfig')
packageName('eu.pretix.libpretixsync')
useJavaOutput()

buildConfigField(String, 'DB', 'postgres')
buildConfigField(String, 'BOOLEAN_TYPE', 'boolean')
buildConfigField(String, 'BOOLEAN_FALSE', 'false')
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

idea {
module {
Expand All @@ -59,30 +52,26 @@ configurations {
maybeCreate("compile")
}

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
}
}

jacoco {
toolVersion = "0.8.7"
}

jacocoTestReport {
reports {
xml.enabled true
html.enabled true
xml.required = true
html.required = true
}
}

protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.21.1'
artifact = "com.google.protobuf:protoc:$protobuf_version"
}
generateProtoTasks {
all().each { task ->
Expand All @@ -109,7 +98,7 @@ dependencies {
implementation "org.json:json:$json_version"
testFixturesImplementation "org.json:json:$json_version"

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "net.sourceforge.streamsupport:streamsupport-cfuture:$cfuture_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_core_version"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_kotlin_version"
Expand All @@ -132,10 +121,3 @@ task copyTestResources(type: Copy) {
into "${buildDir}/classes/test"
}
processTestResources.dependsOn copyTestResources

sourceSets {
main {
java.srcDirs += file("$buildDir/generated/source/kapt/main")
kotlin.srcDirs += file("$buildDir/generated/source/kapt/main")
}
}
94 changes: 35 additions & 59 deletions libpretixsync/build.gradle
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
buildscript {
ext.kotlin_version = '1.5.30'

repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.17"
}
}

plugins {
id 'de.fuerstenau.buildconfig' version '1.1.8'
id 'java-library'
id 'java-test-fixtures'
id 'jacoco'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.kapt'
id 'com.google.protobuf' version '0.9.4'
id 'com.github.gmazzo.buildconfig' version '5.3.5'
id 'org.gradle.idea'
}
apply plugin: 'java-library'
apply plugin: 'java-test-fixtures'
apply plugin: 'jacoco'
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'idea'
apply plugin: 'com.google.protobuf'
apply from: 'versions.gradle'

repositories {
google()
mavenCentral()
}

group 'eu.pretix.pretixdesk'
version '1.0'

compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8'

buildConfig {
appName = "libpretixsync"
version = "0.0"
clsName = 'BuildConfig'
packageName = "eu.pretix.libpretixsync"
charset = 'UTF-8'
buildConfigField 'String', 'DB', 'sqlite'
buildConfigField 'String', 'BOOLEAN_TYPE', 'NUMERIC'
buildConfigField 'String', 'BOOLEAN_FALSE', '0'
className('BuildConfig')
packageName('eu.pretix.libpretixsync')
useJavaOutput()

buildConfigField(String, 'DB', 'sqlite')
buildConfigField(String, 'BOOLEAN_TYPE', 'NUMERIC')
buildConfigField(String, 'BOOLEAN_FALSE', '0')
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}

idea {
module {
Expand All @@ -54,38 +51,24 @@ idea {
}
}

repositories {
mavenCentral()
}

configurations {
maybeCreate("compile")
}

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

jacoco {
toolVersion = "0.8.7"
}

jacocoTestReport {
reports {
xml.enabled true
html.enabled true
xml.required = true
html.required = true
}
}

protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.21.1'
artifact = "com.google.protobuf:protoc:$protobuf_version"
}
generateProtoTasks {
all().each { task ->
Expand All @@ -112,7 +95,7 @@ dependencies {
implementation "org.json:json:$json_version"
testFixturesImplementation "org.json:json:$json_version"

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "net.sourceforge.streamsupport:streamsupport-cfuture:$cfuture_version"
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_core_version"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_kotlin_version"
Expand All @@ -135,10 +118,3 @@ task copyTestResources(type: Copy) {
into "${buildDir}/classes/test"
}
processTestResources.dependsOn copyTestResources

sourceSets {
main {
java.srcDirs += file("$buildDir/generated/source/kapt/main")
kotlin.srcDirs += file("$buildDir/generated/source/kapt/main")
}
}
Binary file modified libpretixsync/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion libpretixsync/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit d045829

Please sign in to comment.