Skip to content

Commit

Permalink
Merge pull request #20 from pseudoankit/publish-maven-central
Browse files Browse the repository at this point in the history
Publish maven central
  • Loading branch information
pseudoankit committed Jan 25, 2024
2 parents 6284283 + 1f74a57 commit a68d040
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 47 deletions.
3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
implementation('org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0')
}

implementation project(':coachmark')
implementation 'io.github.pseudoankit:coachmark:1.0.2'
implementation 'androidx.activity:activity-compose:1.7.2'
implementation platform('androidx.compose:compose-bom:2022.10.00')
implementation 'androidx.compose.ui:ui'
Expand Down
29 changes: 6 additions & 23 deletions coachmark/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'maven-publish'
}

apply from: '../gradle/publish-package.gradle'

ext {
ARTIFACT_ID = "coachmark"
}

kotlin {
Expand All @@ -15,17 +20,8 @@ android {
defaultConfig {
minSdk 19
targetSdk 34

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -49,16 +45,3 @@ dependencies {
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material3:material3'
}

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
groupId = 'com.pseudoankit'
artifactId = 'compose-coachmark'
version = '1.0.0'
}
}
}
}
Empty file removed coachmark/consumer-rules.pro
Empty file.
21 changes: 0 additions & 21 deletions coachmark/proguard-rules.pro

This file was deleted.

128 changes: 128 additions & 0 deletions gradle/publish-package.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

ext {
GROUP_ID = "io.github.pseudoankit"
VERSION_NAME = "1.0.3"

POM_DESCRIPTION = "Compose library to add coachmark"
POM_URL = "https://github.com/pseudoankit/coachmark"
POM_SCM_CONNECTION = "scm:git@github.com:pseudoankit/coachmark.git"

OSS_USERNAME = System.getenv("OSS_USERNAME")
OSS_PASSWORD = System.getenv("OSS_PASSWORD")

}

signing {
useInMemoryPgpKeys(
System.getenv("SIGNING_KEY_ID"),
System.getenv("SIGNING_KEY"),
System.getenv("SIGNING_PASSWORD"),
)
sign publishing.publications
}

afterEvaluate {
publishing {
publications {
release(MavenPublication) {

from components.release

groupId GROUP_ID
artifactId ARTIFACT_ID
version VERSION_NAME

pom {
name = ARTIFACT_ID
description = POM_DESCRIPTION
url = POM_URL
licenses {
license {
name = "The Apache Software License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
scm {
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_CONNECTION
url = POM_URL
}
developers {
developer {
id = 'pseudoankit'
name = 'Ankit Kumar'
email = 'lostankit7@gmail.com'
}
}
}
}
}
repositories {
maven {
name = "SonatypeSnapshot"

// def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
// def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
// url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"

credentials {
username OSS_USERNAME
password OSS_PASSWORD
}
}

maven {
name = "sonatype"

// def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
// def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
// url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"

credentials {
username OSS_USERNAME
password OSS_PASSWORD
}
}
}
}
}

task androidJavadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
}
}

exclude '**/R.html', '**/R.*.html', '**/index.html'
options.encoding 'utf-8'
options {
addStringOption 'docencoding', 'utf-8'
addStringOption 'charset', 'utf-8'
links 'https://docs.oracle.com/javase/7/docs/api/'
links 'https://d.android.com/reference'
links 'https://developer.android.com/reference/androidx/'
}
}

task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
archiveClassifier.set('javadoc')
from androidJavadoc.destinationDir

preserveFileTimestamps = false
reproducibleFileOrder = true
}

task javaSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs

preserveFileTimestamps = false
reproducibleFileOrder = true
}
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "coachmark"
Expand Down

0 comments on commit a68d040

Please sign in to comment.