From eb84a75c118f8d8f56972e937afc92f0b628e698 Mon Sep 17 00:00:00 2001 From: Lanchon Date: Tue, 19 Nov 2019 07:35:57 -0300 Subject: [PATCH] Refactor publishing configuration --- build.gradle | 62 ++++++------------------------------- configure-publishing.gradle | 62 +++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 53 deletions(-) create mode 100644 configure-publishing.gradle diff --git a/build.gradle b/build.gradle index 4596718..27927bf 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,9 @@ def multidexlib2VersionSuffix = '' group = 'com.github.lanchon.dexpatcher' version = dexlib2Version + multidexlib2VersionSuffix +def mainArtifact = 'multidexlib2' +def artifactName = mainArtifact + sourceCompatibility = '1.7' def jdk = findProperty('JDK7_HOME') ?: '/usr/lib/jvm/java-7-openjdk-amd64' def jdk_rt = new File(jdk, 'jre/lib/rt.jar') @@ -53,7 +56,7 @@ sourceSets.main.output.dir builtBy: generateResources, generatedResourcesDir def sharedManifest = manifest { attributes( - 'Implementation-Title': 'multidexlib2', + 'Implementation-Title': artifactName, 'Implementation-Version': version ) } @@ -65,68 +68,21 @@ tasks.withType(Jar).configureEach { duplicatesStrategy = DuplicatesStrategy.FAIL } +apply from: 'configure-publishing.gradle' + publishing { publications { multidexlib2(MavenPublication) { - artifactId = 'multidexlib2' + artifactId = mainArtifact from components.java pom { - name = 'multidexlib2' - description = 'Multi-dex extensions for dexlib2.' - url = 'https://github.com/DexPatcher/multidexlib2' - licenses { - license { - name = 'GNU General Public License (version 3 or later)' - url = 'https://www.gnu.org/licenses/gpl.txt' - } - } - organization { - name = 'DexPatcher' - url = 'https://dexpatcher.github.io/' - } - developers { - developer { - name = 'Lanchon' - url = 'https://github.com/Lanchon' - } - } - scm { - connection = 'scm:git:git://github.com/DexPatcher/multidexlib2.git' - developerConnection = 'scm:git:ssh://github.com:DexPatcher/multidexlib2.git' - url = 'https://github.com/DexPatcher/multidexlib2' - } + name = artifactName + configurePom it } } } } -publishing { - repositories { - maven { - name = 'local' - url = layout.buildDirectory.dir('repository') - } - if (project.hasProperty('publishing.url')) { - maven { - name = 'remote' - url = project.getProperty('publishing.url') - credentials { - username = project.getProperty('publishing.username') - password = project.getProperty('publishing.password') - } - } - } - } -} - -signing { - if (project.hasProperty('signing.secretKeyRingFile')) { - sign publishing.publications - } -} - apply from: 'check-copyright.gradle' -assemble.dependsOn publishAllPublicationsToLocalRepository - wrapper.distributionType = Wrapper.DistributionType.ALL diff --git a/configure-publishing.gradle b/configure-publishing.gradle new file mode 100644 index 0000000..8dbab9f --- /dev/null +++ b/configure-publishing.gradle @@ -0,0 +1,62 @@ +/* + * multidexlib2 - Copyright 2015-2019 Rodrigo Balerdi + * (GNU General Public License version 3 or later) + * + * multidexlib2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, + * or (at your option) any later version. + */ + +ext.configurePom = { pom -> + pom.description = 'Android Dalvik bytecode patcher.' + pom.url = 'https://github.com/DexPatcher/dexpatcher-tool' + pom.organization { + name = 'DexPatcher' + url = 'https://dexpatcher.github.io/' + } + pom.licenses { + license { + name = 'GNU General Public License (version 3 or later)' + url = 'https://www.gnu.org/licenses/gpl.txt' + } + } + pom.developers { + developer { + name = 'Lanchon' + url = 'https://github.com/Lanchon' + } + } + pom.scm { + connection = 'scm:git:git://github.com/DexPatcher/dexpatcher-tool.git' + developerConnection = 'scm:git:ssh://github.com:DexPatcher/dexpatcher-tool.git' + url = 'https://github.com/DexPatcher/dexpatcher-tool' + } +} + +publishing { + repositories { + maven { + name = 'local' + url = rootProject.layout.buildDirectory.dir('repository') + } + if (project.hasProperty('publishing.url')) { + maven { + name = 'remote' + url = project.getProperty('publishing.url') + credentials { + username = project.getProperty('publishing.username') + password = project.getProperty('publishing.password') + } + } + } + } +} + +signing { + if (project.hasProperty('signing.secretKeyRingFile')) { + sign publishing.publications + } +} + +assemble.dependsOn publishAllPublicationsToLocalRepository