Replace JCenter with Maven Central (#1303)

This commit is contained in:
Harsh Shandilya 2021-02-06 17:34:17 +05:30 committed by GitHub
parent c021869f97
commit 7f4ade8255
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 75 additions and 120 deletions

View file

@ -23,10 +23,32 @@ jobs:
echo '::set-output name=PROJECT::autofill-parser' echo '::set-output name=PROJECT::autofill-parser'
fi fi
- name: Publish snapshot - name: Setup secrets
run: |
# Using --batch doesn't prompt for a password for importing, which works
# out for us since we supply it to the Gradle plugin directly.
echo "${NEXUS_PUBLISH_GPG_KEY}" | base64 --decode | gpg --batch --import
# Set environment variables
echo "SONATYPE_NEXUS_USERNAME=${NEXUS_PUBLISH_USERNAME}" >> $GITHUB_ENV
echo "SONATYPE_NEXUS_PASSWORD=${NEXUS_PUBLISH_PASSWORD}" >> $GITHUB_ENV
# The ORG_GRADLE_PROJECT_ prefixed properties are equivalent to ./gradlew -Pproperty.name=value
echo "ORG_GRADLE_PROJECT_signing.keyId=${NEXUS_PUBLISH_GPG_KEY_ID}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_signing.password=${NEXUS_PUBLISH_GPG_KEY_PASSWORD}" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_signing.secretKeyRingFile=$HOME/.gnupg/secring.gpg" >> $GITHUB_ENV
env:
NEXUS_PUBLISH_GPG_KEY: ${{ secrets.NEXUS_PUBLISH_GPG_KEY }}
NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
NEXUS_PUBLISH_GPG_KEY_ID: ${{ secrets.NEXUS_PUBLISH_GPG_KEY_ID }}
NEXUS_PUBLISH_GPG_KEY_PASSWORD: ${{ secrets.NEXUS_PUBLISH_GPG_KEY_PASSWORD }}
- name: Upload binaries
uses: burrunan/gradle-cache-action@03c71a8ba93d670980695505f48f49daf43704a6 uses: burrunan/gradle-cache-action@03c71a8ba93d670980695505f48f49daf43704a6
with: with:
arguments: :${{ steps.task-select.outputs.PROJECT }}:publishApsPublicationToBintrayRepository arguments: :${{ steps.task-select.outputs.PROJECT }}:uploadArchives
env:
MAVEN_USER: msfjarvis - name: Close and release repository
MAVEN_PASSWORD: ${{ secrets.BINTRAY_TOKEN }} uses: burrunan/gradle-cache-action@03c71a8ba93d670980695505f48f49daf43704a6
with:
arguments: closeAndReleaseRepository

View file

@ -1,6 +1,6 @@
plugins { plugins {
id("com.android.library") id("com.android.library")
id("maven-publish") id("com.vanniktech.maven.publish")
kotlin("android") kotlin("android")
`aps-plugin` `aps-plugin`
} }

View file

@ -1,16 +1,17 @@
GROUP=com.github.androidpasswordstore
VERSION_NAME=1.1.0-SNAPSHOT VERSION_NAME=1.1.0-SNAPSHOT
POM_ARTIFACT_ID=autofill-parser POM_ARTIFACT_ID=autofill-parser
POM_ARTIFACT_DESCRIPTION=Android library for low-level parsing of Autofill structures POM_NAME=autofill-parser
POM_DESCRIPTION=Android library for low-level parsing of Autofill structures
POM_INCEPTION_YEAR=2020
POM_URL=https://github.com/Android-Password-Store/android-password-store POM_URL=https://github.com/Android-Password-Store/android-password-store
POM_SCM_URL=https://github.com/Android-Password-Store/android-password-store POM_SCM_URL=https://github.com/Android-Password-Store/android-password-store
POM_SCM_CONNECTION=scm:git:https://github.com/Android-Password-Store/android-password-store.git POM_SCM_CONNECTION=scm:git:https://github.com/Android-Password-Store/android-password-store.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:Android-Password-Store/android-password-store POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:Android-Password-Store/android-password-store
POM_LICENSE_NAME=LGPL-3.0-only WITH LGPL-3.0-linking-exception POM_LICENCE_NAME=LGPL-3.0-only WITH LGPL-3.0-linking-exception
POM_LICENSE_URL=https://www.gnu.org/licenses/lgpl-3.0.txt POM_LICENCE_URL=https://www.gnu.org/licenses/lgpl-3.0.txt
POM_LICENSE_DIST=repo POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=android-password-store POM_DEVELOPER_ID=android-password-store
POM_DEVELOPER_NAME=The Android Password Store Authors POM_DEVELOPER_NAME=The Android Password Store Authors

View file

@ -5,7 +5,7 @@ plugins {
repositories { repositories {
google() google()
gradlePluginPortal() gradlePluginPortal()
jcenter() mavenCentral()
// For binary compatibility validator. // For binary compatibility validator.
maven { url = uri("https://kotlin.bintray.com/kotlinx") } maven { url = uri("https://kotlin.bintray.com/kotlinx") }
} }
@ -34,7 +34,9 @@ gradlePlugin {
dependencies { dependencies {
implementation(Plugins.androidGradlePlugin) implementation(Plugins.androidGradlePlugin)
implementation(Plugins.binaryCompatibilityValidator) implementation(Plugins.binaryCompatibilityValidator)
implementation(Plugins.dokkaPlugin)
implementation(Plugins.downloadTaskPlugin) implementation(Plugins.downloadTaskPlugin)
implementation(Plugins.kotlinGradlePlugin) implementation(Plugins.kotlinGradlePlugin)
implementation(Plugins.mavenPublishPlugin)
implementation(Plugins.semver4j) implementation(Plugins.semver4j)
} }

View file

@ -38,7 +38,25 @@ internal fun Project.configureForRootProject() {
internal fun Project.configureForAllProjects() { internal fun Project.configureForAllProjects() {
repositories { repositories {
google() google()
jcenter() mavenCentral()
jcenter() {
content {
// Direct dependencies
// https://github.com/zhanghai/AndroidFastScroll/issues/35
includeModule("me.zhanghai.android.fastscroll", "library")
// https://github.com/open-keychain/open-keychain/issues/2645
includeModule("org.sufficientlysecure", "sshauthentication-api")
// Indirect dependencies
// https://youtrack.jetbrains.com/issue/IDEA-261387
includeModule("org.jetbrains.trove4j", "trove4j")
// https://github.com/Kotlin/dokka/issues/41
includeGroup("org.jetbrains.dokka")
includeGroup("org.jetbrains.kotlinx")
includeModule("org.jetbrains", "markdown")
}
}
maven { setUrl("https://jitpack.io") } maven { setUrl("https://jitpack.io") }
} }
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {

View file

@ -1,94 +0,0 @@
/*
* Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
* SPDX-License-Identifier: GPL-3.0-only
*/
import com.android.build.gradle.TestedExtension
import java.util.Locale
import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.register
/**
* Register the `sourcesJar` task so that our published artifacts can include them.
*/
internal fun TestedExtension.registerSourcesJarTask(project: Project) {
project.tasks.register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").java.srcDirs)
}
}
/**
* Configures the `apsMaven` and `bintray` repositories along with an `aps` publication
*/
internal fun PublishingExtension.configureMavenPublication(project: Project) {
repositories {
maven {
val artifactId = project.getKey("POM_ARTIFACT_ID")
name = "bintray"
url = project.uri("https://api.bintray.com/maven/android-password-store/$artifactId/$artifactId/;publish=1;override=0")
credentials {
username = project.getCredential("user")
password = project.getCredential("password")
}
}
}
publications {
create<MavenPublication>("aps") {
from(project.components.getByName("release"))
groupId = project.getKey("GROUP")
artifactId = project.getKey("POM_ARTIFACT_ID")
version = project.getKey("VERSION_NAME")
artifact(project.tasks.getByName("sourcesJar"))
configurePom(project)
}
}
}
private fun Project.getCredential(type: String): String {
return when (type) {
// Attempt to find credentials passed by -Pmaven.$type=
"user", "password" -> (findProperty("maven.$type")
// Fall back to MAVEN_$type from env
?: System.getenv("MAVEN_${type.toUpperCase(Locale.ROOT)}"))?.toString()
// Finally fallthrough to an empty string to let task configuration complete
// even if actual publishing is going to fail
?: ""
else -> throw IllegalArgumentException("Invalid credential type: $type")
}
}
private fun Project.getKey(propertyName: String): String {
return findProperty(propertyName)?.toString()
?: error("Failed to find value for property: $propertyName")
}
private fun MavenPublication.configurePom(project: Project) {
pom {
name.set(project.getKey("POM_ARTIFACT_ID"))
description.set(project.getKey("POM_ARTIFACT_DESCRIPTION"))
url.set(project.getKey("POM_URL"))
licenses {
license {
name.set(project.getKey("POM_LICENSE_NAME"))
url.set(project.getKey("POM_LICENSE_URL"))
}
}
developers {
developer {
id.set(project.getKey("POM_DEVELOPER_ID"))
name.set(project.getKey("POM_DEVELOPER_NAME"))
email.set(project.getKey("POM_DEVELOPER_EMAIL"))
}
}
scm {
connection.set(project.getKey("POM_SCM_CONNECTION"))
developerConnection.set(project.getKey("POM_SCM_DEV_CONNECTION"))
url.set(project.getKey("POM_SCM_URL"))
}
}
}

View file

@ -8,8 +8,10 @@ private const val KOTLIN_VERSION = "1.4.30"
object Plugins { object Plugins {
val androidGradlePlugin = "com.android.tools.build:gradle:4.1.1" val androidGradlePlugin = "com.android.tools.build:gradle:4.1.1"
val binaryCompatibilityValidator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.2.4" val binaryCompatibilityValidator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.2.4"
val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.4.20"
val downloadTaskPlugin = "de.undercouch:gradle-download-task:4.1.1" val downloadTaskPlugin = "de.undercouch:gradle-download-task:4.1.1"
val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION" val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
val mavenPublishPlugin = "com.vanniktech:gradle-maven-publish-plugin:0.13.0"
val semver4j = "com.vdurmont:semver4j:3.1.0" val semver4j = "com.vdurmont:semver4j:3.1.0"
} }
@ -61,7 +63,7 @@ object Dependencies {
const val jgit = "org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r" const val jgit = "org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r"
const val kotlin_result = "com.michael-bull.kotlin-result:kotlin-result:1.1.10" const val kotlin_result = "com.michael-bull.kotlin-result:kotlin-result:1.1.10"
const val leakcanary = "com.squareup.leakcanary:leakcanary-android:2.6" const val leakcanary = "com.squareup.leakcanary:leakcanary-android:2.6"
const val modern_android_prefs = "de.Maxr1998.android:modernpreferences:1.2.0-alpha1" const val modern_android_prefs = "de.maxr1998:modernandroidpreferences:2.0"
const val plumber = "com.squareup.leakcanary:plumber-android:2.6" const val plumber = "com.squareup.leakcanary:plumber-android:2.6"
const val sshj = "com.hierynomus:sshj:0.30.0" const val sshj = "com.hierynomus:sshj:0.30.0"
const val ssh_auth = "org.sufficientlysecure:sshauthentication-api:1.0" const val ssh_auth = "org.sufficientlysecure:sshauthentication-api:1.0"

View file

@ -11,7 +11,6 @@ import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.JavaLibraryPlugin import org.gradle.api.plugins.JavaLibraryPlugin
import org.gradle.api.plugins.JavaPlugin import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.getByType import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType import org.gradle.kotlin.dsl.withType
@ -36,10 +35,6 @@ class PasswordStorePlugin : Plugin<Project> {
} }
is LibraryPlugin -> { is LibraryPlugin -> {
project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions() project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions()
project.extensions.getByType<TestedExtension>().registerSourcesJarTask(project)
project.afterEvaluate {
project.extensions.getByType<PublishingExtension>().configureMavenPublication(project)
}
} }
is AppPlugin -> { is AppPlugin -> {
project.extensions.getByType<BaseAppModuleExtension>().configureAndroidApplicationOptions(project) project.extensions.getByType<BaseAppModuleExtension>().configureAndroidApplicationOptions(project)

View file

@ -51,3 +51,11 @@ android.defaults.buildfeatures.shaders=false
# Disable warnings about unsupported features, we know what we're doing # Disable warnings about unsupported features, we know what we're doing
android.suppressUnsupportedOptionWarnings=android.enableR8.fullMode,android.enableResourceOptimizations,android.nonTransitiveRClass,android.suppressUnsupportedOptionWarnings android.suppressUnsupportedOptionWarnings=android.enableR8.fullMode,android.enableResourceOptimizations,android.nonTransitiveRClass,android.suppressUnsupportedOptionWarnings
# Maven publishing
GROUP=com.github.android-password-store
# OSSRH sometimes struggles with slow deployments, so this makes Gradle
# more tolerant to those delays.
systemProp.org.gradle.internal.http.connectionTimeout=500000
systemProp.org.gradle.internal.http.socketTimeout=500000

View file

@ -1,6 +1,6 @@
plugins { plugins {
id("com.android.library") id("com.android.library")
id("maven-publish") id("com.vanniktech.maven.publish")
kotlin("android") kotlin("android")
`aps-plugin` `aps-plugin`
} }

View file

@ -1,16 +1,17 @@
GROUP=com.github.androidpasswordstore
VERSION_NAME=2.2.0 VERSION_NAME=2.2.0
POM_ARTIFACT_ID=openpgp-ktx POM_ARTIFACT_ID=openpgp-ktx
POM_ARTIFACT_DESCRIPTION=Reimplementation of OpenKeychain's integration library in Kotlin POM_NAME=openpgp-ktx
POM_DESCRIPTION=Reimplementation of OpenKeychain's integration library in Kotlin
POM_INCEPTION_YEAR=2020
POM_URL=https://github.com/Android-Password-Store/android-password-store POM_URL=https://github.com/Android-Password-Store/android-password-store
POM_SCM_URL=https://github.com/Android-Password-Store/android-password-store POM_SCM_URL=https://github.com/Android-Password-Store/android-password-store
POM_SCM_CONNECTION=scm:git:https://github.com/Android-Password-Store/android-password-store.git POM_SCM_CONNECTION=scm:git:https://github.com/Android-Password-Store/android-password-store.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:Android-Password-Store/android-password-store POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com:Android-Password-Store/android-password-store
POM_LICENSE_NAME=LGPL-3.0-only WITH LGPL-3.0-linking-exception POM_LICENCE_NAME=LGPL-3.0-only WITH LGPL-3.0-linking-exception
POM_LICENSE_URL=https://www.gnu.org/licenses/lgpl-3.0.txt POM_LICENCE_URL=https://www.gnu.org/licenses/lgpl-3.0.txt
POM_LICENSE_DIST=repo POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=android-password-store POM_DEVELOPER_ID=android-password-store
POM_DEVELOPER_NAME=The Android Password Store Authors POM_DEVELOPER_NAME=The Android Password Store Authors

View file

@ -9,6 +9,6 @@ include(":openpgp-ktx")
pluginManagement { pluginManagement {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
jcenter() mavenCentral()
} }
} }