Skip to content

Commit

Permalink
Gradle 8.9 and minor tweaks
Browse files Browse the repository at this point in the history
* Update dependency gradle to v8.9

* Replace deprecated GFileUtils

* Inline versions

* Fix successfully executes benchmark which uses feature previews

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Goooler <[email protected]>
  • Loading branch information
renovate[bot] and Goooler committed Jul 12, 2024
1 parent 1d486d4 commit 4ade4dc
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 20 deletions.
16 changes: 6 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,19 @@ buildScanRecipes {
recipe(mapOf("baseUrl" to "https://github.com/melix/jmh-gradle-plugin/tree"), "git-commit")
}

val jmhVersion: String by project
val spockVersion: String by project
val shadowVersion: String by project
val shadowForkVersion: String by project
val jacocoVersion: String by project

dependencies {
val jmhVersion = "1.37"
implementation("org.openjdk.jmh:jmh-core:$jmhVersion")

testImplementation("org.spockframework:spock-core:$spockVersion") {
testImplementation("org.spockframework:spock-core:2.3-groovy-3.0") {
exclude(mapOf("group" to "org.codehaus.groovy"))
}
pluginsUnderTest("gradle.plugin.com.github.johnrengelman:shadow:$shadowVersion")
pluginsUnderTest("io.github.goooler.shadow:shadow-gradle-plugin:$shadowForkVersion")
pluginsUnderTest("gradle.plugin.com.github.johnrengelman:shadow:7.1.2")
pluginsUnderTest("io.github.goooler.shadow:shadow-gradle-plugin:8.1.8")

testImplementation("org.openjdk.jmh:jmh-core:$jmhVersion")
testImplementation("org.openjdk.jmh:jmh-generator-bytecode:$jmhVersion")
testImplementation("commons-io:commons-io:2.16.1")
}

java {
Expand All @@ -58,7 +54,7 @@ java {
}

jacoco {
toolVersion = jacocoVersion
toolVersion = "0.8.12"
}

tasks.jacocoTestReport {
Expand Down
6 changes: 0 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ project_website=https://github.com/melix/jmh-gradle-plugin
project_issues=https://github.com/melix/jmh-gradle-plugin/issues
project_vcs=https://github.com/melix/jmh-gradle-plugin.git

jacocoVersion = 0.8.12
jmhVersion = 1.37
shadowVersion = 7.1.2
shadowForkVersion = 8.1.8
spockVersion = 2.3-groovy-3.0

org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.caching=true
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.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-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
8 changes: 6 additions & 2 deletions src/funcTest/groovy/me/champeau/jmh/AbstractFuncSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package me.champeau.jmh

import org.apache.commons.io.FileUtils
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.gradle.util.GFileUtils
import org.gradle.util.GradleVersion
import spock.lang.Specification
import spock.lang.TempDir
Expand Down Expand Up @@ -65,13 +65,17 @@ abstract class AbstractFuncSpec extends Specification {
file('build.gradle')
}

File getSettingsFile() {
file('settings.gradle')
}

File getBenchmarksCsv() {
file("build/reports/benchmarks.csv")
}

protected void usingSample(String name) {
File sampleDir = new File("src/funcTest/resources/$name")
GFileUtils.copyDirectory(sampleDir, projectDir)
FileUtils.copyDirectory(sampleDir, projectDir)
}

protected File file(String path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package me.champeau.jmh

import org.gradle.testkit.runner.TaskOutcome
import org.gradle.util.GradleVersion
import spock.lang.Unroll

@Unroll
Expand All @@ -29,6 +30,17 @@ class ProjectWithFeaturePreviewSpec extends AbstractFuncSpec {
given:
usingGradleVersion(gradleVersion)
and:
// TODO: we can move this into the test fixture project once we drop support for Gradle 7.x
if (gradleVersion >= GradleVersion.version("8.9")) {
settingsFile.text =
"""
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}\n
""" + settingsFile.text
}
when:
def result = build("jmh")
Expand Down

0 comments on commit 4ade4dc

Please sign in to comment.