Skip to content

Commit

Permalink
upgraded gradle to version 8.11.1, improved build.gradle, get rid of …
Browse files Browse the repository at this point in the history
…me.champeau.mrjar plugin
  • Loading branch information
oertl committed Nov 24, 2024
1 parent 32f03d1 commit dbeae22
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 48 deletions.
144 changes: 101 additions & 43 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import com.diffplug.gradle.spotless.JavaExtension


buildscript {
dependencies {
classpath 'org.revapi:gradle-revapi:1.8.0'
}
}

plugins {
id 'java-library'
id 'me.champeau.mrjar' version "0.1.1"
id 'jacoco'
id 'me.champeau.jmh' version '0.7.2'
id 'org.sonarqube' version '5.1.0.4882'
Expand All @@ -18,10 +10,9 @@ plugins {
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
id 'net.ltgt.errorprone' version '4.1.0'
id "org.revapi.revapi-gradle-plugin" version "1.8.0"
}

apply plugin: 'org.revapi.revapi-gradle-plugin'

repositories {
mavenCentral()
gradlePluginPortal()
Expand All @@ -40,13 +31,106 @@ dependencies {
testImplementation group: 'com.appmattus.crypto', name: 'cryptohash', version: '1.0.2'
testImplementation group: 'org.greenrobot', name: 'essentials', version: '3.1.0'
testImplementation group: 'com.sangupta', name: 'murmur', version: '1.0.0'
errorprone group:'com.google.errorprone',name:'error_prone_core', version: '2.31.0' // upgrade not possible as >= 2.32.0 requires java >= 17 and the multi-release plugin me.champeau.mrjar is not able to use java 17 for java 11 compilation, see https://github.com/melix/mrjar-gradle-plugin/issues/7
errorprone group:'com.google.errorprone',name:'error_prone_core', version: '2.36.0'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
withJavadocJar()
withSourcesJar()
}


sourceSets {
jmh
main
test
java21 {
java {
srcDir 'src/main/java21'
}
dependencies {
// add Java 21 dependencies here to make them available for Java 21 code
}
// include main source code to make it accessible from Java 21
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
java21Test {
java {
srcDir 'src/test/java21'
}
dependencies {
// add Java 21 dependencies here to make them available for Java 21 code
}
// include test source code to make it accessible from Java 21
compileClasspath += sourceSets.test.output
runtimeClasspath += sourceSets.test.output
}
}

jar {
dependsOn 'compileJava21Java'
into('META-INF/versions/21') {
from sourceSets.java21.output
}
manifest {
attributes 'Multi-Release': 'true'
}
}

tasks.compileJava {
options.release.set(11)
}

tasks.compileTestJava {
options.release.set(11)
}

tasks.compileJava21Java {
options.release.set(21)
}
tasks.compileJava21TestJava {
options.release.set(21)
}

tasks.test {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(11)
}
}

tasks.register("java21Test", Test) {
// compare https://github.com/melix/mrjar-gradle-plugin/blob/dac99aadd451e3c2176aa6e13af7ad39e20c2cb9/plugin/src/main/java/me/champeau/mrjar/MultiReleaseExtension.java group=LifecycleBasePlugin.VERIFICATION_GROUP
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
}
// run Java 21 specific and generic tests
testClassesDirs = sourceSets.java21Test.output + sourceSets.test.output
classpath = files(jar) + sourceSets.java21Test.runtimeClasspath + sourceSets.test.runtimeClasspath
}

multiRelease {
targetVersions 11, 21
tasks.check {
dependsOn(java21Test)
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
maxHeapSize '8g'
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Werror"
options.errorprone.disableWarningsInGeneratedCode = false
// options.errorprone.enabled = false
}

group = 'com.dynatrace.hash4j'
version = '0.18.0'


static def readJavaLicense(licenseName) {
File licenseFile = new File('licenses/' + licenseName + '.txt')
def line
Expand Down Expand Up @@ -83,20 +167,11 @@ static def readPythonLicense(licenseName) {
return s
}

java {
withJavadocJar()
withSourcesJar()
}

group = 'com.dynatrace.hash4j'
version = '0.18.0'


spotless {
def googleJavaFormatVersion = '1.23.0'
def eclipseCdtVersion = '11.3'
def blackVersion = '24.4.2'
def greclipseVersion = '4.29'
def googleJavaFormatVersion = '1.25.0'
def eclipseCdtVersion = '11.6'
def blackVersion = '24.10.0'
def greclipseVersion = '4.32'

ratchetFrom 'origin/main'
apply plugin: 'groovy'
Expand Down Expand Up @@ -302,12 +377,6 @@ tasks.copyBenchmarkReport.dependsOn checkStatusForBenchmarks
tasks.simulateHyperLogLogEstimationErrors.finalizedBy evaluateEstimationErrors
tasks.simulateUltraLogLogEstimationErrors.finalizedBy evaluateEstimationErrors

sourceSets {
jmh
main
test
}

javadoc {
failOnError true
title 'hash4j ' + project.version + ' API'
Expand Down Expand Up @@ -388,17 +457,6 @@ nexusPublishing {
}
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
maxHeapSize '8g'
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Werror"
options.errorprone.disableWarningsInGeneratedCode = false
// options.errorprone.enabled = false
}

if (file("extra-configuration.gradle").exists()) {
apply from: 'extra-configuration.gradle'
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==24.3.0
black==24.10.0
click==8.1.7
GitPython==3.1.41
matplotlib==3.8.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ static double calculateTheoreticalRelativeStandardError(int p) {
5.059288069986326E14,
2.3575295235667005E15,
1.0985627213141412E16,
5.1190876745155888E16,
2.38539483395717152E17
5.119087674515589E16,
2.3853948339571715E17
};

static final double[] REGISTER_CONTRIBUTIONS = {
Expand Down

0 comments on commit dbeae22

Please sign in to comment.