Skip to content

Commit 0bc889d

Browse files
committed
Gemini feedback
1 parent c954e08 commit 0bc889d

File tree

5 files changed

+44
-31
lines changed

5 files changed

+44
-31
lines changed

.enforcer-scripts/validate-jbang-versions.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ def scriptName = project.properties['jbang.script.name']
33

44
// Fail if the script property is missing
55
if (scriptName == null) {
6-
System.err.println("[ERROR] JBang validator: No jbang.script.name set in properties")
76
throw new IllegalStateException("[ERROR] JBang validator: No jbang.script.name set in properties")
87
}
98

109
def jbangFile = new File(project.basedir, scriptName)
1110
if (!jbangFile.exists()) {
1211
// If a script name was explicitly provided but doesn't exist, fail.
1312
// If using the fallback, we might want to just skip (return true).
14-
System.err.println("[INFO] JBang validator: File not found: " + jbangFile.absolutePath)
1513
throw new IllegalStateException("[ERROR] JBang validator: File not found: " + jbangFile.absolutePath)
1614
}
1715

RELEASE.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ The following secrets must be configured in GitHub repository settings:
2727

2828
## Release Steps
2929

30+
The examples below use versions like `0.4.0.Alpha1-SNAPSHOT` and `0.4.0.Alpha1` for demonstration. Be sure to substitute these with the actual versions for your release.
31+
3032
### 1. Prepare Release Version
3133

3234
Use the provided script to update all version numbers:
@@ -46,8 +48,8 @@ The script automatically updates:
4648

4749
**What gets updated**:
4850
```
49-
pom.xml: 0.3.0.Beta1-SNAPSHOT → 0.3.0.Beta1
50-
//DEPS io.github...: 0.3.0.Beta1-SNAPSHOT → 0.3.0.Beta1
51+
pom.xml: 0.4.0.Alpha1-SNAPSHOT → 0.4.0.Alpha1
52+
//DEPS io.github...: 0.4.0.Alpha1-SNAPSHOT → 0.4.0.Alpha1
5153
```
5254

5355
### 2. Verify Changes
@@ -58,11 +60,8 @@ Review the changes before committing:
5860
# Review all changes
5961
git diff
6062

