Skip to content

Commit 7fba4af

Browse files
Adding scripts
1 parent 25d5b6f commit 7fba4af

File tree

5 files changed

+135
-0
lines changed

5 files changed

+135
-0
lines changed

build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ plugins {
44
id("com.android.library") version "8.0.1" apply false
55
id("org.jetbrains.kotlin.android") version "1.8.21" apply false
66
id("com.google.devtools.ksp") version "1.8.21-1.0.11" apply false
7+
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
8+
id("org.jetbrains.dokka") version "1.8.10"
79
}
10+
apply(from = "${rootDir}/scripts/publish-root.gradle")

scripts/publish-module.gradle

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
apply plugin: 'maven-publish'
2+
apply plugin: 'signing'
3+
apply plugin: 'org.jetbrains.dokka'
4+
5+
group = PUBLISH_GROUP_ID
6+
version = PUBLISH_VERSION
7+
8+
task androidSourcesJar(type: Jar) {
9+
archiveClassifier.set('sources')
10+
11+
from android.sourceSets.main.java.srcDirs
12+
from android.sourceSets.main.kotlin.srcDirs
13+
}
14+
15+
tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
16+
pluginsMapConfiguration.set(
17+
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
18+
)
19+
}
20+
21+
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
22+
archiveClassifier.set('javadoc')
23+
from dokkaJavadoc.outputDirectory
24+
}
25+
26+
artifacts {
27+
archives androidSourcesJar
28+
archives javadocJar
29+
}
30+
31+
afterEvaluate {
32+
publishing {
33+
publications {
34+
release(MavenPublication) {
35+
groupId "com.github.leandroborgesferreira"
36+
artifactId PUBLISH_ARTIFACT_ID
37+
version PUBLISH_VERSION
38+
39+
from components.release
40+
41+
artifact androidSourcesJar
42+
artifact javadocJar
43+
44+
pom {
45+
name = "storyteller"
46+
description = "A library to create complex text editors inside apps"
47+
url = 'https://https://github.com/leandroBorgesFerreira/StoryTeller'
48+
licenses {
49+
license {
50+
name = 'The Apache Software License, Version 2.0'
51+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
52+
}
53+
}
54+
developers {
55+
developer {
56+
id = 'leandroBorgesFerreira'
57+
name = 'Leandro Borges Ferreira'
58+
59+
url = "https://github.com/leandroBorgesFerreira"
60+
}
61+
}
62+
scm {
63+
connection = "scm:[email protected]:leandroBorgesFerreira/StoryTeller.git"
64+
developerConnection = "scm:git:ssh://github.com/leandroBorgesFerreira/StoryTeller.git"
65+
url = "https://github.com/leandroBorgesFerreira/StoryTeller"
66+
}
67+
}
68+
}
69+
}
70+
}
71+
}
72+
73+
signing {
74+
useInMemoryPgpKeys(
75+
rootProject.ext["signing.keyId"],
76+
rootProject.ext["signing.key"],
77+
rootProject.ext["signing.password"],
78+
)
79+
sign publishing.publications
80+
}

scripts/publish-root.gradle

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Create variables with empty default values
2+
ext["ossrhUsername"] = ''
3+
ext["ossrhPassword"] = ''
4+
ext["sonatypeStagingProfileId"] = ''
5+
ext["signing.keyId"] = ''
6+
ext["signing.password"] = ''
7+
ext["signing.key"] = ''
8+
ext["snapshot"] = ''
9+
10+
File secretPropsFile = project.rootProject.file('local.properties')
11+
if (secretPropsFile.exists()) {
12+
// Read local.properties file first if it exists
13+
Properties p = new Properties()
14+
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
15+
p.each { name, value -> ext[name] = value }
16+
} else {
17+
// Use system environment variables
18+
ext["ossrhUsername"] = System.getenv('SONATYPE_NEXUS_USERNAME')
19+
ext["ossrhPassword"] = System.getenv('SONATYPE_NEXUS_PASSWORD')
20+
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
21+
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
22+
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
23+
ext["signing.key"] = System.getenv('SIGNING_KEY')
24+
ext["snapshot"] = System.getenv('SNAPSHOT')
25+
}
26+
27+
nexusPublishing {
28+
repositories {
29+
sonatype {
30+
stagingProfileId = sonatypeStagingProfileId
31+
username = ossrhUsername
32+
password = ossrhPassword
33+
}
34+
}
35+
}

storyteller/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ plugins {
33
id("org.jetbrains.kotlin.android")
44
}
55

6+
rootProject.extra.apply {
7+
set("PUBLISH_GROUP_ID", "com.github.leandroborgesferreira")
8+
set("PUBLISH_ARTIFACT_ID", "storyteller")
9+
set("PUBLISH_VERSION", "0.1.0")
10+
}
11+
12+
apply(from = "${rootDir}/scripts/publish-module.gradle")
13+
614
android {
715
namespace = "br.com.leandroferreira.storyteller"
816
compileSdk = 33

storyteller_persistence/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ plugins {
44
id("com.google.devtools.ksp")
55
}
66

7+
8+
rootProject.extra.apply {
9+
set("PUBLISH_GROUP_ID", "com.github.leandroborgesferreira")
10+
set("PUBLISH_ARTIFACT_ID", "storyteller-persistence")
11+
set("PUBLISH_VERSION", "0.1.0")
12+
}
13+
14+
apply(from = "${rootDir}/scripts/publish-module.gradle")
15+
716
android {
817
namespace = "br.com.leandroferreira.storyteller.persistence"
918
compileSdk = 33

0 commit comments

Comments
 (0)