Skip to content

Commit

Permalink
Upgrade to gradle 8.4 (#144)
Browse files Browse the repository at this point in the history
* Upgrade to gradle 8.4

* Spotless apply

* Fix multi jvm tests not compiling

* [chore] Update README
  • Loading branch information
joel-jeremy committed Nov 7, 2023
1 parent 959f613 commit ed2e5b7
Show file tree
Hide file tree
Showing 27 changed files with 244 additions and 148 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

A lightweight and extensible library to resolve application properties from various external sources.

## Like the project?

Please consider giving the repository a ⭐. It means a lot! Thank you :)

## [Twelve Factor Methodology](https://12factor.net)

Externalized Properties was inspired by the [The Twelve Factor Methodology](https://12factor.net)'s section [III. Config](https://12factor.net/config).
Expand Down
5 changes: 3 additions & 2 deletions build-logic/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
org.gradle.jvmargs=-Xmx2g -XX:+UseZGC -XX:+HeapDumpOnOutOfMemoryError
org.gradle.parallel=true
org.gradle.caching=true
# Disable for now until snyk plugin gets fixed https://github.com/snyk/gradle-plugin/issues/13
# org.gradle.configuration-cache=true
org.gradle.configureondemand=true
org.gradle.daemon=true
systemProp.org.gradle.kotlin.dsl.precompiled.accessors.strict=true
systemProp.sonar.gradle.skipCompile=true
14 changes: 0 additions & 14 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
plugins {
id("org.gradle.toolchains.foojay-resolver") version "0.7.0"
}

toolchainManagement {
jvm {
javaRepositories {
repository("foojay") {
resolverClass.set(org.gradle.toolchains.foojay.FoojayToolchainResolver::class.java)
}
}
}
}

dependencyResolutionManagement {
repositories {
gradlePluginPortal()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ plugins {

coveralls {
sourceDirs = mainSrcDirs()
jacocoReportPath =
"${rootProject.buildDir}/reports/jacoco/allCodeCoverageReport/allCodeCoverageReport.xml"
jacocoReportPath = rootProject.layout.buildDirectory.file(
"reports/jacoco/allCodeCoverageReport/allCodeCoverageReport.xml")
}

tasks.named<CoverallsTask>("coveralls") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

fun isNonStable(version: String): Boolean {
val nonStableKeyword = listOf("PREVIEW", "ALPHA", "BETA", "SNAPSHOT").any {
keyword -> version.toUpperCase().contains(keyword)
keyword -> version.uppercase().contains(keyword)
}
return nonStableKeyword
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tasks.named("check") {
tasks.withType<JavaCompile>().configureEach {
options.errorprone {
// Only apply to main source set (not test,jmh)
isEnabled.set(name == "compileJava")
isEnabled = name == "compileJava"

val enabledChecks = listOf(
"AssertFalse", "BuilderReturnThis", "CheckedExceptionNotThrown", "ClassName",
Expand All @@ -68,10 +68,10 @@ tasks.withType<JavaCompile>().configureEach {
disabledChecks.forEach { check -> disable(check) }

nullaway {
severity.set(CheckSeverity.ERROR)
severity = CheckSeverity.ERROR
annotatedPackages.add("io.github.joeljeremy.externalizedproperties")
checkOptionalEmptiness.set(true)
suggestSuppressions.set(true)
checkOptionalEmptiness = true
suggestSuppressions = true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ plugins {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion = JavaLanguageVersion.of(17)
}
}

tasks.withType<JavaCompile>().configureEach {
options.release.set(11)
options.release = 11
}

tasks.withType<Javadoc>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ additionalTestRunsOnJvmVersions().forEach { additionalJavaVersion ->

val testTask = tasks.register<Test>(testTaskName) {
useJUnitPlatform()
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(additionalJavaVersion)
})
javaLauncher = javaToolchains.launcherFor {
languageVersion = additionalJavaVersion
}
}

tasks.named("check") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ publishing {

pom {
packaging = "jar"
name.set(project.description)
description.set(project.description)
url.set("https://github.com/joel-jeremy/externalized-properties")
name = project.providers.provider { project.description }
description = project.providers.provider { project.description }
url = "https://github.com/joel-jeremy/externalized-properties"

licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}

developers {
developer {
id.set("joel-jeremy")
name.set("Joel Jeremy M. Marquez")
email.set("[email protected]")
roles.set(listOf("owner", "developer"))
id = "joel-jeremy"
name = "Joel Jeremy M. Marquez"
email = "[email protected]"
roles = listOf("owner", "developer")
}
}

scm {
connection.set("scm:git:https://github.com/joel-jeremy/externalized-properties.git")
developerConnection.set("scm:git:https://github.com/joel-jeremy/externalized-properties.git")
url.set("https://github.com/joel-jeremy/externalized-properties")
connection = ("scm:git:https://github.com/joel-jeremy/externalized-properties.git")
developerConnection = ("scm:git:https://github.com/joel-jeremy/externalized-properties.git")
url = ("https://github.com/joel-jeremy/externalized-properties")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
reporting {
reports {
register<JacocoCoverageReport>("allCodeCoverageReport") {
testType.set("all")
testType = "all"
reportTask {
val testTasks = javaProjects().map { it.tasks.withType<Test>() }
for (collection in testTasks) {
Expand All @@ -21,10 +21,10 @@ reporting {
}
}
register<AggregateTestReport>("testAggregateTestReport") {
testType.set(TestSuiteType.UNIT_TEST)
testType = TestSuiteType.UNIT_TEST
}
register<AggregateTestReport>("integrationTestAggregateTestReport") {
testType.set(TestSuiteType.INTEGRATION_TEST)
testType = TestSuiteType.INTEGRATION_TEST
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
testing {
suites {
register<JvmTestSuite>("integrationTest") {
testType.set(TestSuiteType.INTEGRATION_TEST)
testType = TestSuiteType.INTEGRATION_TEST
targets {
all {
testTask {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ plugins {
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(findProperty("ossrhUsername") as String?)
password.set(findProperty("ossrhPassword") as String?)
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
username = findProperty("ossrhUsername") as String?
password = findProperty("ossrhPassword") as String?
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id("org.sonarqube")
}

sonarqube {
sonar {
properties {
val sonarToken = findProperty("sonarToken")
if (sonarToken != null) {
Expand All @@ -12,8 +12,8 @@ sonarqube {
property("sonar.projectKey", rootProject.group)
property("sonar.organization", "joel-jeremy")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.coverage.jacoco.xmlReportPaths",
"${rootProject.buildDir}/reports/jacoco/allCodeCoverageReport/allCodeCoverageReport.xml")
property("sonar.coverage.jacoco.xmlReportPaths", rootProject.layout.buildDirectory.file(
"reports/jacoco/allCodeCoverageReport/allCodeCoverageReport.xml"))
}
}

Expand Down
12 changes: 6 additions & 6 deletions externalized-properties-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
plugins {
id("externalized-properties.java-library-conventions")
id("externalized-properties.java-multi-jvm-test-conventions")
id("externalized-properties.java-testing-conventions")
id("externalized-properties.java-code-quality-conventions")
id("externalized-properties.java-publish-conventions")
id("externalized-properties.java-multi-jvm-test-conventions")
id("externalized-properties.eclipse-conventions")
// See https://youtrack.jetbrains.com/issue/KTIJ-19370
@Suppress("DSL_SCOPE_VIOLATION")
alias(libs.plugins.jmh)
}

description = "Externalized Properties core module"
description = "Externalized Properties Core"

tasks.named<Jar>("jar") {
manifest {
Expand All @@ -30,9 +30,9 @@ dependencies {
}

jmh {
jmhVersion.set("1.35")
humanOutputFile.set(project.file("${project.buildDir}/reports/jmh/human.txt"))
resultsFile.set(project.file("${project.buildDir}/reports/jmh/results.json"))
resultFormat.set("JSON")
jmhVersion = "1.35"
humanOutputFile = layout.buildDirectory.file("reports/jmh/human.txt")
resultsFile = layout.buildDirectory.file("reports/jmh/results.json")
resultFormat = "JSON"
jvmArgs.addAll(listOf("-Xmx2G"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
public class ListConverter implements Converter<List<?>> {
private final ListFactory listFactory;

/** Internal array converter. */
private final ArrayConverter arrayConverter = new ArrayConverter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/
public class SetConverter implements Converter<Set<?>> {
private final SetFactory setFactory;

/** Internal array converter. */
private final ArrayConverter arrayConverter = new ArrayConverter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ public static DefaultInterfaceMethodHandler create(Method defaultInterfaceMethod
defaultInterfaceMethod.toGenericString() + " is not a default interface method.");
}

/**
* Note: We optimize for methods with up to 2 arguments. We create lambda functions for better
* performance. This number may change in the future.
*/
// Note: We optimize for methods with up to 2 arguments. We create lambda functions for better
// performance. This number may change in the future.

// Optimization for default interface methods that have no args.
if (defaultInterfaceMethod.getParameterCount() == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@Internal
public class MethodHandleFactory {
private MethodHandleFactory() {}

/**
* Get method handle.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ public JceDecryptor symmetric(
*/
public JceDecryptor symmetric(
String algorithm, SecretKey secretKey, AlgorithmParameterSpec algorithmParameterSpec)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
throws NoSuchAlgorithmException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException {
return symmetric(algorithm, algorithm, secretKey, algorithmParameterSpec);
}
Expand All @@ -487,7 +489,9 @@ public JceDecryptor symmetric(
String algorithm,
SecretKey secretKey,
AlgorithmParameterSpec algorithmParameterSpec)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
throws NoSuchAlgorithmException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException {
requireNonNull(name, "name");
requireNonNull(algorithm, "algorithm");
Expand Down Expand Up @@ -520,7 +524,9 @@ public JceDecryptor symmetric(
SecretKey secretKey,
AlgorithmParameterSpec algorithmParameterSpec,
SecureRandom secureRandom)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
throws NoSuchAlgorithmException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException {
return symmetric(algorithm, algorithm, secretKey, algorithmParameterSpec, secureRandom);
}
Expand Down Expand Up @@ -549,7 +555,9 @@ public JceDecryptor symmetric(
SecretKey secretKey,
AlgorithmParameterSpec algorithmParameterSpec,
SecureRandom secureRandom)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
throws NoSuchAlgorithmException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException {
requireNonNull(name, "name");
requireNonNull(algorithm, "algorithm");
Expand Down Expand Up @@ -579,7 +587,9 @@ public JceDecryptor symmetric(
*/
public JceDecryptor symmetric(
String algorithm, SecretKey secretKey, AlgorithmParameters algorithmParameters)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
throws NoSuchAlgorithmException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException {
return symmetric(algorithm, algorithm, secretKey, algorithmParameters);
}
Expand All @@ -606,7 +616,9 @@ public JceDecryptor symmetric(
String algorithm,
SecretKey secretKey,
AlgorithmParameters algorithmParameters)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
throws NoSuchAlgorithmException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException {
requireNonNull(name, "name");
requireNonNull(algorithm, "algorithm");
Expand Down Expand Up @@ -639,7 +651,9 @@ public JceDecryptor symmetric(
SecretKey secretKey,
AlgorithmParameters algorithmParameters,
SecureRandom secureRandom)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
throws NoSuchAlgorithmException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException {
return symmetric(algorithm, algorithm, secretKey, algorithmParameters, secureRandom);
}
Expand Down Expand Up @@ -668,7 +682,9 @@ public JceDecryptor symmetric(
SecretKey secretKey,
AlgorithmParameters algorithmParameters,
SecureRandom secureRandom)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
throws NoSuchAlgorithmException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException {
requireNonNull(name, "name");
requireNonNull(algorithm, "algorithm");
Expand Down
Loading

0 comments on commit ed2e5b7

Please sign in to comment.