61-
# Verify build with release profile
62-
mvn validate
63-
64-
# Check that JBang validation passes
65-
cd examples/helloworld/client && mvn validate
63+
# Verify build works
64+
mvn clean install
6665
```
6766

6867
### 3. Create Release PR

examples/helloworld/client/pom.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<plugin>
4747
<groupId>org.codehaus.gmavenplus</groupId>
4848
<artifactId>gmavenplus-plugin</artifactId>
49-
<version>3.0.2</version>
5049
<executions>
5150
<execution>
5251
<id>validate-jbang-versions</id>
@@ -61,14 +60,6 @@
6160
</configuration>
6261
</execution>
6362
</executions>
64-
<dependencies>
65-
<dependency>
66-
<groupId>org.apache.groovy</groupId>
67-
<artifactId>groovy</artifactId>
68-
<version>4.0.15</version>
69-
<scope>runtime</scope>
70-
</dependency>
71-
</dependencies>
7263
</plugin>
7364
</plugins>
7465
</build>

pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
4949
<maven-javadoc-plugin.version>3.8.0</maven-javadoc-plugin.version>
5050
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
51+
<gmavenplus-plugin.version>4.2.1</gmavenplus-plugin.version>
5152
<sonatype-central-publishing-plugin.version>0.8.0</sonatype-central-publishing-plugin.version>
53+
<groovy.version>5.0.3</groovy.version>
5254
<gson.version>2.13.2</gson.version>
5355
<jakarta.enterprise.cdi-api.version>4.1.0</jakarta.enterprise.cdi-api.version>
5456
<jakarta.inject.jakarta.inject-api.version>2.0.1</jakarta.inject.jakarta.inject-api.version>
@@ -389,6 +391,25 @@
389391
</systemPropertyVariables>
390392
</configuration>
391393
</plugin>
394+
<plugin>
395+
<groupId>org.codehaus.gmavenplus</groupId>
396+
<artifactId>gmavenplus-plugin</artifactId>
397+
<version>${gmavenplus-plugin.version}</version>
398+
<dependencies>
399+
<dependency>
400+
<groupId>org.apache.groovy</groupId>
401+
<artifactId>groovy</artifactId>
402+
<version>${groovy.version}</version>
403+
<scope>runtime</scope>
404+
</dependency>
405+
<dependency>
406+
<groupId>org.apache.groovy</groupId>
407+
<artifactId>groovy-ant</artifactId>
408+
<version>${groovy.version}</version>
409+
<scope>runtime</scope>
410+
</dependency>
411+
</dependencies>
412+
</plugin>
392413
<plugin>
393414
<groupId>org.apache.maven.plugins</groupId>
394415
<artifactId>maven-jar-plugin</artifactId>

update-version.sh

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,36 @@
33
# Update version across POMs and JBang scripts
44
# Usage: ./update-version.sh FROM_VERSION TO_VERSION [--dry-run]
55

6-
set -e # Exit on error
6+
set -euo pipefail # Exit on error, unset var, and pipe failure
77

88
FROM_VERSION=$1
99
TO_VERSION=$2
10-
DRY_RUN=false
11-
12-
# Check for dry-run flag
13-
if [ "$3" = "--dry-run" ] || [ "$2" = "--dry-run" ]; then
14-
DRY_RUN=true
15-
fi
1610

1711
# Validate arguments
18-
if [ -z "$FROM_VERSION" ]; then
19-
echo "❌ Error: No from version specified"
12+
if [ -z "$FROM_VERSION" ] || [ -z "$TO_VERSION" ]; then
13+
echo "❌ Error: Missing version arguments."
2014
echo "Usage: $0 FROM_VERSION TO_VERSION [--dry-run]"
2115
echo "Example: $0 0.3.0.Beta1-SNAPSHOT 0.3.0.Beta1"
2216
exit 1
2317
fi
2418

25-
if [ -z "$TO_VERSION" ] && [ "$FROM_VERSION" != "--dry-run" ]; then
26-
echo "❌ Error: No to version specified"
19+
# Check if TO_VERSION looks like a flag
20+
if [[ "$TO_VERSION" == --* ]]; then
21+
echo "❌ Error: TO_VERSION cannot be a flag. Did you mean to provide both FROM_VERSION and TO_VERSION?"
2722
echo "Usage: $0 FROM_VERSION TO_VERSION [--dry-run]"
2823
echo "Example: $0 0.3.0.Beta1-SNAPSHOT 0.3.0.Beta1"
2924
exit 1
3025
fi
3126

27+
DRY_RUN=false
28+
if [ "$3" = "--dry-run" ]; then
29+
DRY_RUN=true
30+
elif [ -n "$3" ]; then
31+
echo "❌ Error: Invalid third argument. Only '--dry-run' is supported."
32+
echo "Usage: $0 FROM_VERSION TO_VERSION [--dry-run]"
33+
exit 1
34+
fi
35+
3236
# Verify we're in the right directory
3337
if [ ! -f "pom.xml" ]; then
3438
echo "❌ Error: pom.xml not found. Run this script from the a2a-java root directory."
@@ -89,10 +93,10 @@ for file in $POM_FILES; do
8993
if grep -q "$FROM_VERSION" "$file"; then
9094
if [[ "$OSTYPE" == "darwin"* ]]; then
9195
# macOS requires empty string after -i
92-
sed -i "" -e "s/$FROM_VERSION/$TO_VERSION/g" "$file"
96+
sed -i "" -e "s|>$FROM_VERSION<|>$TO_VERSION<|g" "$file"
9397
else
9498
# Linux doesn't need it
95-
sed -i "s/$FROM_VERSION/$TO_VERSION/g" "$file"
99+
sed -i "s|>$FROM_VERSION<|>$TO_VERSION<|g" "$file"
96100
fi
97101
echo "$file"
98102
UPDATED_POMS=$((UPDATED_POMS + 1))

0 commit comments

Comments
 (0)