Skip to content

Commit a0e4c38

Browse files
committed
Merge refactoring changes into master
- Update build configuration for Gradle 9 and modern publishing - Replace Travis CI with GitHub Actions - Add plugin descriptor for de.inetsoftware.gradle.js - Fix Gradle 9 compatibility for all classes - Add PatternSetFactory injection to all SourceTask subclasses - Remove AntBuilder usage from tests - Update to Gradle 9.2.1
2 parents 11d1f74 + 81633af commit a0e4c38

24 files changed

+671
-32388
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
jobs:
10+
build:
11+
name: Build and Test
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
java-version: ['17', '21']
17+
gradle-version: ['8.14', '9.2.1']
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up JDK ${{ matrix.java-version }}
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: ${{ matrix.java-version }}
27+
distribution: 'temurin'
28+
29+
- name: Setup Gradle ${{ matrix.gradle-version }}
30+
uses: gradle/gradle-build-action@v2
31+
with:
32+
gradle-version: ${{ matrix.gradle-version }}
33+
34+
- name: Cache Gradle dependencies
35+
uses: actions/cache@v3
36+
with:
37+
path: |
38+
~/.gradle/caches
39+
~/.gradle/wrapper
40+
key: ${{ runner.os }}-gradle-${{ matrix.gradle-version }}-${{ hashFiles('**/*.gradle*') }}
41+
restore-keys: |
42+
${{ runner.os }}-gradle-${{ matrix.gradle-version }}-
43+
${{ runner.os }}-gradle-
44+
45+
- name: Run tests with Gradle ${{ matrix.gradle-version }}
46+
run: gradle clean test --no-daemon
47+
48+
- name: Build plugin with Gradle ${{ matrix.gradle-version }}
49+
run: gradle clean build -x test --no-daemon
50+
51+
- name: Validate plugin
52+
run: gradle validatePlugins --no-daemon
53+
54+
- name: Upload test results
55+
if: always()
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: test-results-java${{ matrix.java-version }}-gradle${{ matrix.gradle-version }}
59+
path: build/test-results/
60+
retention-days: 7
61+
62+
- name: Upload build artifacts
63+
if: matrix.java-version == '17' && matrix.gradle-version == '9.2.1'
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: build-artifacts
67+
path: build/libs/*.jar
68+
retention-days: 1
69+

.github/workflows/release.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on tags like v2.18.0, v2.19.0, etc.
7+
- '[0-9]+.[0-9]+*' # Also supports tags like 2.18.0, 2.19.0, etc.
8+
9+
jobs:
10+
release:
11+
name: Build and Release
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: write # Required to create releases and push tags
16+
id-token: write # Required for OIDC if using
17+
pull-requests: read # May be needed for some operations
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # Need full history for changelog extraction
24+
25+
- name: Set up JDK
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: '17'
29+
distribution: 'temurin'
30+
31+
- name: Setup Gradle
32+
uses: gradle/gradle-build-action@v2
33+
with:
34+
gradle-version: wrapper # Use wrapper version
35+
36+
- name: Cache Gradle dependencies
37+
uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.gradle/caches
41+
~/.gradle/wrapper
42+
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle*') }}
43+
restore-keys: |
44+
${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}-
45+
${{ runner.os }}-gradle-
46+
47+
- name: Extract version from tag
48+
id: version
49+
run: |
50+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
51+
# Tag format: v2.18.0 -> 2.18.0
52+
VERSION=${GITHUB_REF#refs/tags/v}
53+
else
54+
# Tag format: 2.18.0 -> 2.18.0
55+
VERSION=${GITHUB_REF#refs/tags/}
56+
fi
57+
echo "version=$VERSION" >> $GITHUB_OUTPUT
58+
echo "Extracted version: $VERSION"
59+
60+
- name: Update version in gradle.properties
61+
run: |
62+
sed -i "s/^version = .*/version = ${{ steps.version.outputs.version }}/" gradle.properties
63+
cat gradle.properties
64+
65+
- name: Extract changelog for version
66+
id: changelog
67+
run: |
68+
VERSION="${{ steps.version.outputs.version }}"
69+
echo "Extracting changelog for version: $VERSION"
70+
71+
# Extract changelog section for this version using awk
72+
# Pattern: from "## VERSION" to next "## " or end of file
73+
if [ -f CHANGELOG.md ]; then
74+
CHANGELOG=$(awk -v version="$VERSION" '
75+
BEGIN { found=0; in_section=0 }
76+
/^## / {
77+
if (in_section) exit # Stop at next version section
78+
if ($0 ~ "^## " version "$" || $0 ~ "^## " version " ") {
79+
found=1
80+
in_section=1
81+
next
82+
}
83+
}
84+
in_section { print }
85+
' CHANGELOG.md)
86+
fi
87+
88+
# If empty, try without the "## " prefix
89+
if [ -z "$CHANGELOG" ] && [ -f CHANGELOG.md ]; then
90+
CHANGELOG=$(awk -v version="$VERSION" '
91+
BEGIN { found=0; in_section=0 }
92+
/^## / {
93+
if (in_section) exit
94+
if ($0 ~ "^## " version "$" || $0 ~ "^## " version " ") {
95+
found=1
96+
in_section=1
97+
next
98+
}
99+
}
100+
in_section { print }
101+
' CHANGELOG.md)
102+
fi
103+
104+
# If still empty, use a default message
105+
if [ -z "$CHANGELOG" ]; then
106+
CHANGELOG="See CHANGELOG.md for details."
107+
fi
108+
109+
# Escape for GitHub output (multiline)
110+
{
111+
echo "changelog<<EOF"
112+
echo "$CHANGELOG"
113+
echo "EOF"
114+
} >> $GITHUB_OUTPUT
115+
116+
echo "Changelog extracted (first 200 chars):"
117+
echo "$CHANGELOG" | head -c 200
118+
echo ""
119+
120+
- name: Build plugin
121+
run: gradle clean build -x test --no-daemon
122+
123+
- name: Validate plugin
124+
run: gradle validatePlugins --no-daemon
125+
126+
- name: Publish to Maven Central (Sonatype)
127+
continue-on-error: true
128+
env:
129+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
130+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
131+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
132+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
133+
run: |
134+
gradle publishToSonatype closeStagingRepositories --no-daemon \
135+
-Psigning.key="$SIGNING_KEY" \
136+
-Psigning.password="$SIGNING_PASSWORD"
137+
138+
- name: Publish to Gradle Plugin Portal
139+
continue-on-error: true
140+
env:
141+
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
142+
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
143+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
144+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
145+
run: |
146+
gradle publishPlugins --no-daemon \
147+
-Psigning.key="$SIGNING_KEY" \
148+
-Psigning.password="$SIGNING_PASSWORD"
149+
150+
- name: Create GitHub Release
151+
uses: softprops/action-gh-release@v1
152+
with:
153+
tag_name: ${{ github.ref }}
154+
name: Release ${{ steps.version.outputs.version }}
155+
body: |
156+
## Version ${{ steps.version.outputs.version }}
157+
158+
${{ steps.changelog.outputs.changelog }}
159+
160+
---
161+
162+
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ github.event.before }}...${{ github.ref }}
163+
draft: false
164+
prerelease: false
165+
token: ${{ secrets.GITHUB_TOKEN }}
166+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ out/
99
intellij
1010
gradle.properties
1111
/.DS_Store
12+
**/package-lock.json

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)