-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
229 lines (206 loc) · 7.75 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
import static org.gradle.api.JavaVersion.VERSION_1_8
buildscript {
ext.cordaBuildEdition = System.getenv("CORDA_BUILD_EDITION")?.trim() ?: "Corda Open Source"
ext.cordaRevision = {
try {
"git rev-parse HEAD".execute().text.trim()
} catch (Exception ignored) {
logger.warn("git is unavailable in build environment")
"unknown"
}
}()
repositories {
mavenLocal()
// Use system environment to activate caching with Artifactory,
// because it is actually easier to pass that during parallel build.
// NOTE: it has to be a name of a virtual repository with all
// required remote or local repositories!
if (System.getenv("CORDA_USE_CACHE")) {
maven {
name "R3 Maven remote repositories"
url "${artifactoryContextUrl}/${System.getenv("CORDA_USE_CACHE")}"
authentication {
basic(BasicAuthentication)
}
credentials {
username = System.getenv('CORDA_ARTIFACTORY_USERNAME')
password = System.getenv('CORDA_ARTIFACTORY_PASSWORD')
}
}
} else {
maven {
url "${publicArtifactURL}/corda-dependencies-dev"
content {
includeGroupByRegex 'net\\.corda(\\..*)?'
includeGroupByRegex 'com\\.r3(\\..*)?'
}
}
maven {
url "${publicArtifactURL}/corda-releases"
content {
includeGroupByRegex 'net\\.corda(\\..*)?'
includeGroupByRegex 'com\\.r3(\\..*)?'
}
}
maven { url "${publicArtifactURL}/corda-releases" }
maven { url "${publicArtifactURL}/corda-dependencies" }
mavenCentral()
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "net.corda.plugins:quasar-utils:$gradlePluginsVersion"
classpath "net.corda.plugins:publish-utils:$gradlePluginsVersion"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$artifactoryPluginVersion"
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
id 'maven-publish'
}
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'net.corda.plugins.publish-utils'
version = "$cordaShellReleaseVersion$versionSuffix"
logger.quiet("Corda release version: {}", version)
allprojects {
group 'net.corda'
version rootProject.version
repositories {
mavenLocal()
if (System.getenv("CORDA_USE_CACHE")) {
maven {
name "R3 Maven remote repositories"
url "${artifactoryContextUrl}/${System.getenv("CORDA_USE_CACHE")}"
authentication {
basic(BasicAuthentication)
}
credentials {
username = System.getenv('CORDA_ARTIFACTORY_USERNAME')
password = System.getenv('CORDA_ARTIFACTORY_PASSWORD')
}
}
} else {
maven {
url "${publicArtifactURL}/corda-dependencies"
content {
includeGroupByRegex 'net\\.corda(\\..*)?'
includeGroupByRegex 'com\\.r3(\\..*)?'
includeGroup 'co.paralleluniverse'
includeGroup 'org.crashub'
includeGroup 'com.github.bft-smart'
}
}
maven {
url "${publicArtifactURL}/corda-dev"
content {
includeGroupByRegex 'net\\.corda(\\..*)?'
includeGroupByRegex 'com\\.r3(\\..*)?'
}
}
maven {
url 'https://repo.gradle.org/gradle/libs-releases'
content {
includeGroup 'org.gradle'
includeGroup 'com.github.detro'
}
}
maven { url "${publicArtifactURL}/corda-releases" }
maven { url "${publicArtifactURL}/corda-dependencies" }
mavenCentral()
}
}
tasks.withType(Jar).configureEach { task ->
// Includes War and Ear
manifest {
attributes('Corda-Release-Version': cordaReleaseVersion)
attributes('Corda-Platform-Version': cordaPlatformVersion)
attributes('Corda-Revision': cordaRevision)
attributes('Corda-Vendor': cordaBuildEdition)
attributes('Automatic-Module-Name': "net.corda.${task.project.name.replaceAll('-', '.')}")
}
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib"
}
allprojects {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Xlint:-options" << "-parameters"
options.compilerArgs << '-XDenableSunApiLintControl'
options.encoding = 'UTF-8'
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
languageVersion = "1.2"
apiVersion = "1.2"
jvmTarget = VERSION_1_8
javaParameters = true // Useful for reflection.
freeCompilerArgs = ['-Xjvm-default=compatibility']
allWarningsAsErrors = false
}
}
}
// Publish the default jar for all submodules, These are not for external consumption.
// We must generate a jar which has a pom.xml with a full dependency list for vulnerability tools to evaluate.
// The shadow jar removes this information, as those dependencies are embedded in the jar.
subprojects {
afterEvaluate { project ->
if (project.name in ['shell', 'standalone-shell']) {
apply plugin: 'maven-publish'
publishing {
publications {
"${project.name}-jarPublication"(MavenPublication) {
from components.java
artifactId = "corda-${project.name}-thin-with-deps"
pom {
name = "corda-${project.name}-thin-with-deps"
description = "Corda ${project.name} for vulnerability checking"
}
}
}
}
jar {
archiveClassifier = 'R3-internal'
}
}
}
}
artifactory {
publish {
contextUrl = artifactoryContextUrl
repository {
repoKey = 'corda-dev'
username = System.getenv('CORDA_ARTIFACTORY_USERNAME')
password = System.getenv('CORDA_ARTIFACTORY_PASSWORD')
}
defaults {
// Root project applies the plugin (for this block) but does not need to be published
if (project != rootProject) {
def pubNames = project.publishing.publications*.name
publications(pubNames.toArray(new String[0]))
}
}
}
}
bintrayConfig {
user = System.getenv('CORDA_BINTRAY_USER') ?: System.getProperty('corda.bintray.user')
key = System.getenv('CORDA_BINTRAY_KEY') ?: System.getProperty('corda.bintray.key')
repo = 'corda'
org = 'r3'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/corda/corda-shell'
projectUrl = 'https://github.com/corda/corda-shell'
gpgSign = true
gpgPassphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE')
publications = ['corda-shell', 'corda-standalone-shell']
license {
name = 'Apache-2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
distribution = 'repo'
}
developer {
id = 'R3'
name = 'R3'
email = '[email protected]'
}
}