forked from mockk/mockk
/
upload.gradle
91 lines (85 loc) · 3.45 KB
/
upload.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
apply plugin: 'maven-publish'
afterEvaluate {
publishing {
publications {
mavenJava(MavenPublication) {
if (components.findByName("kotlin") != null) {
from components["kotlin"]
artifact tasks['sourcesJar']
try {
artifact tasks['javadocJar']
} catch (UnknownTaskException ignored) {
}
} else if (components.findByName("release") != null) {
from components["release"]
artifact tasks.register("androidSourcesJar", Jar.class) {
archiveClassifier.set("sources")
from android.sourceSets.main.java.srcDirs
}
try {
artifact tasks['javadocJar']
} catch (UnknownTaskException ignored) {
}
} else {
throw new RuntimeException("missing components to publish")
}
pom {
name = mavenName
description = mavenDescription
url = 'https://mockk.io'
scm {
connection = 'scm:git:git@github.com:mockk/mockk.git'
developerConnection = 'scm:git:git@github.com:mockk/mockk.git'
url = 'https://github.com/mockk/mockk/'
}
developers {
developer {
id = 'oleksiyp'
name = 'Oleksii Pylypenko'
email = 'oleksiy.pylypenko@gmail.com'
}
developer {
id = 'Raibaz'
name = 'Mattia Tommasone'
email = 'raibaz@gmail.com'
}
}
licenses {
license {
name = 'Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
}
}
}
}
}
repositories {
maven {
if (project.hasProperty('localrepo')) {
url = rootProject.properties['localrepo']
} else if (version.endsWith('SNAPSHOT')) {
url = "https://oss.sonatype.org/content/repositories/snapshots/"
credentials {
username = rootProject.properties['ossrhUsername'] ?: ''
password = rootProject.properties['ossrhPassword'] ?: ''
}
} else {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = rootProject.properties['ossrhUsername'] ?: ''
password = rootProject.properties['ossrhPassword'] ?: ''
}
}
}
}
}
if (!project.hasProperty('localrepo')) {
if (!project.hasProperty('signing.keyId')) {
throw new RuntimeException('missing signing.keyId to sign archives')
}
apply plugin: 'signing'
signing {
sign publishing.publications.mavenJava
}
}
}