Skip to content

Commit

Permalink
Merge pull request #78 from vsukharew/dev-edit-publishing-script
Browse files Browse the repository at this point in the history
edited publishing script
  • Loading branch information
vsukharew authored Oct 26, 2021
2 parents 3eca95e + 2aa900a commit eeff1d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: '../dependencies.gradle'
apply from: "../scripts/publish-maven-central.gradle"
apply from: "../scripts/publishing.gradle"

android {
compileSdkVersion build.compileSdkVersion
Expand Down
32 changes: 9 additions & 23 deletions scripts/publish-maven-central.gradle → scripts/publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.source
tasks.register("androidSourcesJar", Jar) {
from android.sourceSets.main.java.srcDirs
archiveClassifier.set('sources')
}

artifacts {
Expand Down Expand Up @@ -39,16 +39,15 @@ afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
artifact androidSourcesJar

// The coordinates of the library, being set from variables that
// we'll set up in a moment
groupId build.library.publishGroupId
artifactId build.library.publishArtifactId
version build.library.versionName

// Two artifacts, the `aar` and the sources
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact androidSourcesJar

// Self-explanatory metadata for the most part
pom {
name = build.library.publishArtifactId
Expand All @@ -74,18 +73,6 @@ afterEvaluate {
developerConnection = 'scm:git:ssh://github.com/vsukharew/AnyTypeAdapter'
url = 'https://github.com/vsukharew/AnyTypeAdapter/tree/master'
}
// A slightly hacky fix so that your POM will include any transitive dependencies
// that your library builds upon
withXml {
def dependenciesNode = asNode().appendNode('dependencies')

project.configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
Expand All @@ -111,8 +98,7 @@ afterEvaluate {
}
}
}
}

signing {
sign publishing.publications
signing {
sign publishing.publications
}
}

0 comments on commit eeff1d6

Please sign in to comment.