Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edited publishing script #78

Merged
merged 1 commit into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}