diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-02-06 17:34:17 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-06 17:34:17 +0530 |
commit | 7f4ade8255d6e0bcaf03f2d39e94efa2d955642f (patch) | |
tree | 7f708d18aeb2555ab462f68395869c0e78e5f600 /buildSrc/src | |
parent | c021869f9750314df83d1d72ce05a17bf72b62f0 (diff) |
Replace JCenter with Maven Central (#1303)
Diffstat (limited to 'buildSrc/src')
-rw-r--r-- | buildSrc/src/main/java/BaseProjectConfig.kt | 20 | ||||
-rw-r--r-- | buildSrc/src/main/java/BintrayPublishing.kt | 94 | ||||
-rw-r--r-- | buildSrc/src/main/java/Dependencies.kt | 4 | ||||
-rw-r--r-- | buildSrc/src/main/java/PasswordStorePlugin.kt | 5 |
4 files changed, 22 insertions, 101 deletions
diff --git a/buildSrc/src/main/java/BaseProjectConfig.kt b/buildSrc/src/main/java/BaseProjectConfig.kt index d1944888..5a1c044c 100644 --- a/buildSrc/src/main/java/BaseProjectConfig.kt +++ b/buildSrc/src/main/java/BaseProjectConfig.kt @@ -38,7 +38,25 @@ internal fun Project.configureForRootProject() { internal fun Project.configureForAllProjects() { repositories { 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") } } tasks.withType<KotlinCompile> { diff --git a/buildSrc/src/main/java/BintrayPublishing.kt b/buildSrc/src/main/java/BintrayPublishing.kt deleted file mode 100644 index 1429b0cb..00000000 --- a/buildSrc/src/main/java/BintrayPublishing.kt +++ /dev/null @@ -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")) - } - } -} diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index fd0a74c1..49d2e7a8 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -8,8 +8,10 @@ private const val KOTLIN_VERSION = "1.4.30" object Plugins { val androidGradlePlugin = "com.android.tools.build:gradle:4.1.1" 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 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" } @@ -61,7 +63,7 @@ object Dependencies { 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 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 sshj = "com.hierynomus:sshj:0.30.0" const val ssh_auth = "org.sufficientlysecure:sshauthentication-api:1.0" diff --git a/buildSrc/src/main/java/PasswordStorePlugin.kt b/buildSrc/src/main/java/PasswordStorePlugin.kt index 12cd764e..b8271f65 100644 --- a/buildSrc/src/main/java/PasswordStorePlugin.kt +++ b/buildSrc/src/main/java/PasswordStorePlugin.kt @@ -11,7 +11,6 @@ import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.plugins.JavaLibraryPlugin import org.gradle.api.plugins.JavaPlugin -import org.gradle.api.publish.PublishingExtension import org.gradle.api.tasks.compile.JavaCompile import org.gradle.kotlin.dsl.getByType import org.gradle.kotlin.dsl.withType @@ -36,10 +35,6 @@ class PasswordStorePlugin : Plugin<Project> { } is LibraryPlugin -> { project.extensions.getByType<TestedExtension>().configureCommonAndroidOptions() - project.extensions.getByType<TestedExtension>().registerSourcesJarTask(project) - project.afterEvaluate { - project.extensions.getByType<PublishingExtension>().configureMavenPublication(project) - } } is AppPlugin -> { project.extensions.getByType<BaseAppModuleExtension>().configureAndroidApplicationOptions(project) |