diff --git a/build.gradle b/build.gradle index 9aa9a74..8f3b4d2 100644 --- a/build.gradle +++ b/build.gradle @@ -22,28 +22,29 @@ buildscript { 'buildTools' : '30.0.3', 'appcompat' : '1.2.0', 'constraintlayout': '2.0.4', - 'kotlin' : '1.5.0', + 'kotlin' : '1.5.10', 'viewpager2' : '1.0.0' ] repositories { mavenCentral() google() - jcenter() } dependencies { classpath 'com.android.tools.build:gradle:7.1.0-alpha02' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" } } +plugins { + id("io.github.gradle-nexus.publish-plugin") version "1.1.0" +} + allprojects { repositories { mavenCentral() google() - jcenter() } } @@ -80,4 +81,33 @@ ext { licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' licenseDistribution = 'repo' allLicenses = ["Apache-2.0"] + + publication = 'local.properties' + + ext["signing.keyId"] = '' + ext["signing.password"] = '' + ext["signing.secretKeyRingFile"] = '' + + ossrhUsername = '' + ossrhPassword = '' + sonatypeStagingProfileId = '' +} + +apply plugin: 'io.github.gradle-nexus.publish-plugin' + +File publish = project.rootProject.file("${publication}") +if (publish.exists()) { + Properties properties = new Properties() + new FileInputStream(publish).withCloseable { is -> properties.load(is) } + properties.each { name, value -> ext[name] = value } +} + +nexusPublishing { + repositories { + sonatype { + username = ossrhUsername + password = ossrhPassword + stagingProfileId = sonatypeStagingProfileId + } + } } diff --git a/dynamic-motion/build.gradle b/dynamic-motion/build.gradle index 90d67df..9f615f2 100644 --- a/dynamic-motion/build.gradle +++ b/dynamic-motion/build.gradle @@ -39,8 +39,8 @@ dependencies { api "androidx.viewpager2:viewpager2:${versions.viewpager2}" } -if (project.rootProject.file('local.properties').exists()) { - apply from: 'bintray.gradle' +if (project.rootProject.file("${publication}").exists()) { + apply from: 'maven.gradle' } task generateJavadoc() { diff --git a/dynamic-motion/bintray.gradle b/dynamic-motion/maven.gradle similarity index 77% rename from dynamic-motion/bintray.gradle rename to dynamic-motion/maven.gradle index 7ef0ce6..4d8f742 100644 --- a/dynamic-motion/bintray.gradle +++ b/dynamic-motion/maven.gradle @@ -15,7 +15,7 @@ */ apply plugin: 'maven-publish' -apply plugin: 'com.jfrog.bintray' +apply plugin: 'signing' group = mavenGroup version = mavenVersion @@ -105,48 +105,12 @@ publishing { } } -// Bintray -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) +ext["signing.keyId"] = rootProject.ext["signing.keyId"] +ext["signing.password"] = rootProject.ext["signing.password"] +ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"] -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.key") - - filesSpec { - from "$buildDir/publications/library/pom-default.xml" - into "$mavenDir/$mavenArtifactId/$mavenVersion/" - rename { String fileName -> - "${mavenArtifactId}-${mavenVersion}.pom" - } - } - - configurations = ['archives'] - - pkg { - repo = mavenRepo - name = mavenArtifactId - desc = projectDesc - websiteUrl = siteUrl - vcsUrl = "${gitUrl}.git" - issueTrackerUrl = issueUrl - licenses = allLicenses - publish = true - publicDownloadNumbers = true - - githubRepo = githubUrl - - version { - name = mavenVersion - desc = versionDesc - released = new Date() - - gpg { - sign = true - passphrase = properties.getProperty("bintray.passphrase") - } - } - } +signing { + sign publishing.publications } afterEvaluate { project ->