Skip to content

Commit 1f25021

Browse files
author
Dries Samyn
authored
CORE-18813 - enable Dependabot (#1375)
- Use gradle catalogue using a versions toml file to define library versions. - Enable Dependabot so it can raise PRs to update dependencies
1 parent ccf9d8b commit 1f25021

File tree

23 files changed

+140
-180
lines changed

23 files changed

+140
-180
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "daily"
7-
rebase-strategy: "disabled"
8-
# for testing only:
9-
target-branch: "driessamyn/poc/version-catalogue"
7+
rebase-strategy: "disabled"

application/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ dependencies {
2121
compileOnly 'org.osgi:osgi.core'
2222

2323
testApi 'org.jetbrains.kotlin:kotlin-osgi-bundle'
24-
testImplementation "org.assertj:assertj-core:$assertjVersion"
2524
}

base/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ dependencies {
1616
compileOnly 'org.osgi:osgi.annotation'
1717

1818
testApi 'org.jetbrains.kotlin:kotlin-osgi-bundle'
19-
testImplementation "org.assertj:assertj-core:$assertjVersion"
2019
}

build.gradle

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,22 @@ buildscript {
99
ext {
1010
vcsUrl = System.getenv('GIT_URL') ?: 'https://github.com/corda/corda-api.git'
1111
}
12-
13-
dependencies {
14-
classpath "org.jetbrains.dokka:dokka-core:$dokkaVersion"
15-
constraints {
16-
classpath("org.jsoup:jsoup:1.15.3") {
17-
because "required until dokka plugin updates it's internal version of jsoup, not fixed as of dokka 1.7.10"
18-
}
19-
}
20-
}
2112
}
2213

2314
plugins {
2415
id 'net.corda.cordapp.cordapp-configuration'
2516
id 'org.jetbrains.kotlin.jvm' apply false
2617
id 'org.jetbrains.kotlin.plugin.allopen' apply false
2718
id 'org.jetbrains.kotlin.plugin.jpa' apply false
28-
id 'io.gitlab.arturbosch.detekt' apply false
29-
id 'io.snyk.gradle.plugin.snykplugin'
30-
id 'org.ajoberstar.grgit' // used for GIT interaction (e.g. extract commit hash)
19+
alias libs.plugins.detekt apply false
20+
alias libs.plugins.snyk
21+
alias libs.plugins.grgit // used for GIT interaction (e.g. extract commit hash)
3122
id 'corda.root-publish'
3223
id 'jacoco' // test coverage
33-
id 'com.dorongold.task-tree' // utility to visualise Gradle task DAG
34-
id 'org.jetbrains.dokka'
35-
id 'com.github.ben-manes.versions' // discover possible dependency version upgrades
36-
id 'org.cyclonedx.bom' apply false
24+
alias libs.plugins.task.tree // utility to visualise Gradle task DAG
25+
alias libs.plugins.dokka
26+
alias libs.plugins.dependency.check.versions // discover possible dependency version upgrades
27+
alias libs.plugins.cyclonedx.bom apply false
3728
}
3829

3930
snyk {
@@ -108,7 +99,9 @@ subprojects {
10899
releasable = true // all corda-api jars are externally consumable
109100
}
110101

111-
apply plugin: 'org.cyclonedx.bom'
102+
// NOTE: according to this we shouldn't be using subprojects:
103+
// https://discuss.gradle.org/t/apply-plugin-with-version-catalog/43029
104+
apply plugin: libs.plugins.cyclonedx.bom.get().pluginId
112105
cyclonedxBom {
113106
includeConfigs = ["runtimeClasspath"]
114107
skipProjects = [rootProject.name]
@@ -162,21 +155,7 @@ subprojects {
162155
// thinking is that for the test dependencies it's ok as it'll keep things consistent.
163156
// we can add exclusions, or review this if necessary.
164157
dependencies {
165-
// Test libraries -> keep consistent across modules
166-
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
167-
testImplementation "org.mockito:mockito-core:$mockitoVersion"
168-
testImplementation("org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion") {
169-
// Excluding mockito-core and adding it implicitly above. This is done to allow the use of the latest version of mockito.
170-
exclude group: 'mockito-core'
171-
}
172-
173-
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
174-
175-
// Test runtime libraries -> also keep consistent
176-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
177-
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
178-
179-
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$detektPluginVersion"
158+
detektPlugins libs.detekt.formatting
180159
}
181160

182161
// Making all persistence entity open and with an empty constructor to allow Hibernate to work.
@@ -259,17 +238,6 @@ subprojects {
259238
}
260239
}
261240

262-
pluginManager.withPlugin('io.gitlab.arturbosch.detekt'){
263-
dependencies {
264-
detekt "io.gitlab.arturbosch.detekt:detekt-cli:$detektPluginVersion"
265-
constraints {
266-
detekt("org.yaml:snakeyaml:$snakeyamlVersion") {
267-
because "required until detekt plugin updates it's internal version of snakeYaml, not fixed as of detekt version 1.21"
268-
}
269-
}
270-
}
271-
}
272-
273241
// we do this to allow for Gradle task caching. OSGI attribute Bnd-LastModified breaks gradle caching as it is a timestamp
274242
// below block tells Gradle to ignore specifically the Bnd-LastModified attribute of the manifest when checking if
275243
// a task is up-to-date, this has no impact on publishing or production of jar.
@@ -407,4 +375,4 @@ if (project.hasProperty('generateSBOM')) {
407375
artifactoryPublish {
408376
publications('sbom')
409377
}
410-
}
378+
}

buildSrc/build.gradle

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ repositories {
1010
// So we'll load it into our own object to grab what we need.
1111
def constants = new Properties()
1212
file("$rootDir/../gradle.properties").withInputStream { InputStream input -> constants.load(input) }
13-
def bndVersion = constants.getProperty('bndVersion')
14-
def bndlibVersion = constants.getProperty('bndlibVersion')
1513
def internalPluginVersion = constants.getProperty('internalPluginVersion')
1614
def artifactoryContextUrl = constants.getProperty('artifactoryContextUrl')
1715

@@ -51,23 +49,11 @@ repositories {
5149

5250
dependencies {
5351
constraints {
54-
implementation('biz.aQute.bnd:biz.aQute.bndlib') {
55-
version {
56-
require bndlibVersion
57-
}
58-
}
59-
implementation('biz.aQute.bnd:biz.aQute.bnd.embedded-repo') {
60-
version {
61-
require bndlibVersion
62-
}
63-
}
64-
implementation('biz.aQute.bnd:biz.aQute.resolve') {
65-
version {
66-
require bndlibVersion
67-
}
68-
}
52+
implementation libs.bnd.lib
53+
implementation libs.bnd.embedded.repo
54+
implementation libs.bnd.resolve
6955
}
70-
implementation "biz.aQute.bnd:biz.aQute.bnd.gradle:$bndVersion"
56+
implementation libs.bnd.gradle
7157

7258
if (System.getenv('CORDA_ARTIFACTORY_USERNAME') != null || project.hasProperty('cordaArtifactoryUsername')) {
7359
implementation "com.r3.internal.gradle.plugins:publish:$internalPluginVersion"

buildSrc/settings.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dependencyResolutionManagement {
2+
versionCatalogs {
3+
create('libs', { from(files("../gradle/libs.versions.toml")) })
4+
}
5+
}
6+
7+
rootProject.name = 'buildSrc'

buildSrc/src/main/groovy/corda-api.common-library.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
plugins {
44
id 'java-library'
5+
id 'org.jetbrains.kotlin.jvm'
56
id 'biz.aQute.bnd.builder'
67
}
78

@@ -26,9 +27,8 @@ configurations {
2627

2728
dependencies {
2829
compileOnly "org.jetbrains:annotations:$jetbrainsAnnotationsVersion"
29-
testImplementation "org.junit.jupiter:junit-jupiter:$junitVersion"
30-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
31-
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
30+
testImplementation libs.bundles.test
31+
testRuntimeOnly libs.bundles.test.runtime
3232
}
3333

3434
tasks.named('jar', Jar) {
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
plugins {
2-
id 'org.jetbrains.kotlin.jvm'
3-
}
4-
5-
tasks.named('compileKotlin') {
6-
doFirst {
7-
throw new InvalidUserCodeException("Module '${project.path}' should only contain Java classes")
1+
/**
2+
* Apply this plugin to projects that must be implemented in pure Java.
3+
* We cannot prevent such projects from applying the Kotlin Gradle plugin,
4+
* but we can throw an exception if they try to compile any Kotlin classes.
5+
*/
6+
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
7+
tasks.named('compileKotlin') {
8+
doFirst {
9+
throw new InvalidUserCodeException("Module '${project.path}' should only contain Java classes")
10+
}
811
}
912
}

corda-api/build.gradle

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,41 +26,20 @@ dependencies {
2626
api project(':membership')
2727
api project(':serialization')
2828

29-
api('javax.persistence:javax.persistence-api') {
30-
version {
31-
require javaxPersistenceApiVersion
32-
}
33-
}
29+
api(libs.javax.persistence.api)
3430
api('org.jetbrains.kotlin:kotlin-osgi-bundle') {
3531
version {
36-
require kotlinVersion
32+
require kotlinVersion
3733
}
3834
}
3935
api('org.jetbrains:annotations') {
4036
version {
4137
require jetbrainsAnnotationsVersion
4238
}
4339
}
44-
api('org.osgi:osgi.annotation') {
45-
version {
46-
require osgiAnnotationVersion
47-
}
48-
}
49-
api('org.osgi:osgi.core') {
50-
version {
51-
require osgiVersion
52-
}
53-
}
54-
api('org.osgi:org.osgi.service.component.annotations') {
55-
version {
56-
require osgiScrAnnotationVersion
57-
}
58-
}
59-
api('org.slf4j:slf4j-api') {
40+
api(libs.bundles.osgi)
41+
api(libs.slf4j) {
6042
because 'Corda 5.1 only supports SLF4J 1.x'
61-
version {
62-
strictly slf4jVersion
63-
}
6443
}
6544
}
6645
}

cordapp-configuration/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ java {
3131
}
3232

3333
dependencies {
34-
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
35-
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
36-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
34+
testImplementation libs.bundles.test
35+
testRuntimeOnly libs.bundles.test.runtime
3736
}
3837

3938
tasks.named('jar', Jar) {
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
org.gradle.java.installations.auto-download=false
22
org.gradle.jvmargs=-XX:+UseG1GC -Xmx1g
3-
org.gradle.caching=false
4-
5-
junitVersion=5.7.2
3+
org.gradle.caching=false

cordapp-configuration/settings.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ dependencyResolutionManagement {
22
repositories {
33
mavenCentral()
44
}
5+
versionCatalogs {
6+
create('libs', { from(files("../gradle/libs.versions.toml")) })
7+
}
58
}

crypto/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ dependencies {
1515
api platform(project(':corda-api'))
1616
api project(':base')
1717

18-
testImplementation "org.bouncycastle:bcprov-jdk18on:$bouncycastleVersion"
19-
testImplementation "org.bouncycastle:bcpkix-jdk18on:$bouncycastleVersion"
20-
testImplementation "org.assertj:assertj-core:$assertjVersion"
21-
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
18+
testImplementation libs.bundles.bouncycastle
2219
}
2320

data/avro-schema/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ plugins {
66
id 'corda-api.common-library'
77
id 'corda.common-publishing'
88
id 'corda.java-only'
9-
id "com.github.davidmc24.gradle.plugin.avro-base"
9+
alias libs.plugins.avro.gradle
1010
}
1111

1212
dependencies {
13-
api "org.apache.avro:avro:$avroVersion"
13+
api libs.avro
1414
constraints {
15-
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") {
15+
implementation(libs.jackson.databind) {
1616
because "required until new version of Avro available which updates Jackson"
1717
}
1818

19-
implementation("org.apache.commons:commons-compress:$commonsCompressVersion") {
19+
implementation(libs.commons.compress) {
2020
because "CVE-2023-42503, current version of Avro uses an outdated version"
2121
}
2222
}
@@ -30,7 +30,7 @@ dependencies {
3030
configurations.all {
3131
resolutionStrategy {
3232
// CVE-2023-42503, current version of Avro uses an outdated version
33-
force "org.apache.commons:commons-compress:$commonsCompressVersion"
33+
force libs.commons.compress
3434
}
3535
}
3636

data/topic-schema/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ description 'Definition of Topics'
99
dependencies {
1010
implementation platform(project(':corda-api'))
1111

12-
testImplementation "org.assertj:assertj-core:$assertjVersion"
13-
testImplementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion"
14-
testImplementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion"
12+
testImplementation libs.jackson.kotlin
13+
testImplementation libs.jackson.yaml
1514

1615
compileOnly 'org.osgi:osgi.annotation'
1716
}

gradle.properties

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# This file is parsed from Python in the docs/source/conf.py file
2-
# because some versions here need to be matched by app authors in
3-
# their own projects. So don't get fancy with syntax!
4-
51
org.gradle.java.installations.auto-download=false
62

73
# Versioning
@@ -30,48 +26,12 @@ publicArtifactURL = https://download.corda.net/maven
3026
# dokka need more metaspace - https://github.com/Kotlin/dokka/issues/1405
3127
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=2g
3228
internalPluginVersion = 1.+
33-
dokkaVersion = 1.8.+
34-
detektPluginVersion = 1.22.+
35-
dependencyCheckVersion=0.46.+
3629
artifactoryPluginVersion = 4.28.2
37-
snakeyamlVersion=2.0
38-
39-
# Logging
40-
slf4jVersion = 1.7.36
41-
42-
# Main implementation dependencies
43-
avroGradlePluginVersion=1.3.0
44-
avroVersion = 1.11.3
45-
commonsCompressVersion = 1.24.0
46-
bouncycastleVersion = 1.73
47-
grgitPluginVersion = 5.2.0
48-
taskTreePluginVersion = 2.1.1
49-
javaxPersistenceApiVersion = 2.2
50-
jacksonVersion = 2.15.2
51-
52-
# Testing
53-
assertjVersion = 3.24.+
54-
junitVersion = 5.10.0
55-
mockitoVersion = 5.3.+
56-
mockitoKotlinVersion = 4.1.+
57-
58-
# OSGi
59-
bndVersion = 6.4.0
60-
bndlibVersion = 6.4.1
61-
osgiVersion = 8.0.0
62-
osgiAnnotationVersion = 8.1.0
63-
osgiScrAnnotationVersion = 1.5.1
6430

6531
gradleEnterpriseVersion = 3.14.1
6632
gradleDataPlugin = 1.8.2
6733
org.gradle.caching = true
6834
gradleEnterpriseUrl = https://gradle.dev.r3.com
6935

70-
#snyk version
71-
snykVersion = 0.4
72-
7336
# Kotlin build
74-
kotlin.build.report.output=file,build_scan
75-
76-
# Cyclonedx Bom generation version
77-
cyclonedxVersion = 1.7.4
37+
kotlin.build.report.output=file,build_scan

0 commit comments

Comments
 (0)