mirror of
https://github.com/google/nomulus
synced 2026-08-17 12:46:11 +00:00
- pr-polisher: Relaxed the package-lock.json strictness. If package.json or dependencies.gradle are modified, changes to package-lock.json now correctly trigger a WARNING rather than a fatal ERROR, streamlining intentional dependency updates. - java-ast-refactoring: Replaced the reliance on a local google-java-format binary with the project's native ./gradlew javaIncrementalFormatApply task for post-AST format fixes. - Updated GEMINI.md and skill instructions to explicitly authorize and mandate the agent to proactively propose systemic infrastructure fixes to the user when it encounters recurring friction, false positives, or brittle workarounds. - Overhauled the PR polisher "When to Use" instructions in GEMINI.md and SKILL.md into a critical mandate explicitly tying the execution of the polisher to the action of making or amending a commit to prevent agent forgetfulness.
81 lines
2.2 KiB
Bash
Executable File
81 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copyright 2026 The Nomulus Authors. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Wrapper script to dynamically execute OpenRewrite without modifying build.gradle
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "Usage: $0 <path-to-rewrite.yml>"
|
|
exit 1
|
|
fi
|
|
|
|
RECIPE_FILE=$(realpath "$1")
|
|
if [ ! -f "$RECIPE_FILE" ]; then
|
|
echo "Error: Recipe file $RECIPE_FILE not found."
|
|
exit 1
|
|
fi
|
|
|
|
# Extract the name of the recipe from the YAML to activate it
|
|
RECIPE_NAME=$(grep -oP '(?<=name: ).*' "$RECIPE_FILE" | head -n 1)
|
|
|
|
if [ -z "$RECIPE_NAME" ]; then
|
|
echo "Error: Could not extract 'name:' from $RECIPE_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
INIT_SCRIPT="rewrite-init.gradle"
|
|
|
|
cat << EOF > "$INIT_SCRIPT"
|
|
initscript {
|
|
repositories {
|
|
mavenCentral()
|
|
gradlePluginPortal()
|
|
}
|
|
dependencies {
|
|
classpath("org.openrewrite.rewrite:org.openrewrite.rewrite.gradle.plugin:7.33.0")
|
|
}
|
|
}
|
|
|
|
rootProject {
|
|
apply plugin: org.openrewrite.gradle.RewritePlugin
|
|
|
|
rewrite {
|
|
activeRecipe("$RECIPE_NAME")
|
|
}
|
|
|
|
dependencies {
|
|
rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:2.14.0")
|
|
rewrite("org.openrewrite.recipe:rewrite-migrate-java:2.11.0")
|
|
rewrite("org.openrewrite.recipe:rewrite-spring:5.7.0")
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
apply plugin: org.openrewrite.gradle.RewritePlugin
|
|
}
|
|
EOF
|
|
|
|
# Copy the recipe file to the workspace root temporarily so OpenRewrite finds it
|
|
cp "$RECIPE_FILE" ./rewrite.yml
|
|
|
|
echo "Executing OpenRewrite recipe: $RECIPE_NAME"
|
|
./gradlew --init-script "$INIT_SCRIPT" rewriteRun --no-parallel --no-configuration-cache
|
|
|
|
echo "Running code formatters to fix Checkstyle line-length and import ordering..."
|
|
./gradlew spotlessApply javaIncrementalFormatApply
|
|
|
|
# Clean up temporary files
|
|
rm "$INIT_SCRIPT"
|
|
rm ./rewrite.yml
|