Skip to content

Commit

Permalink
Merge pull request #1508 from phac-nml/update-springdoc-openapi-gradl…
Browse files Browse the repository at this point in the history
…e-plugin

Update springdoc openapi gradle plugin
  • Loading branch information
ericenns authored Nov 4, 2024
2 parents 6bc942e + 75cef37 commit 86cdc2f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
6 changes: 2 additions & 4 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
MYSQL_HOST: 127.0.0.1

steps:
- uses: actions/checkout@v3 #Checkout the project from git
- uses: actions/checkout@v4 #Checkout the project from git
- name: Get pnpm store directory
id: pnpm-cache
run: |
Expand All @@ -123,8 +123,6 @@ jobs:
mysql password: ${{ env.MYSQL_PASSWORD }}
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: "2.7"
- name: Set up JDK 11 # Installs java 11
uses: actions/setup-java@v1
with:
Expand All @@ -139,4 +137,4 @@ jobs:
sleep 1
done
- name: Build Documentation Site
run: ./gradlew clean buildDocsSite -Dliquibase.update.database.schema=true -Dspring.datasource.url=jdbc:mysql://${{env.MYSQL_HOST}}:${{env.MYSQL_PORT}}/${{env.MYSQL_DATABASE}} -Dspring.datasource.dbcp2.max-wait=10000
run: ./gradlew clean buildDocsSite -Dliquibase.update.database.schema=true -Dspring.datasource.url=jdbc:mysql://${{env.MYSQL_HOST}}:${{env.MYSQL_PORT}}/${{env.MYSQL_DATABASE}} -Dspring.datasource.dbcp2.max-wait=10000
23 changes: 10 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ dependencies {
implementation(files("${projectDir}/lib/blend4j-0.2.1-2201df9.jar"))

// Runtime dependencies
runtimeOnly("mysql:mysql-connector-java")
runtimeOnly("com.mysql:mysql-connector-j")
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")

// Testing dependencies
Expand Down Expand Up @@ -435,8 +435,14 @@ task<JavaExec>("toolsListExport") {
args("${buildDir}/tools-list.yml")
}

tasks.named<BootRun>("bootRun") {
if (project.gradle.taskGraph.hasTask(":generateOpenApiDocs")) {
task<Exec>("generateJWKKeyStore") {
workingDir(file("${projectDir}/src/main/resources"))
commandLine(listOf("keytool", "-genkeypair", "-alias", "JWK", "-keyalg", "RSA", "-noprompt", "-dname", "CN=irida.bioinformatics.corefacility.ca, OU=ID, O=IRIDA, L=IRIDA, S=IRIDA, C=CA", "-keystore", "jwk-key-store.jks", "-validity", "3650", "-storepass", "SECRET", "-keypass", "SECRET", "-storetype", "PKCS12"))
outputs.file(file("${projectDir}/src/main/resources/jwk-key-store.jks"))
}

openApi {
customBootRun {
val defaultSystemProperties = mapOf(
"spring.profiles.active" to "dev,swagger",
"liquibase.update.database.schema" to "false",
Expand All @@ -445,17 +451,8 @@ tasks.named<BootRun>("bootRun") {
)
val providedSystemProperties = System.getProperties().mapKeys { it.key as String }
val filteredProvidedSystemProperties = providedSystemProperties.filterKeys { it in defaultSystemProperties}
systemProperties(defaultSystemProperties + filteredProvidedSystemProperties)
systemProperties.set(defaultSystemProperties + filteredProvidedSystemProperties)
}
}

task<Exec>("generateJWKKeyStore") {
workingDir(file("${projectDir}/src/main/resources"))
commandLine(listOf("keytool", "-genkeypair", "-alias", "JWK", "-keyalg", "RSA", "-noprompt", "-dname", "CN=irida.bioinformatics.corefacility.ca, OU=ID, O=IRIDA, L=IRIDA, S=IRIDA, C=CA", "-keystore", "jwk-key-store.jks", "-validity", "3650", "-storepass", "SECRET", "-keypass", "SECRET", "-storetype", "PKCS12"))
outputs.file(file("${projectDir}/src/main/resources/jwk-key-store.jks"))
}

openApi {
outputDir.set(file("${projectDir}/doc/swagger-ui"))
outputFileName.set("open-api.json")
waitTimeInSeconds.set(60)
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pluginManagement {
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("org.gradle.test-retry") version "1.4.0"
id("org.springframework.boot") version "2.7.6"
id("org.springdoc.openapi-gradle-plugin") version "1.3.4"
id("org.springdoc.openapi-gradle-plugin") version "1.9.0"
}
}

Expand Down

0 comments on commit 86cdc2f

Please sign in to comment.