From 5d7a7764e5b0f89213d0c99c7b9da566df2df54e Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Tue, 29 May 2018 16:15:46 -0400 Subject: [PATCH] Gradle configuration for publishing to a bintray repository --- sdks/android/Mentat/build.gradle | 9 +++++ sdks/android/Mentat/gradle.properties | 9 +++++ sdks/android/Mentat/library/build.gradle | 51 ++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/sdks/android/Mentat/build.gradle b/sdks/android/Mentat/build.gradle index 09f9f5ed..9f40753e 100644 --- a/sdks/android/Mentat/build.gradle +++ b/sdks/android/Mentat/build.gradle @@ -2,6 +2,11 @@ buildscript { ext.kotlin_version = '1.2.41' + + ext.library = [ + version: '0.3.1' + ] + repositories { jcenter() google() @@ -10,6 +15,10 @@ buildscript { classpath 'com.android.tools.build:gradle:3.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + // Publish. + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } diff --git a/sdks/android/Mentat/gradle.properties b/sdks/android/Mentat/gradle.properties index aac7c9b4..89e15d97 100644 --- a/sdks/android/Mentat/gradle.properties +++ b/sdks/android/Mentat/gradle.properties @@ -15,3 +15,12 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + +libGroupId=org.mozilla.mentat +libRepositoryName=Mentat +libProjectName=mentat +libProjectDescription=A persistent, relational store inspired by Datomic and DataScript. +libUrl=https://github.com/mozilla/mentat +libVcsUrl=https://github.com/mozilla/mentat.git + +libLicense=MPL-2.0 diff --git a/sdks/android/Mentat/library/build.gradle b/sdks/android/Mentat/library/build.gradle index 1f8526c8..5facabdb 100644 --- a/sdks/android/Mentat/library/build.gradle +++ b/sdks/android/Mentat/library/build.gradle @@ -1,5 +1,8 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' +apply plugin: 'com.jfrog.bintray' +// Simply applying this plugin gets bintray to publish a pom file. +apply plugin: 'com.github.dcendents.android-maven' android { compileSdkVersion 27 @@ -46,3 +49,51 @@ dependencies { repositories { mavenCentral() } + +// Publishing to jcenter/bintray. +def libGroupId = properties.libGroupId +def libRepoName = properties.libRepositoryName +def libProjectName = properties.libProjectName +def libProjectDescription = properties.libProjectDescription +def libUrl = properties.libUrl +def libVcsUrl = properties.libVcsUrl +def libLicense = properties.libLicense + +Properties localProperties = null +if (project.rootProject.file('local.properties').canRead()) { + localProperties = new Properties() + localProperties.load(project.rootProject.file('local.properties').newDataInputStream()) +} + +version = rootProject.ext.library['version'] + +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} + +artifacts { + archives sourcesJar +} + + +group = libGroupId +archivesBaseName = libProjectName + +bintray { + user = localProperties != null ? localProperties.getProperty("bintray.user") : "" + key = localProperties != null ? localProperties.getProperty("bintray.apikey") : "" + + configurations = ['archives'] + pkg { + repo = libRepoName + name = libProjectName + userOrg = "grisha" // Temporary org name until package is on jcenter. Issue #725. + desc = libProjectDescription + websiteUrl = libUrl + vcsUrl = libVcsUrl + licenses = [libLicense] + publish = true + publicDownloadNumbers = true + } +}