Skip to content

Commit

Permalink
Update java gradlew spotless (#136)
Browse files Browse the repository at this point in the history
* chore: update java and gradlew versions

* chore: update spotless plugin

* chore: update depricated docker image https://hub.docker.com/_/openjdk

* feat: format .gradle files

* fix: fix syntax

* fix: format .gradle files

* chore: update dependencies
  • Loading branch information
shaljam authored Mar 27, 2024
1 parent 59599ce commit a64e846
Show file tree
Hide file tree
Showing 11 changed files with 325 additions and 245 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test:
./gradlew test

test_with_docker:
docker run -t -i -w /code -v $(PWD):/code --env-file .env openjdk:15 sh -c "sh ./gradlew test"
docker run -t -i -w /code -v $(PWD):/code --env-file .env amazoncorretto:17 sh -c "sh ./gradlew test"

format_with_docker:
docker run -t -i -w /code -v $(PWD):/code openjdk:15 sh -c "sh ./gradlew :spotlessApply"
docker run -t -i -w /code -v $(PWD):/code amazoncorretto:17 sh -c "sh ./gradlew :spotlessApply"
117 changes: 60 additions & 57 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,98 +1,101 @@
plugins {
id 'java'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'com.diffplug.spotless' version '5.14.0'
id 'org.barfuin.gradle.jacocolog' version '2.0.0'
id 'java'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'com.diffplug.spotless' version '6.25.0'
id 'org.barfuin.gradle.jacocolog' version '2.0.0'
}

group = 'io.getstream'
version = '1.21.0'
description = 'Stream Chat official Java SDK'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url uri('https://repo.maven.apache.org/maven2/') }
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url uri('https://repo.maven.apache.org/maven2/') }
}

dependencies {
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.11.0"))

// define any required OkHttp artifacts without version
implementation("com.squareup.okhttp3:okhttp")

implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
implementation 'io.jsonwebtoken:jjwt-api:0.11.2'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.2'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'org.apache.commons:commons-lang3:3.12.0'
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'

testCompileOnly 'org.projectlombok:lombok:1.18.22'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.11.0"))

// define any required OkHttp artifacts without version
implementation("com.squareup.okhttp3:okhttp")

implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.9.0'
implementation 'io.jsonwebtoken:jjwt-api:0.12.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.5'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation 'org.apache.commons:commons-lang3:3.12.0'
compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'

testCompileOnly 'org.projectlombok:lombok:1.18.32'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
}

def localProperties = new Properties()
def localPropertiesFile = project.rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
try (FileInputStream stream = new FileInputStream(localPropertiesFile)) {
localProperties.load(stream)
}
localProperties.load(localPropertiesFile.newDataInputStream())
}

test {
useJUnitPlatform()
useJUnitPlatform()

testLogging {
exceptionFormat = 'full'
events 'standard_out', 'standard_error', "passed", "skipped", "failed"
}
testLogging {
exceptionFormat = 'full'
events 'standard_out', 'standard_error', "passed", "skipped", "failed"
}

doFirst {
// Inject local properties into tests runtime system properties
localProperties.forEach((k, v) -> {
systemProperty k.toString(), v.toString()
})
}
doFirst {
// Inject local properties into tests runtime system properties
localProperties.each{k, v ->
systemProperty k.toString(), v.toString()
}
}

finalizedBy jacocoTestReport
finalizedBy jacocoTestReport
}

def generatedVersionDir = "${buildDir}/generated-version"

sourceSets {
main {
output.dir(generatedVersionDir, builtBy: 'generateVersionProperties')
}
main {
output.dir(generatedVersionDir, builtBy: 'generateVersionProperties')
}
}
spotless {
java {
googleJavaFormat()
}
java {
googleJavaFormat()
}

groovyGradle {
target '*.gradle'
greclipse()
}
}

jacocoTestReport {
dependsOn test
dependsOn test
}

task generateVersionProperties {
doLast {
def propertiesFile = file "$generatedVersionDir/version.properties"
propertiesFile.parentFile.mkdirs()
def properties = new Properties()
properties.setProperty("version", rootProject.version.toString())
propertiesFile.withWriter { properties.store(it, null) }
}
doLast {
def propertiesFile = file "$generatedVersionDir/version.properties"
propertiesFile.parentFile.mkdirs()
def properties = new Properties()
properties.setProperty("version", rootProject.version.toString())
propertiesFile.withWriter { properties.store(it, null) }
}
}
processResources.dependsOn generateVersionProperties

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion 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-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit a64e846

Please sign in to comment.