Skip to content

Commit fefeed9

Browse files
refactor: flatten plugin module into repository root
Co-authored-by: deweyjose <deweyjose@users.noreply.github.com>
1 parent 060de01 commit fefeed9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+132
-157
lines changed

.github/workflows/coverage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727
uses: actions/upload-artifact@v4
2828
with:
2929
name: jacoco-report
30-
path: graphqlcodegen-maven-plugin/target/site/jacoco
30+
path: target/site/jacoco
3131

3232
- name: JaCoCo Report
3333
uses: madrapps/jacoco-report@v1.7.2
3434
with:
35-
paths: graphqlcodegen-maven-plugin/target/site/jacoco/jacoco.xml
35+
paths: target/site/jacoco/jacoco.xml
3636
token: ${{ secrets.GITHUB_TOKEN }}
3737
min-coverage-overall: 80
3838
min-coverage-changed-files: 90
@@ -42,7 +42,7 @@ jobs:
4242
- name: Generate Coverage Badge
4343
uses: cicirello/jacoco-badge-generator@v2
4444
with:
45-
jacoco-csv-file: graphqlcodegen-maven-plugin/target/site/jacoco/jacoco.csv
45+
jacoco-csv-file: target/site/jacoco/jacoco.csv
4646
badges-directory: badges
4747

4848
- name: Commit and push coverage badge
@@ -61,7 +61,7 @@ jobs:
6161
uses: peaceiris/actions-gh-pages@v4
6262
with:
6363
github_token: ${{ secrets.GITHUB_TOKEN }}
64-
publish_dir: ./graphqlcodegen-maven-plugin/target/site/jacoco
64+
publish_dir: ./target/site/jacoco
6565
publish_branch: gh-pages
6666

6767
permissions:

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
gpg-passphrase: MAVEN_GPG_PASSPHRASE
3737

3838
- name: Publish graphqlcodegen-maven-plugin to Apache Maven Central
39-
run: ./mvnw -Prelease deploy -pl graphqlcodegen-maven-plugin -am
39+
run: ./mvnw -Prelease deploy
4040
env:
4141
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
4242
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

Agents.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ Quick guide for cloud/cursor agents working in this repository.
66

77
## Repository layout
88

9-
- `graphqlcodegen-maven-plugin`: actual Maven plugin users consume.
10-
- `graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen/CodeGenConfigBuilder.java`: checked-in builder that mirrors upstream DGS `CodeGenConfig`.
11-
- root `pom.xml`: parent/dependency management.
9+
- `src/main/java/io/github/deweyjose/graphqlcodegen`: main plugin source.
10+
- `src/main/java/io/github/deweyjose/graphqlcodegen/CodeGenConfigBuilder.java`: checked-in builder that mirrors upstream DGS `CodeGenConfig`.
11+
- root `pom.xml`: single-module plugin build descriptor.
1212

1313
## Common workflow for DGS option updates
1414

1515
1. Check issue + upstream Netflix DGS release notes.
1616
2. Confirm `graphql-dgs-codegen-core.version` in root `pom.xml`.
1717
3. Expose new option in:
18-
- `graphqlcodegen-maven-plugin/src/main/java/.../Codegen.java` (`@Parameter`)
18+
- `src/main/java/.../Codegen.java` (`@Parameter`)
1919
- `CodegenConfigProvider.java` (getter method)
2020
- `CodegenExecutor.java` (forward to `CodeGenConfigBuilder`)
2121
4. Add/update tests in `CodegenExecutorTest` and fixtures under `src/test/resources/schema`.
@@ -40,7 +40,7 @@ Prefer Maven wrapper:
4040

4141
```bash
4242
./mvnw spotless:apply
43-
./mvnw -pl graphqlcodegen-maven-plugin test
43+
./mvnw test
4444
```
4545

4646
## Important gotcha
@@ -53,7 +53,7 @@ upstream `CodeGenConfig`, then wire any new options through `Codegen.java`/`Code
5353

5454
Current plugin artifact version is in:
5555

56-
- `graphqlcodegen-maven-plugin/pom.xml` -> `<version>`
56+
- `pom.xml` -> `<version>`
5757

5858
After bumping:
5959

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ Found [here](https://github.com/Netflix/dgs-codegen).
99

1010
# Architecture
1111

12-
This project is organized as a single Maven module:
12+
This project is organized as a single Maven module at the repository root:
1313

1414
## graphqlcodegen-maven-plugin
1515
This is the Maven plugin that users apply to their projects. It provides goals for generating Java (or Kotlin) code from GraphQL schemas, mirroring the functionality of the Netflix DGS Gradle codegen plugin. It is responsible for:
1616
- Accepting configuration via plugin parameters.
1717
- Resolving schema files from the local project and dependencies.
1818
- Invoking the DGS codegen library with the correct configuration.
1919
- Managing incremental code generation and manifest tracking.
20-
- Holding a checked-in `CodeGenConfigBuilder` (`graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen`) that mirrors the upstream `CodeGenConfig` constructor shape.
20+
- Holding a checked-in `CodeGenConfigBuilder` (`src/main/java/io/github/deweyjose/graphqlcodegen`) that mirrors the upstream `CodeGenConfig` constructor shape.
2121

2222
# Contributing
2323

@@ -34,16 +34,16 @@ When constructor parameters change upstream:
3434

3535
- Update `CodeGenConfigBuilder` to match the latest constructor shape and ordering.
3636
- Wire new options through:
37-
- `graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen/Codegen.java`
38-
- `graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen/CodegenConfigProvider.java`
39-
- `graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen/CodegenExecutor.java`
37+
- `src/main/java/io/github/deweyjose/graphqlcodegen/Codegen.java`
38+
- `src/main/java/io/github/deweyjose/graphqlcodegen/CodegenConfigProvider.java`
39+
- `src/main/java/io/github/deweyjose/graphqlcodegen/CodegenExecutor.java`
4040
- Add/update tests and document options in this README.
4141

4242
Process:
4343

4444
1. Bump the version in [pom.xml](pom.xml)
4545
2. Run `mvn spotless:apply clean install` locally to ensure the project still builds and is formatted
46-
3. Adjust [Codegen](graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen/Codegen.java) and related classes to support new options if needed
46+
3. Adjust [Codegen](src/main/java/io/github/deweyjose/graphqlcodegen/Codegen.java) and related classes to support new options if needed
4747
4. **Test with the example project:**
4848
- Clone [graphqlcodegen-example](https://github.com/deweyjose/graphqlcodegen-example)
4949
- Bump the plugin version in its `pom.xml` to match your changes

graphqlcodegen-maven-plugin/pom.xml

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

pom.xml

Lines changed: 114 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>io.github.deweyjose</groupId>
8-
<artifactId>graphqlcodegen-parent</artifactId>
9-
<packaging>pom</packaging>
10-
<version>0.0.1-SNAPSHOT</version>
8+
<artifactId>graphqlcodegen-maven-plugin</artifactId>
9+
<packaging>maven-plugin</packaging>
10+
<version>3.7.1</version>
1111

12-
<name>GraphQL Code Generator Parent</name>
13-
<description>Maven port of the Netflix DGS GraphQL Codegen gradle build plugin</description>
12+
<name>GraphQL Code Generator Maven Plugin</name>
13+
<description>Maven plugin for GraphQL code generation</description>
1414
<url>https://github.com/deweyjose/graphqlcodegen</url>
1515

16-
<modules>
17-
<module>graphqlcodegen-maven-plugin</module>
18-
</modules>
19-
2016
<licenses>
2117
<license>
2218
<name>The Apache Software License, Version 2.0</name>
@@ -141,14 +137,122 @@
141137
</dependencies>
142138
</dependencyManagement>
143139

140+
<dependencies>
141+
<dependency>
142+
<groupId>com.squareup</groupId>
143+
<artifactId>kotlinpoet-jvm</artifactId>
144+
</dependency>
145+
<dependency>
146+
<groupId>org.apache.maven</groupId>
147+
<artifactId>maven-plugin-api</artifactId>
148+
<scope>provided</scope>
149+
</dependency>
150+
<dependency>
151+
<groupId>org.apache.maven.plugin-tools</groupId>
152+
<artifactId>maven-plugin-annotations</artifactId>
153+
<scope>provided</scope>
154+
</dependency>
155+
<dependency>
156+
<groupId>org.apache.maven</groupId>
157+
<artifactId>maven-core</artifactId>
158+
<scope>provided</scope>
159+
</dependency>
160+
<dependency>
161+
<groupId>com.netflix.graphql.dgs.codegen</groupId>
162+
<artifactId>graphql-dgs-codegen-core</artifactId>
163+
</dependency>
164+
<dependency>
165+
<groupId>org.projectlombok</groupId>
166+
<artifactId>lombok</artifactId>
167+
<scope>provided</scope>
168+
</dependency>
169+
<dependency>
170+
<groupId>ch.qos.logback</groupId>
171+
<artifactId>logback-classic</artifactId>
172+
</dependency>
173+
<dependency>
174+
<groupId>nu.studer</groupId>
175+
<artifactId>java-ordered-properties</artifactId>
176+
</dependency>
177+
<dependency>
178+
<groupId>org.junit.jupiter</groupId>
179+
<artifactId>junit-jupiter-engine</artifactId>
180+
<scope>test</scope>
181+
</dependency>
182+
<dependency>
183+
<groupId>org.junit.jupiter</groupId>
184+
<artifactId>junit-jupiter-params</artifactId>
185+
<scope>test</scope>
186+
</dependency>
187+
<dependency>
188+
<groupId>org.mockito</groupId>
189+
<artifactId>mockito-core</artifactId>
190+
<scope>test</scope>
191+
</dependency>
192+
<dependency>
193+
<groupId>com.graphql-java</groupId>
194+
<artifactId>graphql-java</artifactId>
195+
</dependency>
196+
<dependency>
197+
<groupId>com.fasterxml.jackson.core</groupId>
198+
<artifactId>jackson-databind</artifactId>
199+
</dependency>
200+
</dependencies>
201+
144202
<distributionManagement>
145203
<repository>
146204
<id>ossrh</id>
147205
<url>https://ossrh-staging-api.central.sonatype.com</url>
148206
</repository>
149207
</distributionManagement>
150208

151-
<build>
209+
<build>
210+
<plugins>
211+
<plugin>
212+
<groupId>org.codehaus.mojo</groupId>
213+
<artifactId>flatten-maven-plugin</artifactId>
214+
<configuration>
215+
<outputDirectory>target/flattened-pom</outputDirectory>
216+
</configuration>
217+
<executions>
218+
<execution>
219+
<id>flatten</id>
220+
<phase>process-resources</phase>
221+
<goals>
222+
<goal>flatten</goal>
223+
</goals>
224+
</execution>
225+
<execution>
226+
<id>flatten.clean</id>
227+
<phase>clean</phase>
228+
<goals>
229+
<goal>clean</goal>
230+
</goals>
231+
</execution>
232+
</executions>
233+
</plugin>
234+
<plugin>
235+
<groupId>org.apache.maven.plugins</groupId>
236+
<artifactId>maven-plugin-plugin</artifactId>
237+
<configuration>
238+
<goalPrefix>graphqlcodegen</goalPrefix>
239+
</configuration>
240+
</plugin>
241+
<plugin>
242+
<groupId>com.diffplug.spotless</groupId>
243+
<artifactId>spotless-maven-plugin</artifactId>
244+
</plugin>
245+
<plugin>
246+
<groupId>org.jacoco</groupId>
247+
<artifactId>jacoco-maven-plugin</artifactId>
248+
<configuration>
249+
<excludes>
250+
<exclude>io/github/deweyjose/graphqlcodegen/Codegen.java</exclude>
251+
</excludes>
252+
</configuration>
253+
</plugin>
254+
</plugins>
255+
152256
<pluginManagement>
153257
<plugins>
154258
<plugin>

graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen/CodeGenConfigBuilder.java renamed to src/main/java/io/github/deweyjose/graphqlcodegen/CodeGenConfigBuilder.java

File renamed without changes.

graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen/Codegen.java renamed to src/main/java/io/github/deweyjose/graphqlcodegen/Codegen.java

File renamed without changes.

graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen/CodegenConfigProvider.java renamed to src/main/java/io/github/deweyjose/graphqlcodegen/CodegenConfigProvider.java

File renamed without changes.

graphqlcodegen-maven-plugin/src/main/java/io/github/deweyjose/graphqlcodegen/CodegenExecutor.java renamed to src/main/java/io/github/deweyjose/graphqlcodegen/CodegenExecutor.java

File renamed without changes.

0 commit comments

Comments
 (0)