Skip to content

Commit b2e3bde

Browse files
committed
Revert deployment.gradle.kts (too messy atm)
1 parent fe98400 commit b2e3bde

File tree

5 files changed

+170
-200
lines changed

5 files changed

+170
-200
lines changed

android-junit5/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ dependencies {
6969
// ------------------------------------------------------------------------------------------------
7070

7171
val deployConfig by extra<Artifact> { Artifacts.Plugin }
72-
apply(from = "$rootDir/gradle/deployment.gradle.kts")
72+
apply(from = "$rootDir/gradle/deployment.gradle")

gradle/deployment.gradle

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
import de.mannodermaus.gradle.plugins.junit5.Artifacts
2+
3+
// Common logic shared across modules whose artifacts are provided to jCenter and Sonatype OSS.
4+
//
5+
// This script expects an extra named "deployConfig" to exist on the Project instance.
6+
// Its type is defined within the buildSrc module of this project.
7+
8+
/** Obtains a required parameter from a Map, or throws an Exception if it's absent */
9+
private def required(Map config, String property) {
10+
def value = config.get(property, null)
11+
if (!value) {
12+
throw new IllegalStateException(
13+
"Deployment for module '$name' is missing required parameter '$property'")
14+
}
15+
return value
16+
}
17+
18+
// Access Map properties
19+
if (!project.ext.has("deployConfig")) {
20+
throw new IllegalStateException("Deployed module '$name' requires a 'deployConfig'")
21+
}
22+
23+
final de.mannodermaus.gradle.plugins.junit5.Artifact deployConfig = project.ext.deployConfig
24+
final String targetPlatform = deployConfig.platform.name
25+
final String groupId = deployConfig.groupId
26+
final String artifactId = deployConfig.artifactId
27+
final String versionNumber = deployConfig.currentVersion
28+
final String license = deployConfig.license
29+
final String description = deployConfig.description
30+
31+
// Apply required plugins
32+
apply plugin: "com.jfrog.bintray"
33+
34+
if (targetPlatform == "java") {
35+
// Releases
36+
apply plugin: "maven"
37+
// Snapshots
38+
apply plugin: "maven-publish"
39+
} else if (targetPlatform == "android") {
40+
// Releases
41+
apply plugin: "com.github.dcendents.android-maven"
42+
// Snapshots
43+
apply plugin: "digital.wup.android-maven-publish"
44+
}
45+
46+
// ------------------------------------------------------------------------------------------------
47+
// Artifacts Configuration
48+
// ------------------------------------------------------------------------------------------------
49+
50+
// Include sources.jar archive in each release
51+
if (targetPlatform == "java") {
52+
task sourcesJar(type: Jar, dependsOn: classes) {
53+
baseName = artifactId
54+
classifier = "sources"
55+
from sourceSets.main.allSource
56+
}
57+
} else {
58+
task sourcesJar(type: Jar) {
59+
baseName = artifactId
60+
classifier = "sources"
61+
from android.sourceSets.main.java.srcDirs
62+
}
63+
}
64+
65+
// Include javadoc.jar archive in each release
66+
if (targetPlatform == "android") {
67+
task javadoc(type: Javadoc) {
68+
source = android.sourceSets.main.java.srcDirs
69+
excludes = ["**/*.kt"]
70+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
71+
}
72+
}
73+
74+
task javadocJar(type: Jar, dependsOn: javadoc) {
75+
baseName = artifactId
76+
classifier = "javadoc"
77+
from javadoc.destinationDir
78+
}
79+
80+
// ------------------------------------------------------------------------------------------------
81+
// Publication Configuration
82+
// ------------------------------------------------------------------------------------------------
83+
84+
group = groupId
85+
archivesBaseName = artifactId
86+
version = versionNumber
87+
88+
publishing {
89+
publications {
90+
library(MavenPublication) { p ->
91+
p.from components.getByName(targetPlatform)
92+
p.artifact sourcesJar
93+
p.artifact javadocJar
94+
p.groupId groupId
95+
p.artifactId artifactId
96+
p.version version
97+
p.pom.withXml {
98+
def root = asNode()
99+
root.appendNode("description", description)
100+
root.appendNode("name", artifactId)
101+
root.appendNode("url", Artifacts.githubUrl)
102+
}
103+
}
104+
}
105+
}
106+
107+
// Copy POM to location expected by Bintray
108+
task copyPom(type: Copy) {
109+
from "build/publications/library"
110+
into "build/poms"
111+
include "pom-default.xml"
112+
}
113+
114+
publish.dependsOn copyPom
115+
116+
// ------------------------------------------------------------------------------------------------
117+
// Target Configuration
118+
// ------------------------------------------------------------------------------------------------
119+
120+
project.configure(project) {
121+
if (project.version.endsWith("-SNAPSHOT")) {
122+
// Configure deployment of snapshot versions to Sonatype OSS
123+
project.publishing {
124+
repositories {
125+
maven {
126+
name "snapshot"
127+
credentials {
128+
username project.ext["deployment.sonatypeUser"]
129+
password project.ext["deployment.sonatypePass"]
130+
}
131+
url "https://oss.sonatype.org/content/repositories/snapshots"
132+
}
133+
}
134+
}
135+
project.tasks.getByName("bintrayUpload").enabled = false
136+
137+
} else {
138+
// Configure deployment of release versions to Bintray
139+
project.artifacts {
140+
archives javadocJar
141+
archives sourcesJar
142+
}
143+
144+
project.bintray {
145+
user = project.ext["deployment.bintrayUser"]
146+
key = project.ext["deployment.bintrayKey"]
147+
configurations = ["archives"]
148+
dryRun = false
149+
publish = true
150+
pkg {
151+
repo = "maven"
152+
name = artifactId
153+
desc = description
154+
licenses = [license]
155+
githubRepo = Artifacts.githubRepo
156+
websiteUrl = Artifacts.githubUrl
157+
vcsUrl = "${Artifacts.githubUrl}.git"
158+
issueTrackerUrl = "${Artifacts.githubUrl}/issues"
159+
publicDownloadNumbers = true
160+
version {
161+
name = versionNumber
162+
desc = description
163+
}
164+
}
165+
}
166+
}
167+
}

gradle/deployment.gradle.kts

Lines changed: 0 additions & 197 deletions
This file was deleted.

instrumentation-runner/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ dependencies {
110110
// ------------------------------------------------------------------------------------------------
111111

112112
val deployConfig by extra<Artifact> { Artifacts.Instrumentation.Runner }
113-
apply(from = "$rootDir/gradle/deployment.gradle.kts")
113+
apply(from = "$rootDir/gradle/deployment.gradle")

instrumentation/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ dependencies {
102102
// ------------------------------------------------------------------------------------------------
103103

104104
val deployConfig by extra<Artifact> { Artifacts.Instrumentation.Library }
105-
apply(from = "$rootDir/gradle/deployment.gradle.kts")
105+
apply(from = "$rootDir/gradle/deployment.gradle")

0 commit comments

Comments
 (0)