验证中...
开源中国 2018 年度最后一场技术盛会邀你来约~错过就要等明年啦!点此立即预约
语言: Groovy
分类: Android 组件
最后更新于 2018-12-09 10:05
片段 1 片段 2 片段 3 片段 4 片段 5
revision.gradle
原始数据 复制代码
def getSvnRevision = {
return new ByteArrayOutputStream().withStream { os ->
exec {
executable = 'svn'
args = ['info']
standardOutput = os
}
def lastChangedRevMatcher = os.toString() =~ /(最后修改的版本:|Last Changed Rev:) (\d+)/
lastChangedRevMatcher[0][2].toInteger()
}
}
def getGitRevision = {
def gitRevisionCommand = 'git rev-list HEAD --count'
return gitRevisionCommand.execute().text.trim().toInteger()
}
def getVcsRevision = {
if (new File(".svn").exists()) return getSvnRevision()
if (new File(".git").exists()) return getGitRevision()
return 1
}
ext {
revision = getVcsRevision()
println("revision: $revision")
}
app_file_name.gradle
原始数据 复制代码
android {
applicationVariants.all { variant ->
variant.outputs.all {
if (!variant.buildType.debuggable) {
outputFileName = "${rootProject.name}-v${variant.versionName}-${variant.versionCode}.apk"
}
}
}
}
project_build.gradle
原始数据 复制代码
repositories {
google()
jcenter()
maven { url 'https://dl.bintray.com/7hens/maven/' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://repository.sonatype.org/content/groups/public' }
maven { url 'http://mvnrepository.com/' }
maven { url 'https://jitpack.io' }
}
settings.gradle
原始数据 复制代码
include ':kore'
project(':kore').projectDir = new File(rootProject.projectDir, '../kdroid/kore')
publish.md
原始数据 复制代码

Gradle

project buld.gradle

buildscript {
    dependencies {
        classpath 'com.novoda:bintray-release:0.5.0'
    }
}

publish.gradle

apply plugin: 'com.novoda.bintray-release'

publish {
    groupId = 'cn.thens.kdroid'
    artifactId = 'kore'
    publishVersion = '0.1.10'
    desc = 'Android library written in Kotlin'
    website = 'https://github.com/7hens/kdroid'
}

For Mac

new file named 'publish'

#!/usr/bin/env bash
cd $1
../gradlew clean build bintrayUpload -PbintrayUser=USER -PbintrayKey=KEY -PdryRun=false
cd ..

评论列表( 0 )

你可以在登录后,发表评论

搜索帮助