Skip to content

Commit 56216f2

Browse files
authored
CORE-6432 add property to control external publishing (#539)
* CORE-6432 add property releasable to control external publishing
1 parent 61adbb7 commit 56216f2

File tree

4 files changed

+48
-15
lines changed

4 files changed

+48
-15
lines changed

build.gradle

+30
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ subprojects {
9494
}
9595
}
9696

97+
ext {
98+
releasable = true // all corda-api jars are externally consumable
99+
}
100+
97101
version rootProject.version
98102
group 'net.corda'
99103

@@ -264,6 +268,32 @@ subprojects {
264268

265269
tasks.register('allDependencyInsight', DependencyInsightReportTask)
266270
tasks.register('allDependencies', DependencyReportTask)
271+
272+
tasks.register('releasableArtifacts') {
273+
description = "Prints a list of all modules which will be released externally"
274+
group = "Release"
275+
if (project.hasProperty('releasable') && project.releasable.toBoolean()) {
276+
logArtifacts(project)
277+
}
278+
}
279+
280+
tasks.register('unReleasableArtifacts') {
281+
description = "Prints a list of all modules which will not be released externally"
282+
group = "Release"
283+
if (!project.hasProperty('releasable') || !project.releasable.toBoolean()) {
284+
logArtifacts(project)
285+
}
286+
}
287+
}
288+
289+
// helper to log artifacts we will or will not publish during a release process
290+
def logArtifacts(Project project) {
291+
project.publishing.publications.each { publication ->
292+
logger.quiet("\n${publication.groupId}:${publication.artifactId}:${publication.version} [${project.path}]")
293+
publication.artifacts.each { artifact ->
294+
logger.quiet(" * ${artifact.file.name}")
295+
}
296+
}
267297
}
268298

269299
// report updatable dependencies: gradle dependencyUpdates
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Allow us to publish to S3 bucket if this plugin is applied to a specific sub module
2+
// for use in projects which do not use corda.common-publishing plugin
3+
if (project.hasProperty('maven.repo.s3') && project.hasProperty('releasable')) {
4+
publishing {
5+
repositories {
6+
maven {
7+
url = project.findProperty('maven.repo.s3')
8+
credentials(AwsCredentials) {
9+
accessKey "${System.getenv('AWS_ACCESS_KEY_ID')}"
10+
secretKey "${System.getenv('AWS_SECRET_ACCESS_KEY')}"
11+
sessionToken "${System.getenv('AWS_SESSION_TOKEN')}"
12+
}
13+
}
14+
}
15+
}
16+
}

corda-api/build.gradle

+1-15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'java-platform'
33
id 'maven-publish'
44
id 'com.jfrog.artifactory'
5+
id 'corda.s3-publish'
56
}
67

78
description = 'Declares the Corda API component versions.'
@@ -95,21 +96,6 @@ publishing {
9596
}
9697
}
9798

98-
if (project.hasProperty('maven.repo.s3')){
99-
publishing {
100-
repositories {
101-
maven {
102-
url = project.findProperty('maven.repo.s3')
103-
credentials(AwsCredentials) {
104-
accessKey "${System.getenv('AWS_ACCESS_KEY_ID')}"
105-
secretKey "${System.getenv('AWS_SECRET_ACCESS_KEY')}"
106-
sessionToken "${System.getenv('AWS_SESSION_TOKEN')}"
107-
}
108-
}
109-
}
110-
}
111-
}
112-
11399
artifactoryPublish {
114100
publications('apiConfiguration')
115101
}

cordapp-configuration-publish/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
id 'com.jfrog.artifactory'
77
id 'maven-publish'
88
id 'base'
9+
id 'corda.s3-publish'
910
}
1011

1112
description 'Publishes the cordapp-configuration Gradle plugin.'

0 commit comments

Comments
 (0)