-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.gradle
156 lines (131 loc) · 5.3 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
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'checkstyle'
apply plugin: 'findbugs'
apply plugin: 'com.bmuschko.nexus'
buildscript {
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
}
}
repositories {
mavenLocal()
mavenCentral()
}
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
group = 'org.mongodb'
archivesBaseName = 'mongosql-auth'
version = '1.3.0-SNAPSHOT'
dependencies {
compile 'mysql:mysql-connector-java:5.1.41'
testCompile 'junit:junit:4.12'
}
sourceSets {
test {
java.srcDirs = ['src/test/unit/java', 'src/test/functional/java']
}
}
tasks.withType(Test) {
def getProjectPropertyOrDefault = { String propertyName, String defaultValue ->
project.hasProperty(propertyName) ? project.property(propertyName) : defaultValue
}
def getProjectPropertyOrNull = { String propertyName ->
project.hasProperty(propertyName) ? project.property(propertyName) : null
}
systemProperties(
'org.mongodb.test.host': getProjectPropertyOrDefault('org.mongodb.test.host', '127.0.0.1'),
'org.mongodb.test.port': getProjectPropertyOrDefault('org.mongodb.test.port', '3307'),
'org.mongodb.test.ssl': getProjectPropertyOrDefault('org.mongodb.test.ssl', 'false'),
'org.mongodb.test.database': getProjectPropertyOrDefault('org.mongodb.test.database', 'use_test'),
'org.mongodb.test.sql': getProjectPropertyOrDefault('org.mongodb.test.sql', 'select a from foo'),
'org.mongodb.test.user': getProjectPropertyOrNull('org.mongodb.test.user'),
'org.mongodb.test.password': getProjectPropertyOrNull('org.mongodb.test.password'),
'javax.net.ssl.trustStore': getProjectPropertyOrDefault('javax.net.ssl.trustStore', "${System.getProperty('user.home')}/.keystore"),
'javax.net.ssl.keyStore': getProjectPropertyOrDefault('javax.net.ssl.keyStore', "${System.getProperty('user.home')}/.keystore"),
'javax.net.ssl.keyStorePassword': getProjectPropertyOrDefault('javax.net.ssl.keyStorePassword', 'changeit'),
'javax.net.ssl.trustStorePassword': getProjectPropertyOrDefault('javax.net.ssl.trustStorePassword', 'changeit'),
'sun.security.krb5.debug': getProjectPropertyOrDefault('sun.security.krb5.debug', 'false'),
'javax.security.auth.useSubjectCredsOnly': 'false',
'java.security.krb5.kdc': getProjectPropertyOrNull('krb5.kdc'),
'java.security.krb5.realm': getProjectPropertyOrNull('krb5.realm'),
'java.security.auth.login.config': getProjectPropertyOrNull('auth.login.config')
)
}
findbugs {
sourceSets = [sourceSets.main]
}
/*
For security we allow the signing-related project properties to be passed in as environment variables, which
Gradle enables if they are prefixed with "ORG_GRADLE_PROJECT_". But since environment variables can not contain
the '.' character and the signing-related properties contain '.', here we map signing-related project properties with '_'
to ones with '.' that are expected by the signing plugin.
*/
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
if (project.hasProperty("signing_keyId")) {
allprojects { ext."signing.keyId" = project.property("signing_keyId") }
}
if (project.hasProperty("signing_secretKeyRingFile")) {
allprojects { ext."signing.secretKeyRingFile" = project.property("signing_secretKeyRingFile") }
}
if (project.hasProperty("signing_password")) {
allprojects { ext."signing.password" = project.property("signing_password") }
}
}
}
checkstyle {
configProperties.checkstyleConfigDir = new File(rootDir, 'config/checkstyle')
}
tasks.withType(Checkstyle) {
reports {
xml.enabled true
html.enabled true
}
}
//////////////////////////////////////////
// Root project configuration //
//////////////////////////////////////////
wrapper {
gradleVersion = '4.10.1'
}
modifyPom {
project {
name 'MongoSQL Authentication Plugin'
description 'MongoSQL Authentication Plugin for MySQL Connector/J'
url 'https://github.com/mongodb/mongosql-java-auth'
scm {
url 'https://github.com/mongodb/mongosql-java-auth'
connection 'scm:https://github.com/mongodb/mongosql-java-auth.git'
developerConnection 'scm:[email protected]:mongodb/mongosql-java-auth.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
organization = 'MongoDB, Inc.'
}
}
}
}
modifyPom { pom ->
pom.dependencies.findAll {dep -> dep.groupId == 'mysql' }.each { it.scope = "provided" }
// no need to publish test dependencies
pom.dependencies.removeAll { it.scope == "test" }
}
task uploadSnapshotArchives(dependsOn: uploadArchives) {
if (!version.endsWith("-SNAPSHOT")) {
enabled = false
dependsOn = []
}
}