Skip to content

Commit

Permalink
use common library
Browse files Browse the repository at this point in the history
  • Loading branch information
farrell-m committed May 20, 2024
1 parent b848c79 commit eb24972
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 80 deletions.
37 changes: 1 addition & 36 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,42 +1,7 @@
plugins {
id 'java'
id 'io.spring.dependency-management' version '1.1.5'
id 'net.researchgate.release' version '3.0.2'
id 'uk.gov.laa.ccms.springboot.laa-ccms-spring-boot-gradle-plugin' version '0.0.1-b144207-SNAPSHOT' apply false
}

subprojects {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'

group = 'uk.gov.laa.ccms.caab'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(JAVA_VERSION)
}
}

repositories {
mavenCentral()
}

release {
tagTemplate = '$name-$version'
}
}

//used for deploying snapshot packages
task updateSnapshotVersion {
doLast {
def gitHash = "git rev-parse --short HEAD".execute().text.trim()
def propertiesFile = file('gradle.properties')
def properties = new Properties()
properties.load(new FileInputStream(propertiesFile))

def currentVersion = properties.getProperty('version')
def newVersion = currentVersion.replace('-SNAPSHOT', "-${gitHash}-SNAPSHOT")
properties.setProperty('version', newVersion)

properties.store(propertiesFile.newWriter(), null)
}
}
15 changes: 3 additions & 12 deletions caab-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
plugins {
id 'org.openapi.generator' version '7.0.1'
id 'org.springframework.boot' version '3.1.0'
}

apply plugin: "maven-publish"
apply plugin: 'uk.gov.laa.ccms.springboot.laa-ccms-spring-boot-gradle-plugin'

dependencies {

Expand All @@ -19,16 +18,6 @@ dependencies {
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url 'https://maven.pkg.github.com/ministryofjustice/laa-ccms-caab-api'
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
from(components.java)
Expand All @@ -38,6 +27,8 @@ publishing {

sourceSets.main.java.srcDirs += ['generated/src/main/java']

checkstyleMain.exclude "*"

openApiGenerate {
generatorName = "spring"
inputSpec = "$rootDir/caab-api/open-api-specification.yml".toString() // Change this to the location of your OpenAPI specification
Expand Down
33 changes: 1 addition & 32 deletions caab-service/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
plugins {
id 'org.springframework.boot' version '3.2.5'
id 'jacoco'
id 'checkstyle'
}

ext {
checkstyleVersion = '10.12.2'
}
apply plugin: 'uk.gov.laa.ccms.springboot.laa-ccms-spring-boot-gradle-plugin'

sourceSets {
integrationTest {
Expand Down Expand Up @@ -65,7 +57,6 @@ task integrationTest(type: Test) {
}

jacocoTestReport {
sourceDirectories.from files('build/generated/sources/annotationProcessor/java/main')
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
Expand All @@ -74,12 +65,9 @@ jacocoTestReport {
'**/AuditorAwareImpl.class'])
}))
}

dependsOn tasks['test']
}

jacocoTestCoverageVerification {

afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
Expand All @@ -88,23 +76,4 @@ jacocoTestCoverageVerification {
'**/AuditorAwareImpl.class'])
}))
}

violationRules {
rule {
limit {
minimum = 0.80 // You can define your required coverage ratio here.
}
}
}

dependsOn tasks['test']
}

checkstyle {
maxWarnings = 0
toolVersion = "${checkstyleVersion}"
sourceSets = [sourceSets.main]
showViolations = true
}


15 changes: 15 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
pluginManagement {
repositories {
maven {
name = "gitHubPackages"
url uri('https://maven.pkg.github.com/ministryofjustice/laa-ccms-spring-boot-common')
credentials {
username = System.getenv("GITHUB_ACTOR")?.trim() ? System.getenv("GITHUB_ACTOR") : settings.ext.find('project.ext.gitPackageUser')
password = System.getenv("GITHUB_TOKEN")?.trim() ? System.getenv("GITHUB_TOKEN") : settings.ext.find('project.ext.gitPackageKey')
}
}
maven { url "https://plugins.gradle.org/m2/" }
gradlePluginPortal()
}
}

rootProject.name = 'laa-ccms-caab-api'

include 'caab-api'
Expand Down

0 comments on commit eb24972

Please sign in to comment.