-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
141 lines (113 loc) · 3.87 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
allprojects {
group 'org.specnaz'
version '1.5.3'
}
subprojects {
repositories {
mavenCentral()
}
apply plugin: 'java'
configurations {
provided {
dependencies.all { dep ->
configurations.default.exclude group: dep.group, module: dep.name
}
}
compile.extendsFrom provided
}
}
// defaults if the value of the username and password for Maven Central is not found -
// they are only needed when running the 'uploadArchives' task to release a new version
def ossrhUsername = findProperty('ossrhUsername') ?: 'username'
def ossrhPassword = findProperty('ossrhPassword') ?: 'password'
configure(subprojects.findAll { isAMainProject(it) }) {
apply plugin: 'signing'
apply plugin: 'maven'
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
artifacts {
archives javadocJar, sourcesJar
}
signing {
useGpgCmd()
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
// map between our custom 'provided' Gradle configuration defined above, and Maven's 'provided' scope
project.conf2ScopeMappings.addMapping(MavenPlugin.COMPILE_PRIORITY + 1, configurations.provided, Conf2ScopeMappingContainer.PROVIDED)
pom.project {
name 'Specnaz'
packaging 'jar'
description 'Library for writing beautiful, RSpec/Jasmine/Mocha/Jest-style specifications in Java, Kotlin and Groovy'
url 'https://github.com/skinny85/specnaz'
scm {
url 'https://github.com/skinny85/specnaz.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name 'Adam Ruka'
}
}
}
}
}
}
}
private boolean isAMainProject(Project it) {
it.name.startsWith('specnaz') && !it.name.contains('example')
}
buildscript {
ext.kotlin_version = '1.2.0'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
configure(subprojects.findAll { isAKotlinProject(it) }) {
buildscript {
ext.kotlin_version = '1.2.0'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
dependencies {
provided "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
}
}
private boolean isAKotlinProject(Project it) {
it.name.contains('kotlin') || it.name == 'specnaz-testng-examples' ||
it.name == 'specnaz-junit-platform-examples'
}
ext {
junit_version = '4.12'
testng_version = '7.0.0'
junit_platform_version = '1.4.2'
assertj_version = '3.5.2'
}