-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use gradle multi-projects and add example app stub (#21)
<!-- Thanks for opening a PR! Here are some quick tips: If this is your first time contributing, [read our Contributing Guidelines](https://github.com/openfga/.github/blob/main/CONTRIBUTING.md) to learn how to create an acceptable PR for this repo. By submitting a PR to this repository, you agree to the terms within the [OpenFGA Code of Conduct](https://github.com/openfga/.github/blob/main/CODE_OF_CONDUCT.md) If your PR is under active development, please submit it as a "draft". Once it's ready, open it up for review. --> <!-- Provide a brief summary of the changes --> ## Description <!-- Provide a detailed description of the changes --> Sets up the start of an example app, and restructures the project to a multi-project build so the example can use the starter as a dependency. Structure is now: ```bash fga-spring-boot-starter/ ├─ build.gradle examples/ ├─ servlet/ │ ├─ build.gradle build.gradle ``` ## Review Checklist - [x] I have clicked on ["allow edits by maintainers"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork). - [ ] I have added documentation for new/changed functionality in this PR or in a PR to [openfga.dev](https://github.com/openfga/openfga.dev) [Provide a link to any relevant PRs in the references section above] - [x] The correct base branch is being used, if not `main` - [ ] I have added tests to validate that the change in functionality is working as expected
- Loading branch information
Showing
14 changed files
with
93 additions
and
63 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 |
---|---|---|
@@ -1,78 +1,42 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'org.springframework.boot' version '3.2.2' apply false | ||
id 'io.spring.dependency-management' version '1.1.4' | ||
|
||
id 'java' | ||
id 'com.diffplug.spotless' version '6.25.0' | ||
|
||
id 'maven-publish' | ||
} | ||
|
||
group = "dev.openfga" | ||
version = "0.0.1-SNAPSHOT" | ||
|
||
java { | ||
sourceCompatibility = 17 | ||
targetCompatibility = 17 | ||
} | ||
subprojects { | ||
apply plugin: 'java' | ||
apply plugin: 'com.diffplug.spotless' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
group = "dev.openfga" | ||
version = "0.0.1-SNAPSHOT" | ||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
dependencyManagement { | ||
imports { | ||
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES | ||
java { | ||
sourceCompatibility = 17 | ||
targetCompatibility = 17 | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot' | ||
implementation 'org.springframework.boot:spring-boot-autoconfigure' | ||
implementation 'org.springframework.boot:spring-boot-starter-security' | ||
|
||
api 'dev.openfga:openfga-sdk:0.4.0' | ||
|
||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testImplementation 'org.springframework.security:spring-security-test' | ||
testImplementation 'org.hamcrest:hamcrest:2.2' | ||
testImplementation 'org.mockito:mockito-core:5.11.0' | ||
|
||
|
||
} | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
groupId = "${groupId}" | ||
artifactId = 'openfga-spring-boot-starter' | ||
version = "${version}" | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
from components.java | ||
spotless { | ||
format 'misc', { | ||
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to | ||
target '.gitignore', '*.gradle' | ||
// define the steps to apply to those files | ||
trimTrailingWhitespace() | ||
indentWithSpaces() | ||
endWithNewline() | ||
} | ||
java { | ||
palantirJavaFormat() | ||
removeUnusedImports() | ||
importOrder() | ||
} | ||
} | ||
} | ||
|
||
spotless { | ||
format 'misc', { | ||
// define the files (e.g. '*.gradle', '*.md') to apply `misc` to | ||
target '.gitignore', '*.gradle' | ||
// define the steps to apply to those files | ||
trimTrailingWhitespace() | ||
indentWithSpaces() | ||
endWithNewline() | ||
tasks.register('fmt') { | ||
dependsOn 'spotlessApply' | ||
} | ||
java { | ||
palantirJavaFormat() | ||
removeUnusedImports() | ||
importOrder() | ||
} | ||
} | ||
|
||
tasks.register('fmt') { | ||
dependsOn 'spotlessApply' | ||
} |
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,10 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.2.2' | ||
id 'io.spring.dependency-management' version '1.1.4' | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
implementation project(':openfga-spring-boot-starter') | ||
} |
12 changes: 12 additions & 0 deletions
12
examples/servlet/src/main/java/dev/openfga/example/ServletFgaApp.java
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,12 @@ | ||
package dev.openfga.example; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class ServletFgaApp { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ServletFgaApp.class, args); | ||
} | ||
} |
Empty file.
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,41 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'org.springframework.boot' version '3.2.2' apply false | ||
id 'io.spring.dependency-management' version '1.1.4' | ||
id 'maven-publish' | ||
} | ||
|
||
dependencyManagement { | ||
imports { | ||
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot' | ||
implementation 'org.springframework.boot:spring-boot-autoconfigure' | ||
implementation 'org.springframework.boot:spring-boot-starter-security' | ||
|
||
api 'dev.openfga:openfga-sdk:0.4.0' | ||
|
||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testImplementation 'org.springframework.security:spring-security-test' | ||
testImplementation 'org.hamcrest:hamcrest:2.2' | ||
testImplementation 'org.mockito:mockito-core:5.11.0' | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
groupId = "${groupId}" | ||
artifactId = 'openfga-spring-boot-starter' | ||
version = "${version}" | ||
|
||
from components.java | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
rootProject.name = 'fga-spring-boot-starter' | ||
|
||
include 'openfga-spring-boot-starter' | ||
include 'examples:servlet' |