Skip to content

Commit 73ac260

Browse files
authored
Merge pull request #54 from yml-org/feature/OS-59
Feature/os 59: Publish script.
2 parents 7de155f + 6e60d9d commit 73ac260

File tree

2 files changed

+88
-2
lines changed

2 files changed

+88
-2
lines changed

YChartsLib/build.gradle.kts

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
plugins {
22
id("com.android.library")
33
id("org.jetbrains.kotlin.android")
4+
id("maven-publish")
5+
id("signing")
46
id("org.jetbrains.dokka")
57
}
68

@@ -49,7 +51,7 @@ dependencies {
4951
implementation(co.ycharts.dependency.YChartDependency.CORE_KTX)
5052
implementation(co.ycharts.dependency.YChartDependency.APPCOMPAT)
5153
implementation(co.ycharts.dependency.YChartDependency.MATERIAL)
52-
implementation (co.ycharts.dependency.YChartDependency.MATERIAL_3)
54+
implementation(co.ycharts.dependency.YChartDependency.MATERIAL_3)
5355
implementation(co.ycharts.dependency.YChartDependency.COMPOSE_UI)
5456
implementation(co.ycharts.dependency.YChartDependency.COMPOSE_ACTIVITY)
5557
implementation(co.ycharts.dependency.YChartDependency.COMPOSE_MATERIAL)
@@ -61,3 +63,84 @@ dependencies {
6163
androidTestImplementation(co.ycharts.dependency.YChartDependency.TEST_EXTN)
6264
androidTestImplementation(co.ycharts.dependency.YChartDependency.ESPRESSO_CORE)
6365
}
66+
val dokkaOutputDir = "$buildDir/dokka"
67+
68+
tasks.dokkaHtml {
69+
outputDirectory.set(file(dokkaOutputDir))
70+
}
71+
72+
val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") {
73+
delete(dokkaOutputDir)
74+
}
75+
val javadocJar = tasks.register<Jar>("javadocJar") {
76+
dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml)
77+
archiveClassifier.set("javadoc")
78+
from(dokkaOutputDir)
79+
}
80+
publishing {
81+
repositories {
82+
maven {
83+
name = "YCharts"
84+
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
85+
credentials {
86+
username = project.findProperty("mavenCentralUsername").toString()
87+
password = project.findProperty("mavenCentralPassword").toString()
88+
}
89+
}
90+
}
91+
publications {
92+
register<MavenPublication>("release") {
93+
groupId = "co.yml"
94+
artifactId = "ycharts"
95+
version = "1.0.0"
96+
afterEvaluate {
97+
from(components["release"])
98+
}
99+
artifact(javadocJar)
100+
pom {
101+
name.set("YCharts")
102+
description.set("YCharts is a light and extensible chart library for Jetpack Compose system.")
103+
url.set("https://github.com/yml-org/YCharts")
104+
licenses {
105+
license {
106+
name.set("The Apache License, Version 2.0")
107+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
108+
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
109+
}
110+
}
111+
developers {
112+
developer {
113+
id.set("dkk009")
114+
name.set("Deepak KK")
115+
url.set("https://github.com/dkk009")
116+
}
117+
developer {
118+
id.set("preetham1316")
119+
name.set("Preetham Ivan Dsouza")
120+
url.set("https://github.com/preetham1316")
121+
}
122+
developer {
123+
id.set("kikoso")
124+
name.set("Enrique López Mañas")
125+
url.set("https://github.com/kikoso")
126+
}
127+
}
128+
scm {
129+
url.set("https://github.com/yml-org/YCharts")
130+
connection.set("scm:git:git://github.com/yml-org/YCharts.git")
131+
developerConnection.set("scm:git:ssh://[email protected]:yml-org/YCharts.git")
132+
}
133+
}
134+
}
135+
}
136+
}
137+
138+
139+
signing {
140+
useInMemoryPgpKeys(
141+
project.findProperty("signing.keyId").toString(),
142+
project.findProperty("signing.InMemoryKey").toString(),
143+
project.findProperty("signing.password").toString()
144+
)
145+
sign(publishing.publications)
146+
}

build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ buildscript {
33
repositories {
44
google()
55
mavenCentral()
6+
maven {
7+
url = uri("https://plugins.gradle.org/m2/")
8+
}
69
}
710

811
dependencies {
912
classpath("com.android.tools.build:gradle:7.1.3")
1013
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
1114
classpath("org.jetbrains.kotlin:kotlin-android-extensions:1.6.10")
12-
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.6.0")
15+
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.6.10")
1316
}
1417

1518
tasks {

0 commit comments

Comments
 (0)