Gradle configuration for publishing to a bintray repository

This commit is contained in:
Grisha Kruglov 2018-05-29 16:15:46 -04:00
parent cc84c3a07e
commit 5d7a7764e5
3 changed files with 69 additions and 0 deletions

View file

@ -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
}

View file

@ -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

View file

@ -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
}
}