aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-08-21 08:51:07 +0000
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2023-08-21 08:51:45 +0000
commitfa5edccf8d37767c8f9d4dde9a5f65988dbe1242 (patch)
treedf33b464151ace158c08c4903f13c1194fc4d7f5
parent473792061d40a0027b57d65a97f3da06e4b8c7bd (diff)
Use more of the new plugin syntax in the bff build.gradle files
- replace apply plugin with plugin {} block syntax - ultimately the buildscript should be replaced, but that currently leads to a StackOverflow during the build Issue-ID: PORTALNG-42 Change-Id: I6c65127c3f6b8e095ccffb7e930576461fd5901c Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
-rw-r--r--app/build.gradle13
-rw-r--r--lib/build.gradle16
-rw-r--r--openapi/build.gradle27
-rw-r--r--openapi/client-portal-history/build.gradle30
-rw-r--r--openapi/client-portal-keycloak/build.gradle30
-rw-r--r--openapi/client-portal-prefs/build.gradle30
-rw-r--r--openapi/server/build.gradle4
-rw-r--r--settings.gradle23
8 files changed, 122 insertions, 51 deletions
diff --git a/app/build.gradle b/app/build.gradle
index d219c24..4f07bd5 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,8 +1,11 @@
-apply plugin: 'application'
-apply plugin: 'org.springframework.boot'
-apply plugin: 'com.gorylenko.gradle-git-properties'
-apply plugin: 'jacoco'
-apply plugin: 'com.diffplug.spotless'
+plugins {
+ id 'application'
+ id 'org.springframework.boot'
+ id 'io.spring.dependency-management'
+ id 'com.gorylenko.gradle-git-properties'
+ id 'jacoco'
+ id 'com.diffplug.spotless'
+}
dependencyManagement {
imports {
diff --git a/lib/build.gradle b/lib/build.gradle
index ea7dc98..bb4d9f5 100644
--- a/lib/build.gradle
+++ b/lib/build.gradle
@@ -1,10 +1,12 @@
-apply plugin: 'com.gorylenko.gradle-git-properties'
-apply plugin: 'jacoco'
-apply plugin: 'com.github.johnrengelman.shadow'
-apply plugin: 'maven-publish'
-apply plugin: 'java-library'
-apply plugin: 'com.diffplug.spotless'
-apply plugin: 'com.github.spotbugs'
+plugins {
+ id 'com.gorylenko.gradle-git-properties'
+ id 'jacoco'
+ id 'com.github.johnrengelman.shadow'
+ id 'maven-publish'
+ id 'java-library'
+ id 'com.diffplug.spotless'
+ id 'com.github.spotbugs'
+}
group 'org.onap.portalng'
version rootProject.file('version').text.trim()
diff --git a/openapi/build.gradle b/openapi/build.gradle
deleted file mode 100644
index eb39818..0000000
--- a/openapi/build.gradle
+++ /dev/null
@@ -1,27 +0,0 @@
-apply plugin: 'org.openapi.generator'
-
-void createOpenApiGenerateClientTask(Project project, String apiDefinition, String packageName, String dtoSuffix) {
- String taskName = "openApiGenerate_$packageName"
- tasks.create(taskName, org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
- generatorName = "java"
- library = "webclient"
- inputSpec = "${project.projectDir}/src/$apiDefinition".toString()
- outputDir = "${project.buildDir}/openapi".toString()
- configOptions = [
- openApiNullable : "false",
- dateLibrary : "java8",
- serializationLibrary: "jackson"
- ]
- typeMappings = [
- "File": "org.springframework.core.io.buffer.DataBuffer"
- ]
- generateApiTests = false
- generateApiDocumentation = false
- generateModelTests = false
- generateModelDocumentation = false
- invokerPackage = "org.onap.portalng.bff.openapi.$packageName"
- apiPackage = "org.onap.portalng.bff.openapi.${packageName}.api"
- modelPackage = "org.onap.portalng.bff.openapi.${packageName}.model"
- modelNameSuffix = dtoSuffix
- }
-}
diff --git a/openapi/client-portal-history/build.gradle b/openapi/client-portal-history/build.gradle
index 1872713..e692169 100644
--- a/openapi/client-portal-history/build.gradle
+++ b/openapi/client-portal-history/build.gradle
@@ -1,4 +1,6 @@
-apply plugin: 'org.openapi.generator'
+plugins {
+ id 'org.openapi.generator'
+}
dependencies {
implementation "org.springframework.boot:spring-boot-starter-webflux"
@@ -6,8 +8,7 @@ dependencies {
}
compileJava {
- createOpenApiGenerateClientTask(project, "portal_history_openapi.yaml", "client_portal_history", "PortalHistoryDto")
- dependsOn = [':openapi:openApiGenerate_client_portal_history']
+ dependsOn = ['openApiGenerate_history']
}
sourceSets {
@@ -23,3 +24,26 @@ idea {
generatedSourceDirs += file("$buildDir/openapi/src/main/java")
}
}
+
+tasks.register('openApiGenerate_history', org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
+ generatorName = "java"
+ library = "webclient"
+ inputSpec = "${project.projectDir}/src/portal_history_openapi.yaml"
+ outputDir = "${project.buildDir}/openapi"
+ configOptions = [
+ openApiNullable : "false",
+ dateLibrary : "java8",
+ serializationLibrary: "jackson"
+ ]
+ typeMappings = [
+ "File": "org.springframework.core.io.buffer.DataBuffer"
+ ]
+ generateApiTests = false
+ generateApiDocumentation = false
+ generateModelTests = false
+ generateModelDocumentation = false
+ invokerPackage = "org.onap.portalng.bff.openapi.client_portal_history"
+ apiPackage = "org.onap.portalng.bff.openapi.client_portal_history.api"
+ modelPackage = "org.onap.portalng.bff.openapi.client_portal_history.model"
+ modelNameSuffix = "PortalHistoryDto"
+} \ No newline at end of file
diff --git a/openapi/client-portal-keycloak/build.gradle b/openapi/client-portal-keycloak/build.gradle
index f01cf4b..525fa18 100644
--- a/openapi/client-portal-keycloak/build.gradle
+++ b/openapi/client-portal-keycloak/build.gradle
@@ -1,4 +1,6 @@
-apply plugin: 'org.openapi.generator'
+plugins {
+ id 'org.openapi.generator'
+}
dependencies {
implementation "org.springframework.boot:spring-boot-starter-webflux"
@@ -6,8 +8,7 @@ dependencies {
}
compileJava {
- createOpenApiGenerateClientTask(project, "portal_keycloak_openapi.yaml", "client_portal_keycloak", "KeycloakDto")
- dependsOn = [':openapi:openApiGenerate_client_portal_keycloak']
+ dependsOn = ['openApiGenerate_keycloak']
}
sourceSets {
@@ -23,3 +24,26 @@ idea {
generatedSourceDirs += file("$buildDir/openapi/src/main/java")
}
}
+
+tasks.register('openApiGenerate_keycloak', org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
+ generatorName = "java"
+ library = "webclient"
+ inputSpec = "${project.projectDir}/src/portal_keycloak_openapi.yaml"
+ outputDir = "${buildDir}/openapi"
+ configOptions = [
+ openApiNullable : "false",
+ dateLibrary : "java8",
+ serializationLibrary: "jackson"
+ ]
+ typeMappings = [
+ "File": "org.springframework.core.io.buffer.DataBuffer"
+ ]
+ generateApiTests = false
+ generateApiDocumentation = false
+ generateModelTests = false
+ generateModelDocumentation = false
+ invokerPackage = "org.onap.portalng.bff.openapi.client_portal_keycloak"
+ apiPackage = "org.onap.portalng.bff.openapi.client_portal_keycloak.api"
+ modelPackage = "org.onap.portalng.bff.openapi.client_portal_keycloak.model"
+ modelNameSuffix = "KeycloakDto"
+} \ No newline at end of file
diff --git a/openapi/client-portal-prefs/build.gradle b/openapi/client-portal-prefs/build.gradle
index 5201737..cb7122a 100644
--- a/openapi/client-portal-prefs/build.gradle
+++ b/openapi/client-portal-prefs/build.gradle
@@ -1,4 +1,6 @@
-apply plugin: 'org.openapi.generator'
+plugins {
+ id 'org.openapi.generator'
+}
dependencies {
implementation "org.springframework.boot:spring-boot-starter-webflux"
@@ -6,8 +8,7 @@ dependencies {
}
compileJava {
- createOpenApiGenerateClientTask(project, "portal_prefs_openapi.yaml", "client_portal_prefs", "PortalPrefsDto")
- dependsOn = [':openapi:openApiGenerate_client_portal_prefs']
+ dependsOn = ['openApiGenerate_preferences']
}
sourceSets {
@@ -23,3 +24,26 @@ idea {
generatedSourceDirs += file("$buildDir/openapi/src/main/java")
}
}
+
+tasks.register('openApiGenerate_preferences', org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
+ generatorName = "java"
+ library = "webclient"
+ inputSpec = "${project.projectDir}/src/portal_prefs_openapi.yaml"
+ outputDir = "${project.buildDir}/openapi"
+ configOptions = [
+ openApiNullable : "false",
+ dateLibrary : "java8",
+ serializationLibrary: "jackson"
+ ]
+ typeMappings = [
+ "File": "org.springframework.core.io.buffer.DataBuffer"
+ ]
+ generateApiTests = false
+ generateApiDocumentation = false
+ generateModelTests = false
+ generateModelDocumentation = false
+ invokerPackage = "org.onap.portalng.bff.openapi.client_portal_prefs"
+ apiPackage = "org.onap.portalng.bff.openapi.client_portal_prefs.api"
+ modelPackage = "org.onap.portalng.bff.openapi.client_portal_prefs.model"
+ modelNameSuffix = "PortalPrefsDto"
+} \ No newline at end of file
diff --git a/openapi/server/build.gradle b/openapi/server/build.gradle
index f351a5c..6cdc456 100644
--- a/openapi/server/build.gradle
+++ b/openapi/server/build.gradle
@@ -1,4 +1,6 @@
-apply plugin: 'org.openapi.generator'
+plugins {
+ id 'org.openapi.generator'
+}
dependencies {
implementation "org.springframework.boot:spring-boot-starter-webflux"
diff --git a/settings.gradle b/settings.gradle
index 6f97819..f64bf25 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,10 +1,29 @@
-rootProject.name = 'bff'
+// Centrally declare plugin versions here
+pluginManagement {
+ // https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_version_management
+ plugins {
+ id 'io.spring.dependency-management' version '1.1.2'
+ id 'org.springframework.boot' version '3.1.2'
+ id 'com.github.hierynomus.license' version '0.16.1'
+ id 'com.gorylenko.gradle-git-properties' version '2.4.1'
+ id 'org.openapi.generator' version '7.0.0-beta'
+ id 'com.diffplug.spotless' version '6.20.0'
+ id 'com.github.johnrengelman.shadow' version '7.1.2'
+ id 'com.github.spotbugs' version '5.0.14'
+ }
+ // https://docs.gradle.org/current/userguide/plugins.html#sec:custom_plugin_repositories
+ repositories {
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
-include 'app'
+rootProject.name = 'bff'
include 'openapi:server'
include 'openapi:client-portal-prefs'
include 'openapi:client-portal-history'
include 'openapi:client-portal-keycloak'
include 'lib'
+include 'app'