Skip to content

Commit f73d894

Browse files
authored
Merge pull request #103 from domaframework/refactor/improve-project-structure-2
Improve project structure and build configuration
2 parents 27d762d + 575b7a4 commit f73d894

34 files changed

+162
-771
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,15 @@ jobs:
2020
distribution: 'zulu'
2121
java-version: 21
2222

23-
- name: Grant execute permission for compile-java-test/gradlew
24-
working-directory: ./compile-java-test
23+
- name: Grant execute permission for compile/gradlew
24+
working-directory: ./compile
2525
run: chmod +x gradlew
2626

27-
- name: Grant execute permission for compile-kotlin-test/gradlew
28-
working-directory: ./compile-kotlin-test
29-
run: chmod +x gradlew
30-
31-
- name: Grant execute permission for compile-mix-test/gradlew
32-
working-directory: ./compile-mix-test
33-
run: chmod +x gradlew
34-
35-
- name: Build plugin
36-
run: ./gradlew build
37-
38-
- name: Test plugin against Java
39-
working-directory: ./compile-java-test
40-
run: ./gradlew build
41-
42-
- name: Test plugin against Kotlin
43-
working-directory: ./compile-kotlin-test
27+
- name: Build compile-plugin
28+
working-directory: ./compile
4429
run: ./gradlew build
4530

46-
- name: Test plugin against a mix of Java and Kotlin
47-
working-directory: ./compile-mix-test
31+
- name: Test
4832
run: ./gradlew build
4933

5034
- name: Set version
@@ -55,5 +39,6 @@ jobs:
5539
run: echo ${{ steps.set-version.outputs.version }}
5640

5741
- name: Publish plugin
42+
working-directory: ./compile
5843
if: github.event_name == 'push' && endsWith(steps.set-version.outputs.version, 'SNAPSHOT') == false
5944
run: ./gradlew publishPlugins -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
/.metadata
99
/.idea/
1010
.factorypath
11+
/.claude/

CLAUDE.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,14 @@ The Doma Compile Plugin is a Gradle plugin that allows annotation processors to
1010

1111
### Building the Plugin
1212
```bash
13-
./gradlew build
13+
cd compile && ./gradlew build && cd ..
1414
```
1515

1616
### Running Tests
17-
The plugin has three test suites that must be run in sequence:
17+
The plugin has three test suites:
1818
```bash
19-
# Build the plugin first
19+
# Build the all test projects
2020
./gradlew build
21-
22-
# Test with Java
23-
cd compile-java-test && ./gradlew build && cd ..
24-
25-
# Test with Kotlin
26-
cd compile-kotlin-test && ./gradlew build && cd ..
27-
28-
# Test with mixed Java/Kotlin
29-
cd compile-mix-test && ./gradlew build && cd ..
3021
```
3122

3223
### Code Formatting
@@ -37,17 +28,17 @@ cd compile-mix-test && ./gradlew build && cd ..
3728

3829
### Running a Single Test
3930
```bash
40-
# In any test directory (compile-java-test, compile-kotlin-test, or compile-mix-test)
41-
./gradlew test --tests "example.GenerationTest"
31+
# With any test project (compile-java-test, compile-kotlin-test, or compile-mix-test)
32+
./gradlew :compile-java-test:test --tests "example.GenerationTest"
4233
```
4334

4435
### Publishing (for maintainers)
4536
```bash
4637
# Release a new version (from master branch only)
47-
./gradlew release
38+
cd compile && ./gradlew release && cd ..
4839

4940
# Publish to Gradle Plugin Portal (handled by CI for non-SNAPSHOT versions)
50-
./gradlew publishPlugins -Pgradle.publish.key=<key> -Pgradle.publish.secret=<secret>
41+
cd compile && ./gradlew publishPlugins -Pgradle.publish.key=<key> -Pgradle.publish.secret=<secret> && cd..
5142
```
5243

5344
## Architecture

build.gradle.kts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
plugins {
22
java
3-
id("net.researchgate.release") version "3.1.0"
3+
alias(libs.plugins.spotless)
44
}
55

6-
configure<net.researchgate.release.ReleaseExtension> {
7-
newVersionCommitMessage.set("[Gradle Release Plugin] - [skip ci] new version commit: ")
8-
tagTemplate.set("v\$version")
9-
git {
10-
requireBranch.set("master")
11-
}
12-
}
6+
val catalog = libs
137

148
allprojects {
15-
apply(plugin = "java")
16-
tasks {
17-
test {
18-
useJUnitPlatform()
9+
apply(plugin = catalog.plugins.spotless.get().pluginId)
10+
11+
spotless {
12+
java {
13+
googleJavaFormat(libs.versions.google.java.format.get())
1914
}
2015
}
21-
}
16+
17+
repositories {
18+
mavenCentral()
19+
}
20+
}

compile-java-test/build.gradle.kts

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
buildscript {
2-
repositories {
3-
mavenCentral()
4-
mavenLocal()
5-
maven {
6-
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
7-
}
8-
}
9-
dependencies {
10-
classpath("org.domaframework.doma:compile")
11-
}
12-
}
13-
141
plugins {
15-
id("java")
2+
java
163
id("org.domaframework.doma.compile")
174
}
185

19-
val domaVersion = "3.9.1"
206

217
java {
22-
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
8+
toolchain.languageVersion.set(JavaLanguageVersion.of(libs.versions.java.get().toInt()))
239
}
2410

2511
tasks {
@@ -28,20 +14,12 @@ tasks {
2814
}
2915
}
3016

31-
repositories {
32-
mavenCentral()
33-
mavenLocal()
34-
maven {
35-
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
36-
}
37-
}
38-
3917
dependencies {
40-
annotationProcessor("org.seasar.doma:doma-processor:$domaVersion")
41-
implementation("org.seasar.doma:doma-core:$domaVersion")
18+
annotationProcessor(libs.doma.processor)
19+
implementation(libs.doma.core)
4220
// Use JUnit BOM for version management
43-
testImplementation(platform("org.junit:junit-bom:5.13.2"))
44-
testImplementation("org.junit.jupiter:junit-jupiter-api")
45-
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
46-
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
21+
testImplementation(platform(libs.junit.bom))
22+
testImplementation(libs.junit.jupiter.api)
23+
testRuntimeOnly(libs.junit.jupiter.engine)
24+
testRuntimeOnly(libs.junit.platform.launcher)
4725
}
-57.3 KB
Binary file not shown.

compile-java-test/gradle/wrapper/gradle-wrapper.properties

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

compile-java-test/gradlew

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

0 commit comments

Comments
 (0)