diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d3bd985..d581323e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file. ### Quality - Add and use a non-root user in the dockerfile. (#113) +- Reindent `build.gradle` file. (#114) ## [[8.2.0]](https://github.com/iExecBlockchainComputing/iexec-blockchain-adapter-api/releases/tag/v8.2.0) 2023-09-28 diff --git a/build.gradle b/build.gradle index ee3d94a1..80ddd120 100644 --- a/build.gradle +++ b/build.gradle @@ -1,16 +1,16 @@ plugins { - id 'java' - id 'io.freefair.lombok' version '8.2.2' - id 'org.springframework.boot' version '2.7.14' - id 'io.spring.dependency-management' version '1.1.3' - id 'jacoco' - id 'org.sonarqube' version '4.2.1.3168' - id 'maven-publish' + id 'java' + id 'io.freefair.lombok' version '8.2.2' + id 'org.springframework.boot' version '2.7.14' + id 'io.spring.dependency-management' version '1.1.3' + id 'jacoco' + id 'org.sonarqube' version '4.2.1.3168' + id 'maven-publish' } ext { - openFeignVersion = '11.10' - testContainersVersion = '1.19.0' + openFeignVersion = '11.10' + testContainersVersion = '1.19.0' } if (!project.hasProperty('gitBranch')) { @@ -18,122 +18,122 @@ if (!project.hasProperty('gitBranch')) { } allprojects { - group = 'com.iexec.blockchain' - if (gitBranch != 'main' && gitBranch != 'master' && !(gitBranch ==~ '(release|hotfix|support)/.*')) { - version += '-NEXT-SNAPSHOT' - } - repositories { - mavenLocal() - mavenCentral() - // iExec - maven { - url "https://docker-regis-adm.iex.ec/repository/maven-public/" - credentials { - username nexusUser - password nexusPassword - } - } - maven { - url "https://jitpack.io" - } - } - java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(11)) - } - } + group = 'com.iexec.blockchain' + if (gitBranch != 'main' && gitBranch != 'master' && !(gitBranch ==~ '(release|hotfix|support)/.*')) { + version += '-NEXT-SNAPSHOT' + } + repositories { + mavenLocal() + mavenCentral() + // iExec + maven { + url "https://docker-regis-adm.iex.ec/repository/maven-public/" + credentials { + username nexusUser + password nexusPassword + } + } + maven { + url "https://jitpack.io" + } + } + java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(11)) + } + } } sourceSets { - itest { - java { - compileClasspath += main.output + test.output - runtimeClasspath += main.output + test.output - } - } + itest { + java { + compileClasspath += main.output + test.output + runtimeClasspath += main.output + test.output + } + } } configurations { - itestRuntime.extendsFrom testRuntime - itestImplementation.extendsFrom testImplementation + itestRuntime.extendsFrom testRuntime + itestImplementation.extendsFrom testImplementation } dependencies { - // Spring framework - implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' - implementation 'org.springframework.boot:spring-boot-starter-security' - implementation 'org.springframework.boot:spring-boot-starter-validation' - implementation 'org.springframework.boot:spring-boot-starter-web' + // Spring framework + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'org.springframework.boot:spring-boot-starter-validation' + implementation 'org.springframework.boot:spring-boot-starter-web' - // Spring Doc - implementation 'org.springdoc:springdoc-openapi-ui:1.6.3' + // Spring Doc + implementation 'org.springdoc:springdoc-openapi-ui:1.6.3' - // iexec - implementation "com.iexec.commons:iexec-commons-poco:$iexecCommonsPocoVersion" - implementation "com.iexec.common:iexec-common:$iexecCommonVersion" + // iexec + implementation "com.iexec.commons:iexec-commons-poco:$iexecCommonsPocoVersion" + implementation "com.iexec.common:iexec-common:$iexecCommonVersion" - // feign - implementation "io.github.openfeign:feign-jackson:$openFeignVersion" - implementation "io.github.openfeign:feign-slf4j:$openFeignVersion" + // feign + implementation "io.github.openfeign:feign-jackson:$openFeignVersion" + implementation "io.github.openfeign:feign-slf4j:$openFeignVersion" - // observability - runtimeOnly 'io.micrometer:micrometer-registry-prometheus' + // observability + runtimeOnly 'io.micrometer:micrometer-registry-prometheus' - // integration tests - implementation project(':iexec-blockchain-adapter-api-library') + // integration tests + implementation project(':iexec-blockchain-adapter-api-library') - testImplementation 'org.springframework.boot:spring-boot-starter-test' - testRuntimeOnly("org.junit.platform:junit-platform-launcher") - testImplementation 'org.awaitility:awaitility' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + testImplementation 'org.awaitility:awaitility' - itestImplementation "org.testcontainers:junit-jupiter:$testContainersVersion" + itestImplementation "org.testcontainers:junit-jupiter:$testContainersVersion" } springBoot { - buildInfo() + buildInfo() } tasks.named("bootJar") { - manifest { - attributes("Implementation-Title": "iExec Blockchain Adapter API", - "Implementation-Version": project.version) - } + manifest { + attributes("Implementation-Title": "iExec Blockchain Adapter API", + "Implementation-Version": project.version) + } } tasks.register("itest", Test) { - doFirst { - exec { - commandLine 'docker', 'compose', 'pull', '-q' - } - } - group 'Verification' - description 'Runs the integration tests.' - setTestClassesDirs(sourceSets.itest.output) - classpath = sourceSets.itest.runtimeClasspath + doFirst { + exec { + commandLine 'docker', 'compose', 'pull', '-q' + } + } + group 'Verification' + description 'Runs the integration tests.' + setTestClassesDirs(sourceSets.itest.output) + classpath = sourceSets.itest.runtimeClasspath } publishing { - publications { - maven(MavenPublication) { - artifact tasks.named("bootJar") - from components.java - } - } - repositories { - maven { - credentials { - username nexusUser - password nexusPassword - } - url = project.hasProperty("nexusUrl")? project.nexusUrl: '' - } - } + publications { + maven(MavenPublication) { + artifact tasks.named("bootJar") + from components.java + } + } + repositories { + maven { + credentials { + username nexusUser + password nexusPassword + } + url = project.hasProperty("nexusUrl") ? project.nexusUrl : '' + } + } } tasks.withType(Test).configureEach { - finalizedBy jacocoTestReport - useJUnitPlatform() + finalizedBy jacocoTestReport + useJUnitPlatform() } // sonarqube code coverage requires jacoco XML report @@ -144,9 +144,9 @@ jacocoTestReport { } tasks.sonarqube.dependsOn tasks.jacocoTestReport -ext.jarPathForOCI = relativePath(tasks.bootJar.outputs.files.singleFile) +ext.jarPathForOCI = relativePath(tasks.bootJar.outputs.files.singleFile) ext.gitShortCommit = 'git rev-parse --short=8 HEAD'.execute().text.trim() -ext.ociImageName = 'local/' + ['bash', '-c', 'basename $(git config --get remote.origin.url) .git'].execute().text.trim() +ext.ociImageName = 'local/' + ['bash', '-c', 'basename $(git config --get remote.origin.url) .git'].execute().text.trim() tasks.register('buildImage', Exec) { group 'Build'