Commit 93ed3568 by chengfengpiaopiao

jenkinsns gradle打包配置

parent 56f1988c
<component name="ProjectDictionaryState">
<dictionary name="Administrator" />
</component>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/DuoBaoJingCai2.iml" filepath="$PROJECT_DIR$/DuoBaoJingCai2.iml" />
<module fileurl="file://$PROJECT_DIR$/DuoBaoJingCai.iml" filepath="$PROJECT_DIR$/DuoBaoJingCai.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/multi-image-selector/multi-image-selector.iml" filepath="$PROJECT_DIR$/multi-image-selector/multi-image-selector.iml" />
</modules>
......
......@@ -5,7 +5,7 @@ def customPropsFile = file("buildcustom.properties");
Properties customProps = new Properties()
def networkType = '2';
def suffixName = ['2': '', '0': '_test', '1': '_out_test']
def suffixName = ['2': '_release', '0': '_test', '1': '_out_test']
if (customPropsFile.canRead()) {
customProps.load(new FileInputStream(customPropsFile))
networkType = customProps['networkType'].toString()
......@@ -20,21 +20,17 @@ android {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
versionName APP_VERSION
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "base"] //默认名称
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //方法数超过65535
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
//配置keystore签名
signingConfigs {
release {
......@@ -46,48 +42,57 @@ android {
}
//多渠道配置
// productFlavors {
// wandoujia {}
// baidu {}
// c360 {}
// uc {}
// xiaomi {}
// huawei {}
// productFlavors.all { flavor ->
// flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
// }
// }
productFlavors {
baseflavor {}
productFlavors.all { flavor ->
flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
}
}
buildTypes {
release {
minifyEnabled false //是否混淆
zipAlignEnabled true //Zipalign优化
//是否混淆
minifyEnabled false
//Zipalign优化
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "int", "network_type", networkType
buildConfigField "boolean", "ENABLE_DEBUG", "false"
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
//shrinkResources true 有了minifyEnabled就不要这个,混淆的时候会过滤无用处资源
signingConfig signingConfigs.release
//有了minifyEnabled就不要这个,混淆的时候会过滤无用处资源
//shrinkResources true
buildConfigField "int", "network_type", networkType
buildConfigField "boolean", "ENABLE_DEBUG", "true"
signingConfig signingConfigs.release
}
}
//
// android.applicationVariants.all { variant ->
// variant.outputs.each { output ->
// def outputFile = output.outputFile
// def channelName = variant.productFlavors[0].name;
// //这里修改文件名
// def fileName = "duobaojingcai_${channelName}_v${defaultConfig.versionName}${suffixName[networkType]}.apk"
// output.outputFile = new File(outputFile.parent, fileName)
// }
// }
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
def channelName = variant.productFlavors[0].name
if("false".equals(IS_JENKINS)){
def fileName ="duobaojingcai_${channelName}_v${defaultConfig.versionName}${suffixName[networkType]}.apk"
output.outputFile = new File(outputFile.parent, fileName)
}else{
channelName = PRODUCT_FLAAVOR_BUILD
def env = ENVIRONMENT
def packTime = JENKINS_TIME
def fileName;
//outputFile = "/vagrant/jenkins/jenkins-workspace/walleApps"
outputFile = "/var/jenkins_home/walleApps"
if("release".equals(env)){
fileName = "duobaojingcai_${channelName}_v${defaultConfig.versionName}_${env}.apk"
}else{
fileName = "duobaojingcai_${channelName}_v${defaultConfig.versionName}_${env}_${packTime}.apk"
}
output.outputFile = new File(outputFile, fileName)
}
}
}
}
......@@ -97,27 +102,26 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "com.android.support:support-v13:23.1.0"
testCompile 'junit:junit:4.12'
compile "com.jakewharton:butterknife:6.1.0"
compile "com.squareup.retrofit2:retrofit:2.0.2"
compile "com.squareup.retrofit2:converter-gson:2.0.2"
compile "com.squareup.retrofit2:adapter-rxjava:2.0.2"
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.9'
compile 'com.google.code.gson:gson:2.6.2'
compile "com.squareup.okhttp3:logging-interceptor:3.2.0"
compile "com.squareup.okhttp3:logging-interceptor:3.1.0"
compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:1.0.2'
compile 'cz.msebera.android:httpclient:4.4.1.1'
//底部tab选择器
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
//友盟统计
compile 'com.umeng.analytics:analytics:latest.integration'
compile 'com.meituan.android.walle:library:1.1.5' //walle
//walle
compile 'com.meituan.android.walle:library:1.1.5'
//图片选择器
compile project(path: ':multi-image-selector')
//权限申请
compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.3@aar'
}
......@@ -23,4 +23,14 @@ org.gradle.daemon=false
org.gradle.jvmargs=-XX:MaxPermSize=1024m
?android.useDeprecatedNdk=true
\ No newline at end of file
?android.useDeprecatedNdk=true
#jenkins
APP_VERSION = 2.0.0
IS_JENKINS = false
ENVIRONMENT = "debug"
PRODUCT_FLAAVOR_BUILD = "base"
JENKINS_TIME = ""
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment