blob: 09e3b8d4a6d324bf5c493cd9d950561b06c8ea95 (
plain)
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
|
package org.robolectric.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar
class DeployedRoboJavaModulePlugin implements Plugin<Project> {
Closure doApply = {
project.apply plugin: "signing"
project.apply plugin: "maven-publish"
task('sourcesJar', type: Jar, dependsOn: classes) {
archiveClassifier = "sources"
from sourceSets.main.allJava
}
javadoc {
failOnError = false
source = sourceSets.main.allJava
options.noTimestamp = true
options.header = "<ul class=\"navList\"><li>Robolectric $thisVersion | <a href=\"/\">Home</a></li></ul>"
options.footer = "<ul class=\"navList\"><li>Robolectric $thisVersion | <a href=\"/\">Home</a></li></ul>"
options.bottom = "<link rel=\"stylesheet\" href=\"https://robolectric.org/assets/css/main.css\">"
options.version = thisVersion
}
task('javadocJar', type: Jar, dependsOn: javadoc) {
archiveClassifier = "javadoc"
from javadoc.destinationDir
}
// for maven local install:
archivesBaseName = mavenArtifactName
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
def skipJavadoc = System.getenv('SKIP_JAVADOC') == "true"
artifact sourcesJar
if (!skipJavadoc) {
artifact javadocJar
}
artifactId = mavenArtifactName
pom {
name = project.name
description = "An alternative Android testing framework."
url = "http://robolectric.org"
licenses {
license {
name = "The MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
scm {
url = "git@github.com:robolectric/robolectric.git"
connection = "scm:git:git://github.com/robolectric/robolectric.git"
developerConnection = "scm:git:https://github.com/robolectric/robolectric.git"
}
developers {
developer {
name = "Brett Chabot"
email = "brettchabot@google.com"
organization = "Google Inc."
organizationUrl = "http://google.com"
}
developer {
name = "Michael Hoisie"
email = "hoisie@google.com"
organization = "Google Inc."
organizationUrl = "http://google.com"
}
developer {
name = "Christian Williams"
email = "antixian666@gmail.com"
}
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = project.version.endsWith("-SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.properties["sonatype-login"] ?: System.env['SONATYPE_LOGIN']
password = System.properties["sonatype-password"] ?: System.env['SONATYPE_PASSWORD']
}
}
}
}
signing {
required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") }
sign publishing.publications.mavenJava
}
}
@Override
void apply(Project project) {
doApply.delegate = project
doApply.resolveStrategy = Closure.DELEGATE_ONLY
doApply()
}
}
|