Skip to content

Commit

Permalink
Update to Gradle 8.4 to match main rewrite build
Browse files Browse the repository at this point in the history
  • Loading branch information
sambsnyd committed Oct 17, 2023
1 parent 6696cc5 commit 0525fd9
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 30 deletions.
17 changes: 12 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,75 +30,81 @@ nexusPublishing {
}
}

pluginBundle {
gradlePlugin {
website = "https://github.com/openrewrite/rewrite-build-gradle-plugin"
vcsUrl = "https://github.com/openrewrite/rewrite-build-gradle-plugin.git"
tags = listOf("rewrite", "refactoring", "java")
}

gradlePlugin {
plugins {
create("build-language-library") {
id = "org.openrewrite.build.language-library"
displayName = "Rewrite language library"
description = "Core language module"
implementationClass = "org.openrewrite.gradle.RewriteLanguageLibraryPlugin"
tags = listOf("rewrite", "refactoring")
}
create("build-recipe-library") {
id = "org.openrewrite.build.recipe-library"
displayName = "Rewrite recipe library"
description = "A recipe library"
implementationClass = "org.openrewrite.gradle.RewriteRecipeLibraryPlugin"
tags = listOf("rewrite", "refactoring")
}
create("build-java-base") {
id = "org.openrewrite.build.java-base"
displayName = "Rewrite Java"
description = "A module that is built with Java but does not publish artifacts"
implementationClass = "org.openrewrite.gradle.RewriteJavaPlugin"
tags = listOf("rewrite", "refactoring")
}
create("build-publish") {
id = "org.openrewrite.build.publish"
displayName = "Rewrite Maven publishing"
description = "Configures publishing to Maven repositories"
implementationClass = "org.openrewrite.gradle.RewritePublishPlugin"
tags = listOf("rewrite", "refactoring")
}
create("build-shadow") {
id = "org.openrewrite.build.shadow"
displayName = "Rewrite shadow configuration"
description = "Configures the Gradle Shadow plugin to replace the normal jar task output with " +
"the shaded jar without a classifier"
implementationClass = "org.openrewrite.gradle.RewriteShadowPlugin"
tags = listOf("rewrite", "refactoring")
}
create("build-metadata") {
id = "org.openrewrite.build.metadata"
displayName = "Rewrite metadata configuration"
description = "Contacts and SCM data"
implementationClass = "org.openrewrite.gradle.RewriteMetadataPlugin"
tags = listOf("rewrite", "refactoring")
}
create("build-java8-text-blocks") {
id = "org.openrewrite.build.java8-text-blocks"
displayName = "Java 8 text blocks"
description = "Text blocks compiled to Java 8 bytecode"
implementationClass = "org.openrewrite.gradle.RewriteJava8TextBlocksPlugin"
tags = listOf("rewrite", "refactoring")
}
create("build-root") {
id = "org.openrewrite.build.root"
displayName = "Rewrite root"
description = "Configures the root project"
implementationClass = "org.openrewrite.gradle.RewriteRootProjectPlugin"
tags = listOf("rewrite", "refactoring")
}
create("build-recipe-author-attribution") {
id = "org.openrewrite.build.recipe-author-attribution"
displayName = "Rewrite recipe author attribution"
description = "Produces a `/META-INF/rewrite/recipe-authors.yml` file containing recipe author attribution"
implementationClass = "org.openrewrite.gradle.RewriteRecipeAuthorAttributionPlugin"
tags = listOf("rewrite", "refactoring")
}

create("build-recipe-examples") {
id = "org.openrewrite.build.recipe-examples"
displayName = "Rewrite recipe examples"
description = "Produces a `/META-INF/rewrite/recipe-example.yml` file containing recipe examples"
implementationClass = "org.openrewrite.gradle.RewriteRecipeExamplesPlugin"
tags = listOf("rewrite", "refactoring")
}
}
}
Expand Down Expand Up @@ -188,6 +194,7 @@ dependencies {

project.rootProject.tasks.getByName("postRelease").dependsOn(project.tasks.getByName("publishPlugins"))


tasks.withType<Test>() {
useJUnitPlatform()
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# 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

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/openrewrite/gradle/ExamplesExtractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import lombok.Data;
import org.intellij.lang.annotations.Language;
import org.openrewrite.ExecutionContext;
import org.openrewrite.PathUtils;
import org.openrewrite.SourceFile;
import org.openrewrite.config.RecipeExample;
import org.openrewrite.internal.StringUtils;
Expand Down Expand Up @@ -250,7 +251,7 @@ String print(String recipeType,
}

if (StringUtils.isNotEmpty(source.getPath())) {
sourceData.put("path", source.getPath());
sourceData.put("path", PathUtils.separatorsToUnix(source.getPath()));
}

if (StringUtils.isNotEmpty(source.getLanguage())) {
Expand Down
22 changes: 11 additions & 11 deletions src/test/java/org/openrewrite/gradle/ExamplesExtractorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,15 +546,15 @@ void extractYamlRecipe() {
java(
"""
package org.openrewrite.java.migrate.net;
import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.config.Environment;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
import static org.openrewrite.java.Assertions.java;
class JavaNetAPIsTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
Expand All @@ -564,7 +564,7 @@ public void defaults(RecipeSpec spec) {
.build()
.activateRecipes("org.openrewrite.java.migrate.net.JavaNetAPIs"));
}
@DocumentExample
@Test
void multicastSocketGetTTLToGetTimeToLive() {
Expand All @@ -573,9 +573,9 @@ void multicastSocketGetTTLToGetTimeToLive() {
java(
""\"
package org.openrewrite.example;
import java.net.MulticastSocket;
public class Test {
public static void method() {
MulticastSocket s = new MulticastSocket(0);
Expand All @@ -585,9 +585,9 @@ public static void method() {
""\",
""\"
package org.openrewrite.example;
import java.net.MulticastSocket;
public class Test {
public static void method() {
MulticastSocket s = new MulticastSocket(0);
Expand All @@ -613,9 +613,9 @@ public static void method() {
sources:
- before: |
package org.openrewrite.example;
import java.net.MulticastSocket;
public class Test {
public static void method() {
MulticastSocket s = new MulticastSocket(0);
Expand All @@ -624,9 +624,9 @@ public static void method() {
}
after: |
package org.openrewrite.example;
import java.net.MulticastSocket;
public class Test {
public static void method() {
MulticastSocket s = new MulticastSocket(0);
Expand Down

0 comments on commit 0525fd9

Please sign in to comment.