-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #619 from plantbreeding/gradle-build
Gradle build
- Loading branch information
Showing
10 changed files
with
492 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,35 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ "data-model-separation" ] | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
|
||
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. | ||
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 | ||
|
||
- name: Build with Gradle Wrapper | ||
run: generator/gradlew validate |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
.settings/ | ||
.idea | ||
.vscode/ | ||
.idea | ||
|
||
/_temp | ||
brapi_blueprint.apib | ||
|
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,3 @@ | ||
.gradle | ||
build | ||
!gradle/wrapper/gradle-wrapper.jar |
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,38 @@ | ||
|
||
# BrAPI Schema Generator | ||
|
||
Generates the OpenAPI Specification, GraphQL Schema and OWL Model from the JSON Schema. | ||
The files are generated in the Specification/Generated directory. | ||
|
||
### How to use | ||
|
||
To generate all use the following | ||
|
||
* In windows | ||
|
||
```powershell | ||
./gradlew generateAll | ||
``` | ||
|
||
* In Linux or macOS | ||
|
||
```shell | ||
./gradle generateAll | ||
``` | ||
For individual tasks try | ||
|
||
* *generateGraphQL* to generate the GraphQL Schema from the JSON Schema | ||
* *generateOpenAPI* to generate the OpenAPI Specification from the JSON Schema | ||
* *generateOWL* to generate the OWL Model from the JSON Schema | ||
* *validate* to validate the JSON Schema without generating any file | ||
|
||
The files are generated in the Specification/Generated directory. | ||
|
||
to change the version of BrAPI used in the file name edit the *brapiVersion* in | ||
[Settings](settings.gradle). | ||
|
||
### Configuration | ||
|
||
To configure the generator see https://github.com/plantbreeding/brapi-schema-tools | ||
|
||
|
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,72 @@ | ||
apply plugin : "java" | ||
ext { | ||
javaMainClass = 'org.brapi.schematools.cli.BrAPICommand' | ||
brapiSchemaToolsVersion = '0.10.0-SNAPSHOT' | ||
brapiVersion = 'v2_1' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven {url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'} | ||
} | ||
|
||
dependencies { | ||
implementation "org.brapi:brapi-schema-tools-cli:$brapiSchemaToolsVersion" | ||
} | ||
|
||
tasks.register("validate", JavaExec) { | ||
group = 'BrAPI' | ||
description = 'Validate the Json Schema' | ||
classpath = sourceSets.main.runtimeClasspath | ||
mainClass = javaMainClass | ||
workingDir = '../' | ||
args = ['validate', 'Specification/BrAPI-Schema', '-x'] | ||
} | ||
|
||
tasks.register("generateGraphQL", JavaExec) { | ||
group = 'BrAPI' | ||
description = 'Generate GraphQL schema from the Json Schema' | ||
classpath = sourceSets.main.runtimeClasspath | ||
mainClass = javaMainClass | ||
workingDir = '../' | ||
def filename = "Specification/Generated/brapi_" + brapiVersion + ".graphqls" | ||
args = ['generate', | ||
'Specification/BrAPI-Schema', | ||
'-l', 'GRAPHQL', | ||
'-f', filename, | ||
'-x'] | ||
} | ||
|
||
tasks.register("generateOpenAPI", JavaExec) { | ||
group = 'BrAPI' | ||
description = 'Generate OpenAPI schema from the Json Schema' | ||
classpath = sourceSets.main.runtimeClasspath | ||
mainClass = javaMainClass | ||
workingDir = '../' | ||
def filename = "Specification/Generated/brapi_" + brapiVersion + ".json" | ||
args = ['generate', 'Specification/BrAPI-Schema', | ||
'-l', 'OPEN_API', | ||
'-f', filename, | ||
'-c', 'Specification/OpenAPI-Components', | ||
'-x'] | ||
} | ||
|
||
tasks.register("generateOWL", JavaExec) { | ||
group = 'BrAPI' | ||
description = 'Generate OWL schema from the Json Schema' | ||
classpath = sourceSets.main.runtimeClasspath | ||
mainClass = javaMainClass | ||
workingDir = '../' | ||
def filename = "Specification/Generated/brapi_" + brapiVersion + ".ttl" | ||
args = ['generate', 'Specification/BrAPI-Schema', | ||
'-l', 'OWL', | ||
'-f', filename, | ||
'-m', 'generator/ont-model-metadata.yaml', | ||
'-x'] | ||
} | ||
|
||
tasks.register("generateAll") { | ||
dependsOn generateGraphQL | ||
dependsOn generateOpenAPI | ||
dependsOn generateOWL | ||
} |
Binary file not shown.
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,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.