提交 35b1f9c3 编写于 作者: J jackjintai

android:优化打包流程

上级 05eec4e6
if (rootProject.ext.config["applyPlugin"]) {
if (rootProject.ext.config["applyLocalModule"]) {
// 引用插件
apply plugin: 'com.didi.dokit.debug'
// apply plugin: 'com.didi.dokit'
......@@ -8,16 +8,16 @@ if (rootProject.ext.config["applyPlugin"]) {
debugImplementation project(":doraemonkit")
debugImplementation project(":doraemonkit-weex")
releaseImplementation project(":doraemonkit-no-op")
debugImplementation project(":doraemonkit-leakcanary")
//新版线上包
// debugImplementation "com.didichuxing.doraemonkit:doraemonkit:${rootProject.ext.android["jcenterArchivesVersionName"]}"
// debugImplementation "com.didichuxing.doraemonkit:doraemonkit-leakcanary:${rootProject.ext.android["jcenterArchivesVersionName"]}"
// releaseImplementation "com.didichuxing.doraemonkit:doraemonkit-no-op:${rootProject.ext.android["jcenterArchivesVersionName"]}"
// debugImplementation "com.didichuxing.doraemonkit:doraemonkit-weex:${rootProject.ext.android["jcenterArchivesVersionName"]}"
//debugImplementation project(":doraemonkit-leakcanary")
}
} else {
// 引用no-op的库
dependencies {
//新版线上包
debugImplementation "com.didichuxing.doraemonkit:doraemonkit:${rootProject.ext.android["jcenterArchivesVersionName"]}"
// debugImplementation "com.didichuxing.doraemonkit:doraemonkit-leakcanary:${rootProject.ext.android["jcenterArchivesVersionName"]}"
releaseImplementation "com.didichuxing.doraemonkit:doraemonkit-no-op:${rootProject.ext.android["jcenterArchivesVersionName"]}"
debugImplementation "com.didichuxing.doraemonkit:doraemonkit-weex:${rootProject.ext.android["jcenterArchivesVersionName"]}"
}
}
\ No newline at end of file
ext {
config = [
// 很多app都会有自己的打包开关,来区分线上包和测试包,可以通过给applyPlugin赋值来区分测试包和线上包
// 线上包不会接入DoraemonKit,测试包会自动接入
applyPlugin : true,
//上传到仓库时需要打开
uploadArchives : false,
//是否发布插件到远程仓库
publishPluginToRemote: false,
localRepoURL : "/Users/didi/project/dokit_repo"
// 是否依赖本地module
applyLocalModule : true,
//是否依赖线上社区的dokit 版本 上传到jcenter仓库时需要打开
dependOnlineDokitVersion: false,
//是否发布插件到滴滴内部远程仓库 默认打包发布到 localRepoURL
publishDevEnvToRemote : false,
//发布到研发环境仓库 默认打包发布到 localRepoURL
publishDevEnvArchives : true,
//本地仓库地址
localRepoURL : "/Users/didi/project/dokit_repo"
]
android = [compileSdkVersion : 29,
suppotrSdkVersion : "28.0.0",
......
apply plugin: 'com.android.library'
apply from: 'upload.gradle'
if (rootProject.ext.config["publishDevEnvArchives"]) {
apply from: 'upload-dev.gradle'
} else {
apply from: 'upload-release.gradle'
}
/**
* 必须配置git path 否则会报Error:(29, 0) CreateProcess error=2, The system cannot find the file specified 错误
......
# 解决 http://tools.android.com/tech-docs/new-build-system/gradle-experimental 问题
# android.useDeprecatedNdk=true
GROUP_ID=com.didichuxing.doraemonkit
ARTIFACT_ID=doraemonkit
VERSION=1000.0.0
RELEASE_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/
SNAPSHOT_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/
USERNAME=deployment
PASSWORD=deployment123
\ No newline at end of file
def isRemote = rootProject.ext.config["publishPluginToRemote"]
def isRemote = rootProject.ext.config["publishDevEnvToRemote"]
apply plugin: 'maven'
if (isRemote) {
uploadArchives {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-leakcanary"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
......@@ -26,11 +26,11 @@ if (isRemote) {
}
repository(url: project.RELEASE_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
repository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/") {
authentication(userName: "deployment", password: "deployment123")
}
snapshotRepository(url: project.SNAPSHOT_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
snapshotRepository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/") {
authentication(userName: "deployment", password: "deployment123")
}
}
}
......@@ -41,8 +41,8 @@ if (isRemote) {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-leakcanary"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
pom.withXml {
......
apply plugin: 'com.novoda.bintray-release'
// 配置发布 # script
publish {
def groupProjectID = 'com.didichuxing.doraemonkit'
def artifactProjectID = 'doraemonkit-leakcanary'
def publishVersionID = "${rootProject.ext.android["jcenterArchivesVersionName"]}"
userOrg = 'doraemonkit'
repoName = 'DoraemonKit'
groupId = groupProjectID
artifactId = artifactProjectID
publishVersion = publishVersionID
desc = '{library description}'
website = '{github_url}'
}
\ No newline at end of file
#!/usr/bin/env bash
echo -n "please enter bintray userid ->"
read userid_bintray
echo -n "please enter bintray apikey ->"
read apikey_bintray
../gradlew clean build bintrayUpload -PbintrayUser=${userid_bintray} -PbintrayKey=${apikey_bintray} -PdryRun=false
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply from: 'upload.gradle'
if (rootProject.ext.config["publishDevEnvArchives"]) {
apply from: 'upload-dev.gradle'
} else {
apply from: 'upload-release.gradle'
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
# 解决 http://tools.android.com/tech-docs/new-build-system/gradle-experimental 问题
# android.useDeprecatedNdk=true
GROUP_ID=com.didichuxing.doraemonkit
ARTIFACT_ID=doraemonkit-no-op
VERSION=1000.0.0
RELEASE_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/
SNAPSHOT_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/
USERNAME=deployment
PASSWORD=deployment123
\ No newline at end of file
def isRemote = rootProject.ext.config["publishPluginToRemote"]
def isRemote = rootProject.ext.config["publishDevEnvToRemote"]
apply plugin: 'maven'
if(isRemote){
uploadArchives {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-no-op"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
......@@ -26,11 +26,11 @@ if(isRemote){
}
repository(url: project.RELEASE_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
repository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/") {
authentication(userName: "deployment", password: "deployment123")
}
snapshotRepository(url: project.SNAPSHOT_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
snapshotRepository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/") {
authentication(userName: "deployment", password: "deployment123")
}
}
}
......@@ -41,8 +41,8 @@ if(isRemote){
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-no-op"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
pom.withXml {
......
apply plugin: 'com.novoda.bintray-release'
// 配置发布 # script
publish {
def groupProjectID = 'com.didichuxing.doraemonkit'
def artifactProjectID = 'doraemonkit-no-op'
def publishVersionID = "${rootProject.ext.android["jcenterArchivesVersionName"]}"
userOrg = 'doraemonkit'
repoName = 'DoraemonKit'
groupId = groupProjectID
artifactId = artifactProjectID
publishVersion = publishVersionID
desc = '{library description}'
website = '{github_url}'
}
\ No newline at end of file
#!/usr/bin/env bash
echo -n "please enter bintray userid ->"
read userid_bintray
echo -n "please enter bintray apikey ->"
read apikey_bintray
../gradlew clean build bintrayUpload -PbintrayUser=${userid_bintray} -PbintrayKey=${apikey_bintray} -PdryRun=false
\ No newline at end of file
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply from: 'upload.gradle'
if (rootProject.ext.config["publishDevEnvArchives"]) {
apply from: 'upload-dev.gradle'
} else {
apply from: 'upload-release.gradle'
}
sourceSets {
main {
......
# 解决 http://tools.android.com/tech-docs/new-build-system/gradle-experimental 问题
# android.useDeprecatedNdk=true
GROUP_ID=com.didichuxing.doraemonkit
ARTIFACT_ID=doraemonkit-plugin
VERSION=1000.0.0
RELEASE_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/
SNAPSHOT_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/
USERNAME=deployment
PASSWORD=deployment123
\ No newline at end of file
def isRemote = rootProject.ext.config["publishPluginToRemote"]
def isRemote = rootProject.ext.config["publishDevEnvToRemote"]
apply plugin: 'maven'
if (isRemote) {
uploadArchives {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-plugin"
version rootProject.ext.android["pluginVersionName"]
}
......@@ -26,11 +26,11 @@ if (isRemote) {
}
repository(url: project.RELEASE_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
repository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/") {
authentication(userName: "deployment", password: "deployment123")
}
snapshotRepository(url: project.SNAPSHOT_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
snapshotRepository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/") {
authentication(userName: "deployment", password: "deployment123")
}
}
}
......@@ -41,8 +41,8 @@ if (isRemote) {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-plugin"
version rootProject.ext.android["pluginVersionName"]
}
pom.withXml {
......
apply plugin: 'com.novoda.bintray-release'
// 配置发布 # script
publish {
def groupProjectID = 'com.didichuxing.doraemonkit'
def artifactProjectID = 'doraemonkit-plugin'
def publishVersionID = "${rootProject.ext.android["pluginVersionName"]}"
userOrg = 'doraemonkit'
repoName = 'DoraemonKit'
groupId = groupProjectID
artifactId = artifactProjectID
publishVersion = publishVersionID
desc = '{library description}'
website = '{github_url}'
}
\ No newline at end of file
#!/usr/bin/env bash
echo -n "please enter bintray userid ->"
read userid_bintray
echo -n "please enter bintray apikey ->"
read apikey_bintray
../gradlew clean build bintrayUpload -PbintrayUser=${userid_bintray} -PbintrayKey=${apikey_bintray} -PdryRun=false
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply from: './upload.gradle'
if (rootProject.ext.config["publishDevEnvArchives"]) {
apply from: 'upload-dev.gradle'
} else {
apply from: 'upload-release.gradle'
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......@@ -55,7 +59,7 @@ dependencies {
compileOnly rootProject.ext.dependencies["didi_http"]
compileOnly rootProject.ext.dependencies["didi_rpc"]
//此处需要使用api的形式 向上暴露内部api
if (rootProject.ext.config["uploadArchives"]) {
if (rootProject.ext.config["dependOnlineDokitVersion"]) {
api "com.didichuxing.doraemonkit:doraemonkit:${rootProject.ext.android["jcenterArchivesVersionName"]}"
} else {
api project(':doraemonkit')
......
# 解决 http://tools.android.com/tech-docs/new-build-system/gradle-experimental 问题
# android.useDeprecatedNdk=true
GROUP_ID=com.didichuxing.doraemonkit
ARTIFACT_ID=doraemonkit-rpc
VERSION=1000.0.0
RELEASE_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/
SNAPSHOT_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/
USERNAME=deployment
PASSWORD=deployment123
\ No newline at end of file
def isRemote = rootProject.ext.config["publishPluginToRemote"]
def isRemote = rootProject.ext.config["publishDevEnvToRemote"]
apply plugin: 'maven'
if (isRemote) {
uploadArchives {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-rpc"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
......@@ -26,11 +26,11 @@ if (isRemote) {
}
repository(url: project.RELEASE_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
repository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/") {
authentication(userName: "deployment", password: "deployment123")
}
snapshotRepository(url: project.SNAPSHOT_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
snapshotRepository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/") {
authentication(userName: "deployment", password: "deployment123")
}
}
}
......@@ -41,8 +41,8 @@ if (isRemote) {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-rpc"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
pom.withXml {
......
apply plugin: 'com.novoda.bintray-release'
// 配置发布 # script
publish {
def groupProjectID = 'com.didichuxing.doraemonkit'
def artifactProjectID = 'doraemonkit-rpc'
def publishVersionID = "${rootProject.ext.android["jcenterArchivesVersionName"]}"
userOrg = 'doraemonkit'
repoName = 'DoraemonKit'
groupId = groupProjectID
artifactId = artifactProjectID
publishVersion = publishVersionID
desc = '{library description}'
website = '{github_url}'
}
\ No newline at end of file
#!/usr/bin/env bash
echo -n "please enter bintray userid ->"
read userid_bintray
echo -n "please enter bintray apikey ->"
read apikey_bintray
../gradlew clean build bintrayUpload -PbintrayUser=${userid_bintray} -PbintrayKey=${apikey_bintray} -PdryRun=false
\ No newline at end of file
apply plugin: 'com.android.library'
apply from: './upload.gradle'
if (rootProject.ext.config["publishDevEnvArchives"]) {
apply from: 'upload-dev.gradle'
} else {
apply from: 'upload-release.gradle'
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......@@ -39,7 +43,7 @@ dependencies {
implementation rootProject.ext.dependencies["constraintLayout"]
implementation rootProject.ext.dependencies["design"]
implementation rootProject.ext.dependencies["utilcode"]
if (rootProject.ext.config["uploadArchives"]) {
if (rootProject.ext.config["dependOnlineDokitVersion"]) {
implementation "com.didichuxing.doraemonkit:doraemonkit:${rootProject.ext.android["jcenterArchivesVersionName"]}"
} else {
implementation project(':doraemonkit')
......
# 解决 http://tools.android.com/tech-docs/new-build-system/gradle-experimental 问题
# android.useDeprecatedNdk=true
GROUP_ID=com.didichuxing.doraemonkit
ARTIFACT_ID=doraemonkit-weex
VERSION=1000.0.0
RELEASE_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/
SNAPSHOT_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/
USERNAME=deployment
PASSWORD=deployment123
\ No newline at end of file
def isRemote = rootProject.ext.config["publishPluginToRemote"]
def isRemote = rootProject.ext.config["publishDevEnvToRemote"]
apply plugin: 'maven'
if(isRemote){
uploadArchives {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-weex"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
......@@ -26,11 +26,11 @@ if(isRemote){
}
repository(url: project.RELEASE_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
repository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/") {
authentication(userName: "deployment", password: "deployment123")
}
snapshotRepository(url: project.SNAPSHOT_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
snapshotRepository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/") {
authentication(userName: "deployment", password: "deployment123")
}
}
}
......@@ -41,8 +41,8 @@ if(isRemote){
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit-weex"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
pom.withXml {
......
apply plugin: 'com.novoda.bintray-release'
// 配置发布 # script
publish {
def groupProjectID = 'com.didichuxing.doraemonkit'
def artifactProjectID = 'doraemonkit-weex'
def publishVersionID = "${rootProject.ext.android["jcenterArchivesVersionName"]}"
userOrg = 'doraemonkit'
repoName = 'DoraemonKit'
groupId = groupProjectID
artifactId = artifactProjectID
publishVersion = publishVersionID
desc = '{library description}'
website = '{github_url}'
}
\ No newline at end of file
#!/usr/bin/env bash
echo -n "please enter bintray userid ->"
read userid_bintray
echo -n "please enter bintray apikey ->"
read apikey_bintray
../gradlew clean build bintrayUpload -PbintrayUser=${userid_bintray} -PbintrayKey=${apikey_bintray} -PdryRun=false
\ No newline at end of file
......@@ -2,7 +2,11 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: 'upload.gradle'
if (rootProject.ext.config["publishDevEnvArchives"]) {
apply from: 'upload-dev.gradle'
} else {
apply from: 'upload-release.gradle'
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
......
# 解决 http://tools.android.com/tech-docs/new-build-system/gradle-experimental 问题
# android.useDeprecatedNdk=true
GROUP_ID=com.didichuxing.doraemonkit
ARTIFACT_ID=doraemonkit
VERSION=1000.0.0
RELEASE_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/
SNAPSHOT_REPOSITORY_URL=http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/
USERNAME=deployment
PASSWORD=deployment123
\ No newline at end of file
def isRemote = rootProject.ext.config["publishPluginToRemote"]
def isRemote = rootProject.ext.config["publishDevEnvToRemote"]
apply plugin: 'maven'
if (isRemote) {
uploadArchives {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
......@@ -26,11 +26,11 @@ if (isRemote) {
}
repository(url: project.RELEASE_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
repository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-release/") {
authentication(userName: "deployment", password: "deployment123")
}
snapshotRepository(url: project.SNAPSHOT_REPOSITORY_URL) {
authentication(userName: project.USERNAME, password: project.PASSWORD)
snapshotRepository(url: "http://artifactory.intra.xiaojukeji.com/artifactory/libs-snapshot/") {
authentication(userName: "deployment", password: "deployment123")
}
}
}
......@@ -41,8 +41,8 @@ if (isRemote) {
repositories {
mavenDeployer {
pom.project {
groupId project.GROUP_ID
artifactId project.ARTIFACT_ID
groupId "com.didichuxing.doraemonkit"
artifactId "doraemonkit"
version rootProject.ext.android["jcenterArchivesVersionName"]
}
pom.withXml {
......
apply plugin: 'com.novoda.bintray-release'
// 配置发布 # script
publish {
def groupProjectID = 'com.didichuxing.doraemonkit'
def artifactProjectID = 'doraemonkit'
def publishVersionID = "${rootProject.ext.android["jcenterArchivesVersionName"]}"
userOrg = 'doraemonkit'
repoName = 'DoraemonKit'
groupId = groupProjectID
artifactId = artifactProjectID
publishVersion = publishVersionID
desc = '{library description}'
website = '{github_url}'
}
\ No newline at end of file
#!/usr/bin/env bash
echo -n "please enter bintray userid ->"
read userid_bintray
echo -n "please enter bintray apikey ->"
read apikey_bintray
../gradlew clean build bintrayUpload -PbintrayUser=${userid_bintray} -PbintrayKey=${apikey_bintray} -PdryRun=false
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册