swagger subprojects

This commit is contained in:
Ludy87 2025-07-12 00:32:40 +02:00
parent bbf5d5f6d4
commit fc4694b538
No known key found for this signature in database
GPG Key ID: 92696155E0220F94
3 changed files with 5336 additions and 11 deletions

View File

@ -29,7 +29,7 @@ jobs:
- uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 - uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
- name: Generate Swagger documentation - name: Generate Swagger documentation
run: ./gradlew generateOpenApiDocs run: ./gradlew :stirling-pdf:generateOpenApiDocs
- name: Upload Swagger Documentation to SwaggerHub - name: Upload Swagger Documentation to SwaggerHub
run: ./gradlew swaggerhubUpload run: ./gradlew swaggerhubUpload

View File

@ -161,6 +161,44 @@ subprojects {
tasks.named("processResources") { tasks.named("processResources") {
dependsOn(rootProject.tasks.writeVersion) dependsOn(rootProject.tasks.writeVersion)
} }
if (name == 'stirling-pdf') {
apply plugin: 'org.springdoc.openapi-gradle-plugin'
openApi {
apiDocsUrl = "http://localhost:8080/v1/api-docs"
outputDir = file("$projectDir")
outputFileName = "SwaggerDoc.json"
waitTimeInSeconds = 60 // Increase the wait time to 60 seconds
}
tasks.named("forkedSpringBootRun") {
dependsOn(":common:jar")
dependsOn(":proprietary:jar")
}
tasks.register("copySwaggerDoc", Copy) {
doNotTrackState("Writes SwaggerDoc.json to project root")
from(layout.projectDirectory.file("SwaggerDoc.json"))
into(rootProject.projectDir)
dependsOn("generateOpenApiDocs")
}
tasks.register("cleanSwaggerInBuild", Delete) {
doNotTrackState("Cleans up SwaggerDoc.json in build directory")
delete(layout.projectDirectory.file("SwaggerDoc.json"))
dependsOn("copySwaggerDoc")
}
tasks.named("copySwaggerDoc") {
finalizedBy("cleanSwaggerInBuild")
}
tasks.named("generateOpenApiDocs") {
finalizedBy("copySwaggerDoc")
doNotTrackState("OpenAPI plugin writes outside build directory")
}
}
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
@ -204,13 +242,6 @@ sourceSets {
} }
} }
openApi {
apiDocsUrl = "http://localhost:8080/v1/api-docs"
outputDir = file("$projectDir")
outputFileName = "SwaggerDoc.json"
waitTimeInSeconds = 60 // Increase the wait time to 60 seconds
}
// Configure the forked spring boot run task to properly delegate to the stirling-pdf module // Configure the forked spring boot run task to properly delegate to the stirling-pdf module
tasks.named('forkedSpringBootRun') { tasks.named('forkedSpringBootRun') {
dependsOn ':stirling-pdf:bootRun' dependsOn ':stirling-pdf:bootRun'
@ -565,9 +596,6 @@ tasks.register('printMacVersion') {
} }
} }
tasks.named('generateOpenApiDocs') {
doNotTrackState("Tracking state is not supported for this task")
}
tasks.named('bootRun') { tasks.named('bootRun') {
group = 'application' group = 'application'
description = 'Delegates to :stirling-pdf:bootRun' description = 'Delegates to :stirling-pdf:bootRun'

File diff suppressed because it is too large Load Diff