forked from apechinsky/srplib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
129 lines (99 loc) · 3.42 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
allprojects {
group = 'org.srplib'
version = '0.10.0-SNAPSHOT'
ext.isReleaseVersion = !version.endsWith("-SNAPSHOT")
repositories {
mavenCentral()
}
ext.libs = [:]
libs.guava = 'com.google.guava:guava:14.0'
libs.junit = 'junit:junit:4.11'
libs.mockito = [
"org.mockito:mockito-core:2.21.0",
"org.mockito:mockito-junit-jupiter:2.23.0"
]
libs.hamcrest_all = [
libs.hamcrest_core = "org.hamcrest:hamcrest-core:2.2",
libs.hamcrest_library = "org.hamcrest:hamcrest-library:2.2",
]
libs.objenesis = 'org.objenesis:objenesis:2.6'
libs.test = [
libs.junit,
libs.mockito,
libs.hamcrest_core,
libs.hamcrest_library
]
}
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'signing'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
javadoc {
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption('Xdoclint:none', '-quiet')
}
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
java {
withSourcesJar()
withJavadocJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'Single Responsibility Principle library'
description = 'Single Responsibility Principle (SRP) libraries collection'
url = 'https://github.com/apechinsky/srplib'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
url = 'scm:git:[email protected]:apechinsky/srplib.git'
connection = 'scm:git:[email protected]:apechinsky/srplib.git'
developerConnection = '[email protected]:apechinsky/srplib.git'
}
developers {
developer {
id = 'apechinsky'
name = 'Anton Pechinsky'
}
}
}
}
}
repositories {
def sonatypeCredentials = Credentials.fromProject(project)
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = sonatypeCredentials.ossrhUsername
password = sonatypeCredentials.ossrhPassword
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
}
class Credentials {
String ossrhUsername
String ossrhPassword
static Credentials fromProject(Project project) {
new Credentials(
ossrhUsername: project.hasProperty('ossrhUsername') ? project.ossrhUsername : 'undefined',
ossrhPassword: project.hasProperty('ossrhPassword') ? project.ossrhPassword : 'undefined'
)
}
}