Skip to content

Commit

Permalink
Maven publish (#1)
Browse files Browse the repository at this point in the history
* Use maven-publishing to configure the artifacts

* Change demo app version to 0.0.4

* Enable proguard after maven-publish
  • Loading branch information
ninovanhooff authored Jun 19, 2021
1 parent b684ea8 commit bbaa244
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ dependencies {


localImplementation project(path: ':library')
jitpackImplementation 'com.github.Q42:Q42Stats.Android:v0.0.3'
jitpackImplementation 'com.github.Q42:Q42Stats.Android:0.0.4'
}
41 changes: 24 additions & 17 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import java.text.SimpleDateFormat
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'maven'
id 'maven-publish'
}

group = 'com.github.Q42'
Expand All @@ -28,7 +28,7 @@ android {

buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
consumerProguardFiles 'proguard-rules.pro'
debuggable false
Expand All @@ -41,23 +41,9 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}
}


dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
Expand All @@ -67,4 +53,25 @@ dependencies {
testImplementation 'org.json:json:20201115'


}

// Because the components are created only during the afterEvaluate phase, you must
// configure your publications using the afterEvaluate() lifecycle method.
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// Applies the component for the release build variant.
from components.release

// You can then customize attributes of the publication as shown below.
// JitPack will override these value for us, so leave them to the defaults.
// Default group is set in the root of this gradle file
//groupId = 'com.example.MyLibrary'
//artifactId = 'final'
//version = '1.0'
}
}
}
}

0 comments on commit bbaa244

Please sign in to comment.