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 @@ ...@@ -2,7 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <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$/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" /> <module fileurl="file://$PROJECT_DIR$/multi-image-selector/multi-image-selector.iml" filepath="$PROJECT_DIR$/multi-image-selector/multi-image-selector.iml" />
</modules> </modules>
......
...@@ -5,7 +5,7 @@ def customPropsFile = file("buildcustom.properties"); ...@@ -5,7 +5,7 @@ def customPropsFile = file("buildcustom.properties");
Properties customProps = new Properties() Properties customProps = new Properties()
def networkType = '2'; def networkType = '2';
def suffixName = ['2': '', '0': '_test', '1': '_out_test'] def suffixName = ['2': '_release', '0': '_test', '1': '_out_test']
if (customPropsFile.canRead()) { if (customPropsFile.canRead()) {
customProps.load(new FileInputStream(customPropsFile)) customProps.load(new FileInputStream(customPropsFile))
networkType = customProps['networkType'].toString() networkType = customProps['networkType'].toString()
...@@ -20,21 +20,17 @@ android { ...@@ -20,21 +20,17 @@ android {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 23 targetSdkVersion 23
versionCode 1 versionCode 1
versionName "1.0" versionName APP_VERSION
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "base"] //默认名称 manifestPlaceholders = [UMENG_CHANNEL_VALUE: "base"] //默认名称
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //方法数超过65535 multiDexEnabled true //方法数超过65535
} }
lintOptions { lintOptions {
checkReleaseBuilds false 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 abortOnError false
} }
//配置keystore签名 //配置keystore签名
signingConfigs { signingConfigs {
release { release {
...@@ -46,48 +42,57 @@ android { ...@@ -46,48 +42,57 @@ android {
} }
//多渠道配置 //多渠道配置
productFlavors {
// productFlavors { baseflavor {}
// wandoujia {} productFlavors.all { flavor ->
// baidu {} flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
// c360 {} }
// uc {} }
// xiaomi {}
// huawei {}
// productFlavors.all { flavor ->
// flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
// }
// }
buildTypes { buildTypes {
release { release {
minifyEnabled false //是否混淆 //是否混淆
zipAlignEnabled true //Zipalign优化 minifyEnabled false
//Zipalign优化
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "int", "network_type", networkType buildConfigField "int", "network_type", networkType
buildConfigField "boolean", "ENABLE_DEBUG", "false" buildConfigField "boolean", "ENABLE_DEBUG", "false"
signingConfig signingConfigs.release
} }
debug { debug {
minifyEnabled false minifyEnabled false
//shrinkResources true 有了minifyEnabled就不要这个,混淆的时候会过滤无用处资源 //有了minifyEnabled就不要这个,混淆的时候会过滤无用处资源
signingConfig signingConfigs.release //shrinkResources true
buildConfigField "int", "network_type", networkType buildConfigField "int", "network_type", networkType
buildConfigField "boolean", "ENABLE_DEBUG", "true" buildConfigField "boolean", "ENABLE_DEBUG", "true"
signingConfig signingConfigs.release
} }
} }
android.applicationVariants.all { variant ->
// variant.outputs.each { output ->
// android.applicationVariants.all { variant -> def outputFile = output.outputFile
// variant.outputs.each { output -> def channelName = variant.productFlavors[0].name
// def outputFile = output.outputFile if("false".equals(IS_JENKINS)){
// def channelName = variant.productFlavors[0].name; def fileName ="duobaojingcai_${channelName}_v${defaultConfig.versionName}${suffixName[networkType]}.apk"
// //这里修改文件名 output.outputFile = new File(outputFile.parent, fileName)
// def fileName = "duobaojingcai_${channelName}_v${defaultConfig.versionName}${suffixName[networkType]}.apk" }else{
// output.outputFile = new File(outputFile.parent, fileName) 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 { ...@@ -97,27 +102,26 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })
compile "com.android.support:support-v13:23.1.0" compile "com.android.support:support-v13:23.1.0"
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
compile "com.jakewharton:butterknife:6.1.0" compile "com.jakewharton:butterknife:6.1.0"
compile "com.squareup.retrofit2:retrofit:2.0.2" compile "com.squareup.retrofit2:retrofit:2.0.2"
compile "com.squareup.retrofit2:converter-gson:2.0.2" compile "com.squareup.retrofit2:converter-gson:2.0.2"
compile "com.squareup.retrofit2:adapter-rxjava:2.0.2" compile "com.squareup.retrofit2:adapter-rxjava:2.0.2"
compile 'io.reactivex:rxandroid:1.2.1' compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.9' compile 'io.reactivex:rxjava:1.1.9'
compile 'com.google.code.gson:gson:2.6.2' compile 'com.google.code.gson:gson:2.6.2'
compile "com.squareup.okhttp3:logging-interceptor:3.1.0"
compile "com.squareup.okhttp3:logging-interceptor:3.2.0"
compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:1.0.2' compile 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:1.0.2'
compile 'cz.msebera.android:httpclient:4.4.1.1' compile 'cz.msebera.android:httpclient:4.4.1.1'
//底部tab选择器
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar' compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
//友盟统计
compile 'com.umeng.analytics:analytics:latest.integration' compile 'com.umeng.analytics:analytics:latest.integration'
//walle
compile 'com.meituan.android.walle:library:1.1.5' //walle compile 'com.meituan.android.walle:library:1.1.5'
//图片选择器
compile project(path: ':multi-image-selector') compile project(path: ':multi-image-selector')
//权限申请
compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.3@aar' compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.3@aar'
} }
...@@ -24,3 +24,13 @@ org.gradle.daemon=false ...@@ -24,3 +24,13 @@ org.gradle.daemon=false
org.gradle.jvmargs=-XX:MaxPermSize=1024m org.gradle.jvmargs=-XX:MaxPermSize=1024m
?android.useDeprecatedNdk=true ?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