-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
159 lines (140 loc) · 4.73 KB
/
build.gradle.kts
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import org.jetbrains.kotlin.konan.properties.loadProperties
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.0-alpha14")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle.kts files
}
}
tasks {
register("clean", Delete::class) {
delete(rootProject.buildDir)
}
val sourcesJar by creating(Jar::class) {
archiveClassifier.set("sources")
from(android.sourceSets.getByName("main").java.srcDirs)
}
val javadocJar by creating(Jar::class) {
dependsOn(JavaPlugin.JAVADOC_TASK_NAME)
classifier = "javadoc"
from(tasks["javadoc"])
}
artifacts {
add("archives", sourcesJar)
add("archives", javadocJar)
}
}
// Project configuration
class Module(val name: String, val description: String, val group: String, val version: String)
val projectName = "android-utils-ktx"
val projectVersion = "1.0.0"
val projectGroup = "com.github.omarmiatello.android-utils-ktx"
val projectRepoPath = "github.com/omarmiatello/android-utils-ktx"
val sharedArtifacts = listOf(
Module(
name = "easyfrc",
description = "Simple configuration: Variables for Firebase Remote Config",
group = projectGroup,
version = "1.1.0"
),
Module(
name = "commonintent",
description = "Common intents for Android",
group = projectGroup,
version = "1.1.0"
),
Module(
name = "slf4j-logger",
description = "Simple implementation of SLF4J Logger for Android",
group = projectGroup,
version = "1.0.0"
)
)
// Plugins configuration
plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
}
// mavenCentral() configuration
group = projectGroup
version = projectVersion
loadProperties(file("local.properties").absolutePath).also { p ->
p.stringPropertyNames().forEach { key ->
ext[key] = p.getProperty(key)
}
}
val ossrhUsername: String? by ext
val ossrhPassword: String? by ext
nexusPublishing {
repositories {
create("myNexus") {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(ossrhUsername)
password.set(ossrhPassword)
}
}
}
val sharedArtifactsMap = sharedArtifacts.associateBy { ":${it.name}" }
configure(subprojects.filter { it.path in sharedArtifactsMap.keys }) {
//apply<JavaLibraryPlugin>()
apply<SigningPlugin>()
apply<MavenPublishPlugin>()
// configure<JavaPluginExtension> {
// withJavadocJar()
// withSourcesJar()
// }
configure<SigningExtension> {
val publishing: PublishingExtension by project
sign(publishing.publications)
}
configure<PublishingExtension> {
publications {
val main by creating(MavenPublication::class) {
// from(components["java"])
pom {
val module = sharedArtifactsMap.getValue(project.path)
name.set("$projectName-${project.name}")
description.set(module.description)
url.set("https://$projectRepoPath")
group = module.group
version = module.version
licenses {
license {
name.set("MIT License")
// https://opensource.org/licenses/MIT
url.set("https://$projectRepoPath/blob/master/LICENSE")
}
}
developers {
developer {
id.set("jackl85")
name.set("Omar Miatello")
email.set("omar.miatello@gmail.com")
}
}
scm {
connection.set("scm:git:$projectRepoPath.git")
developerConnection.set("scm:git:ssh://$projectRepoPath.git")
url.set("https://$projectRepoPath/tree/master")
}
}
}
}
repositories {
maven {
name = project.name
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
}