@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
1212import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
1313import org.openapitools.generator.gradle.plugin.tasks.ValidateTask
1414import org.springframework.boot.gradle.dsl.SpringBootExtension
15- import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
1615import org.springframework.boot.gradle.tasks.bundling.BootJar
1716import org.springframework.boot.gradle.tasks.run.BootRun
1817import pl.allegro.tech.build.axion.release.domain.TagNameSerializationConfig
@@ -42,7 +41,7 @@ version = scmVersion.version
4241
4342val kotlinJvmTarget = 17
4443val cosmotechApiCommonVersion = " 0.1.1-SNAPSHOT"
45- val cosmotechApiAzureVersion = " 0.1.1 -SNAPSHOT"
44+ val cosmotechApiAzureVersion = " 0.1.2 -SNAPSHOT"
4645
4746allprojects {
4847 apply (plugin = " com.diffplug.spotless" )
@@ -328,83 +327,76 @@ subprojects {
328327 }
329328 }
330329
331- if (name.startsWith(" cosmotech-api-common" )) {
332- tasks.getByName<BootJar >(" bootJar" ) { enabled = false }
333- tasks.getByName<BootBuildImage >(" bootBuildImage" ) { enabled = false }
334- tasks.getByName<BootRun >(" bootRun" ) { enabled = false }
335- } else {
336-
337- val openApiFileDefinition =
338- if (name == " cosmotech-api" ) {
339- file(" ${rootDir} /openapi/openapi.yaml" )
340- } else {
341- openApiDefinitionFile
342- }
343- tasks.register<Copy >(" copyOpenApiYamlToMainResources" ) {
344- from(openApiFileDefinition)
345- into(" $buildDir /resources/main/static" )
346- rename { if (it != " openapi.yaml" ) " openapi.yaml" else it }
347- }
348- tasks.register<Copy >(" copyOpenApiYamlToTestResources" ) {
349- from(openApiFileDefinition)
350- into(" $buildDir /resources/test/static" )
351- rename { if (it != " openapi.yaml" ) " openapi.yaml" else it }
352- }
353-
354- tasks.getByName<Copy >(" processResources" ) {
355- dependsOn(" copyOpenApiYamlToMainResources" )
356- filesMatching(" **/banner.txt" ) {
357- filter<ReplaceTokens >(" tokens" to mapOf (" projectVersion" to project.version))
330+ val openApiFileDefinition =
331+ if (name == " cosmotech-api" ) {
332+ file(" ${rootDir} /openapi/openapi.yaml" )
333+ } else {
334+ openApiDefinitionFile
358335 }
359- }
336+ tasks.register<Copy >(" copyOpenApiYamlToMainResources" ) {
337+ from(openApiFileDefinition)
338+ into(" $buildDir /resources/main/static" )
339+ rename { if (it != " openapi.yaml" ) " openapi.yaml" else it }
340+ }
341+ tasks.register<Copy >(" copyOpenApiYamlToTestResources" ) {
342+ from(openApiFileDefinition)
343+ into(" $buildDir /resources/test/static" )
344+ rename { if (it != " openapi.yaml" ) " openapi.yaml" else it }
345+ }
360346
361- tasks.getByName<Copy >(" processTestResources" ) { dependsOn(" copyOpenApiYamlToTestResources" ) }
347+ tasks.getByName<Copy >(" processResources" ) {
348+ dependsOn(" copyOpenApiYamlToMainResources" )
349+ filesMatching(" **/banner.txt" ) {
350+ filter<ReplaceTokens >(" tokens" to mapOf (" projectVersion" to project.version))
351+ }
352+ }
362353
363- tasks.getByName<BootJar >(" bootJar " ) { classifier = " uberjar " }
354+ tasks.getByName<Copy >(" processTestResources " ) { dependsOn( " copyOpenApiYamlToTestResources " ) }
364355
365- tasks.getByName<BootRun >(" bootRun" ) {
366- workingDir = rootDir
356+ tasks.getByName<BootJar >(" bootJar" ) { classifier = " uberjar" }
367357
368- environment(" CSM_PLATFORM_VENDOR" , project.findProperty(" platform" )?.toString() ? : " azure" )
369- project.findProperty(" identityProvider" )?.toString()?.let {
370- environment(" IDENTITY_PROVIDER" , it)
371- }
358+ tasks.getByName<BootRun >(" bootRun" ) {
359+ workingDir = rootDir
372360
373- if (project.hasProperty(" jvmArgs" )) {
374- jvmArgs = project.property(" jvmArgs" ).toString().split(" \\ s+" .toRegex()).toList()
375- }
361+ environment(" CSM_PLATFORM_VENDOR" , project.findProperty(" platform" )?.toString() ? : " azure" )
362+ project.findProperty(" identityProvider" )?.toString()?.let {
363+ environment(" IDENTITY_PROVIDER" , it)
364+ }
376365
377- args = listOf (" --spring.profiles.active=dev" )
366+ if (project.hasProperty(" jvmArgs" )) {
367+ jvmArgs = project.property(" jvmArgs" ).toString().split(" \\ s+" .toRegex()).toList()
378368 }
379369
380- configure<SpringBootExtension > {
381- buildInfo {
382- properties {
383- // Unsetting time so the task can be deterministic and cacheable, for performance reasons
384- time = null
385- }
370+ args = listOf (" --spring.profiles.active=dev" )
371+ }
372+
373+ configure<SpringBootExtension > {
374+ buildInfo {
375+ properties {
376+ // Unsetting time so the task can be deterministic and cacheable, for performance reasons
377+ time = null
386378 }
387379 }
388- configure< JibExtension > {
389- from { image = " eclipse-temurin:17-alpine " }
390- to { image = " ${project.group} / ${project.name} : ${project.version} " }
391- container {
392- format = OCI
393- labels.putAll( mapOf ( " maintainer " to " Cosmo Tech " ))
394- environment =
395- mapOf (
396- " JAVA_TOOL_OPTIONS " to
397- " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:5005 " )
398- jvmFlags =
399- listOf (
400- // Make sure Spring DevTools is disabled in production as running it is a
401- // security risk
402- " -Dspring.devtools.restart.enabled=false " )
403- ports = listOf ( " 5005 " , " 8080 " , " 8081 " )
404- // Docker Best Practice : run as non-root.
405- // These are the 'nobody' UID and GID inside the image
406- user = " 65534:65534 "
407- }
380+ }
381+ configure< JibExtension > {
382+ from { image = " eclipse-temurin:17-alpine " }
383+ to { image = " ${project.group} / ${project.name} : ${project.version} " }
384+ container {
385+ format = OCI
386+ labels.putAll( mapOf ( " maintainer " to " Cosmo Tech " ))
387+ environment =
388+ mapOf (
389+ " JAVA_TOOL_OPTIONS " to
390+ " -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:5005 " )
391+ jvmFlags =
392+ listOf (
393+ // Make sure Spring DevTools is disabled in production as running it is a
394+ // security risk
395+ " -Dspring.devtools.restart.enabled=false " )
396+ ports = listOf ( " 5005 " , " 8080 " , " 8081 " )
397+ // Docker Best Practice : run as non-root.
398+ // These are the 'nobody' UID and GID inside the image
399+ user = " 65534:65534 "
408400 }
409401 }
410402}
0 commit comments