-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Independent Gradle Project Parser via GradleProjectData model
- Loading branch information
Showing
45 changed files
with
2,405 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
* text eol=lf | ||
|
||
# | ||
# The above will handle all files NOT found below | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# https://github.com/Danimoth/gitattributes | ||
|
||
# These are explicitly windows files and should use crlf | ||
*.bat text eol=crlf | ||
|
||
# These files are text and should be normalized (Convert crlf => lf) | ||
*.bash text eol=lf | ||
*.css text diff=css | ||
*.htm text diff=html | ||
*.html text diff=html | ||
*.java text diff=java | ||
*.sh text eol=lf | ||
|
||
|
||
# These files are binary and should be left untouched | ||
# (binary is a macro for -text -diff) | ||
*.a binary | ||
*.lib binary | ||
*.icns binary | ||
*.png binary | ||
*.jpg binary | ||
*.jpeg binary | ||
*.gif binary | ||
*.ico binary | ||
*.mov binary | ||
*.mp4 binary | ||
*.mp3 binary | ||
*.flv binary | ||
*.fla binary | ||
*.swf binary | ||
*.gz binary | ||
*.zip binary | ||
*.jar binary | ||
*.tar binary | ||
*.tar.gz binary | ||
*.7z binary | ||
*.ttf binary | ||
*.pyc binary | ||
*.gpg binary | ||
*.bin binary | ||
*.exe binary | ||
*.dll binary | ||
*.so binary | ||
*.dylib binary | ||
*.class binary | ||
*.jar binary | ||
*.war binary | ||
*.ear binary | ||
*.rar binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build/ | ||
.gradle/ | ||
out/ | ||
.idea/ | ||
/spring-petclinic/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SBM Gradle Project Parser | ||
The project consists of modules: | ||
- **model** - Defines data structures to be pulled from Gradle Build process via Gradle Tooling API. Also contains utility to query Gradle Build process for a specific model type | ||
- **plugin** - Registers the `GradelProject` data model builder and has logic for creating a serializable instance of the `GradleProjectData` | ||
- **parser** - Defines a `GradelProjectParser` which delegates to `DefaultProjectParser` which is very close to Rewrite's `org.openrewrite.gradle.isolated.DefaultProjectParser`which takes `GradleProjectData` obtained from **model** via **plugin** project as a parameter. | ||
|
||
Use the `GradelProjectParser` as follows: | ||
```java | ||
GradleProjectParser.parse(new File("/Users/aboyko/Documents/STS4-arm/spring-petclinic"), new File("/Users/aboyko/Documents/STS4-arm/spring-petclinic/build.gradle"), new InMemoryExecutionContext(), new DefaultParserConfig()).collect(Collectors.toList()); | ||
``` | ||
Parameters: | ||
1. Project root folder | ||
2. Project build script file | ||
3. Rewrite's `ExecutionContext` | ||
4. `ParserConfig` object. (Typically one would use `DefaultParserConfig`) | ||
|
||
Before making references to the project and using it as a library it is required to build it: | ||
```bash | ||
./gradlew clean build publishToMavenLocal | ||
``` | ||
(It is important to publish to maven local such that when **model** project quries gradle process for the model the plugin is present in the local maven repo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
plugins { | ||
id("org.openrewrite.build.root") version("latest.release") | ||
} | ||
|
||
|
||
allprojects { | ||
group = "org.springframework.sbm.gradle.tooling" | ||
description = "A model for extracting semantic information out of Gradle build files necessary for refactoring them." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
plugins { | ||
java | ||
id("org.springframework.boot") version "3.1.2" | ||
id("io.spring.dependency-management") version "1.1.2" | ||
} | ||
|
||
group = "com.example" | ||
version = "0.0.1-SNAPSHOT" | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation("org.springframework.boot:spring-boot-starter") | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} |
Binary file not shown.
6 changes: 6 additions & 0 deletions
6
sbm-gradle-tooling-model/demo/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.