Commit f7b87623 by chengfengpiaopiao

sdk编译版本改为25

parent 85058ee8
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager"> <component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" /> <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
...@@ -27,7 +24,7 @@ ...@@ -27,7 +24,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/DuoBaoJingCai.iml" filepath="$PROJECT_DIR$/DuoBaoJingCai.iml" /> <module fileurl="file://$PROJECT_DIR$/DuoBaoJingCai.iml" filepath="$PROJECT_DIR$/DuoBaoJingCai.iml" />
<module fileurl="file://$PROJECT_DIR$/DuoBaoJingCai2.iml" filepath="$PROJECT_DIR$/DuoBaoJingCai2.iml" /> <module fileurl="file://G:\Product\Android\DuoBaoJingCai\DuoBaoJingCai2.iml" filepath="G:\Product\Android\DuoBaoJingCai\DuoBaoJingCai2.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>
......
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'walle' //walle apply plugin: 'walle' //walle
def customPropsFile = file("buildcustom.properties"); def customPropsFile = file("buildcustom.properties");
Properties customProps = new Properties() Properties customProps = new Properties()
def networkType = '2'; def networkType = '2';
def suffixName = ['2': '_release', '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()
} }
println("suffixName: " + suffixName[networkType]) println("suffixName: " + suffixName[networkType])
//初始化gradle.properties参数 //初始化gradle.properties参数
def projectName = PROJECT_NAME def projectName = PROJECT_NAME
def env = ENVIRONMENT def env = ENVIRONMENT
...@@ -19,17 +16,15 @@ def packTime = getDate() ...@@ -19,17 +16,15 @@ def packTime = getDate()
def is_jenkins = IS_JENKINS def is_jenkins = IS_JENKINS
def projectNameLowerCase = projectName.toLowerCase() def projectNameLowerCase = projectName.toLowerCase()
def fileToJiaGuBaoWalle def fileToJiaGuBaoWalle
def getDate() { def getDate() {
def date = new Date() def date = new Date()
def formattedDate = date.format('yyyyMMdd') def formattedDate = date.format('yyyyMMdd')
return formattedDate return formattedDate
} }
def createFile(path, is_jenkins) {
def createFile(path,is_jenkins){
println(path) println(path)
File file = new File(path); File file = new File(path);
if(!file.exists()){//判断是否待删除目录是否存在 if (!file.exists()) {//判断是否待删除目录是否存在
File fileParent = file.getParentFile(); File fileParent = file.getParentFile();
fileParent.mkdirs(); fileParent.mkdirs();
return false; return false;
...@@ -39,20 +34,19 @@ def createFile(path,is_jenkins){ ...@@ -39,20 +34,19 @@ def createFile(path,is_jenkins){
} }
String[] content = file.list();//取得当前目录下所有文件和文件夹 String[] content = file.list();//取得当前目录下所有文件和文件夹
for(String name : content){ for (String name : content) {
File temp = new File(path, name); File temp = new File(path, name);
if(temp.isDirectory()){//判断是否是目录 if (temp.isDirectory()) {//判断是否是目录
deleteDir(temp.getAbsolutePath());//递归调用,删除目录里的内容 deleteDir(temp.getAbsolutePath());//递归调用,删除目录里的内容
temp.delete();//删除空目录 temp.delete();//删除空目录
}else{ } else {
if(!temp.delete()){//直接删除文件 if (!temp.delete()) {//直接删除文件
System.err.println("Failed to delete " + name); System.err.println("Failed to delete " + name);
} }
} }
} }
return true; return true;
} }
android { android {
compileSdkVersion rootProject.ext.compileSdkVersion compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion buildToolsVersion rootProject.ext.buildToolsVersion
...@@ -118,7 +112,8 @@ android { ...@@ -118,7 +112,8 @@ android {
def fileName def fileName
println("is_jenkins: " + is_jenkins) //build.gralde根据module的个数,执行的次数为module.mount+1 println("is_jenkins: " + is_jenkins) //build.gralde根据module的个数,执行的次数为module.mount+1
println("projectName: " + projectName) println("projectName: " + projectName)
if ("false".equals(is_jenkins)) { //groovy boolean 如果你把一个对象放在一个boolean表达式中,Groovy 会检查这个对象是否为null. 它会把null当做false,否则为true if ("false".equals(is_jenkins)) {
//groovy boolean 如果你把一个对象放在一个boolean表达式中,Groovy 会检查这个对象是否为null. 它会把null当做false,否则为true
fileName = "${projectNameLowerCase}_${channelName}_v${defaultConfig.versionName}${suffixName[networkType]}.apk" fileName = "${projectNameLowerCase}_${channelName}_v${defaultConfig.versionName}${suffixName[networkType]}.apk"
outputFile = "G:/Apks/${projectName}" outputFile = "G:/Apks/${projectName}"
} else { } else {
...@@ -128,14 +123,14 @@ android { ...@@ -128,14 +123,14 @@ android {
outputFile = "/var/jenkins_home/walleApps/${projectName}" outputFile = "/var/jenkins_home/walleApps/${projectName}"
if ("release".equals(env)) { if ("release".equals(env)) {
fileName = "${projectNameLowerCase}_${channelName}_v${defaultConfig.versionName}_${env}_${packTime}.apk" fileName = "${projectNameLowerCase}_${channelName}_v${defaultConfig.versionName}_${env}_${packTime}.apk"
outputFile = outputFile + "/"+"${env}" outputFile = outputFile + "/" + "${env}"
} else { } else {
fileName = "${projectNameLowerCase}_${channelName}_v${defaultConfig.versionName}_${env}_${packTime}.apk" fileName = "${projectNameLowerCase}_${channelName}_v${defaultConfig.versionName}_${env}_${packTime}.apk"
outputFile = outputFile + "/"+"${env}" outputFile = outputFile + "/" + "${env}"
} }
} }
createFile(outputFile,is_jenkins); createFile(outputFile, is_jenkins);
println("outputFileFinally ---> "+ outputFile); println("outputFileFinally ---> " + outputFile);
fileToJiaGuBaoWalle = outputFile fileToJiaGuBaoWalle = outputFile
output.outputFile = new File(outputFile, fileName) output.outputFile = new File(outputFile, fileName)
} }
...@@ -170,28 +165,22 @@ android { ...@@ -170,28 +165,22 @@ android {
compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.3@aar' compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.3@aar'
} }
} }
task hello1 << { task hello1 << {
println 'hello1'+"app.build.gradle" println 'hello1' + "app.build.gradle"
} }
task startApp(type: Exec) {
task startApp(type: Exec){
task -> task ->
workingDir '.' workingDir '.'
commandLine 'cd' commandLine 'cd'
} }
task upper << { task upper << {
String someString = 'mY_nAmE' String someString = 'mY_nAmE'
println "Original: " + someString println "Original: " + someString
println "Upper case: " + someString.toUpperCase() println "Upper case: " + someString.toUpperCase()
} }
task count << { task count << {
4.times { print "$it " } 4.times { print "$it " }
} }
/** /**
* gradlew assembleRelease jiagubao_walle * gradlew assembleRelease jiagubao_walle
* 一键实现多渠道打包 * 一键实现多渠道打包
...@@ -199,50 +188,45 @@ task count << { ...@@ -199,50 +188,45 @@ task count << {
def BASE_LOCAL = "G:/Apks/" def BASE_LOCAL = "G:/Apks/"
def BUILD_TOOLS = "/build-tools/25.0.0" def BUILD_TOOLS = "/build-tools/25.0.0"
def SDK_PATH_COMPONENY = "D:/2_android/as_client/sdk" def SDK_PATH_COMPONENY = "D:/2_android/as_client/sdk"
def SDK_PATH_COMPONENY_BUILDTOOLS = SDK_PATH_COMPONENY+BUILD_TOOLS def SDK_PATH_COMPONENY_BUILDTOOLS = SDK_PATH_COMPONENY + BUILD_TOOLS
def SDK_PATH_HOME = "D:/Android/AndroidSDK" def SDK_PATH_HOME = "D:/Android/AndroidSDK"
def SDK_PATH_HOME_BUILDTOOLS = SDK_PATH_HOME+BUILD_TOOLS def SDK_PATH_HOME_BUILDTOOLS = SDK_PATH_HOME + BUILD_TOOLS
def apkName = "${projectNameLowerCase}_baseflavor_v${APP_VERSION}${suffixName[networkType]}" //基础包 def apkName = "${projectNameLowerCase}_baseflavor_v${APP_VERSION}${suffixName[networkType]}" //基础包
def apkBasePath = BASE_LOCAL+projectName+"/" def apkBasePath = BASE_LOCAL + projectName + "/"
def apkV2Name = "${projectNameLowerCase}_v${APP_VERSION}${suffixName[networkType]}_v2" //v2包(已注销) def apkV2Name = "${projectNameLowerCase}_v${APP_VERSION}${suffixName[networkType]}_v2" //v2包(已注销)
def apkV2Path = BASE_LOCAL+projectName+"/"+"v2/" def apkV2Path = BASE_LOCAL + projectName + "/" + "v2/"
def apkWallleName = "${projectNameLowerCase}_v${APP_VERSION}${suffixName[networkType]}" //walle基础包(已注销) def apkWallleName = "${projectNameLowerCase}_v${APP_VERSION}${suffixName[networkType]}" //walle基础包(已注销)
def apkWallePath = BASE_LOCAL+projectName+"/"+"walleBase/" def apkWallePath = BASE_LOCAL + projectName + "/" + "walleBase/"
def walleChalles = BASE_LOCAL+projectName+"/"+"walleChalles" //多渠道打包后的apks所在目录(已注销) def walleChalles = BASE_LOCAL + projectName + "/" + "walleChalles" //多渠道打包后的apks所在目录(已注销)
def currentSdkBuildToolsPath = "true".equals(IN_COMPONENY)? SDK_PATH_COMPONENY_BUILDTOOLS: SDK_PATH_HOME_BUILDTOOLS //当前SDK/build.tools路径 def currentSdkBuildToolsPath = "true".equals(IN_COMPONENY) ? SDK_PATH_COMPONENY_BUILDTOOLS : SDK_PATH_HOME_BUILDTOOLS //当前SDK/build.tools路径
def utilsPath = BASE_LOCAL+projectName+"/tools/" //需要使用的工具 def utilsPath = BASE_LOCAL + projectName + "/tools/" //需要使用的工具
def scriptName = "jiagubao-walle.bat" //脚本名称 def scriptName = "jiagubao-walle.bat" //脚本名称
def cmdParams = scriptName+" "+ def cmdParams = scriptName + " " +
apkName+" "+ apkName + " " +
apkBasePath+" "+ apkBasePath + " " +
apkV2Name+" "+ apkV2Name + " " +
apkV2Path+" "+ apkV2Path + " " +
apkWallleName+" "+ apkWallleName + " " +
apkWallePath+" "+ apkWallePath + " " +
currentSdkBuildToolsPath+" "+ currentSdkBuildToolsPath + " " +
utilsPath utilsPath
task jiagubao_walle(dependsOn: 'cleanFile') << { task jiagubao_walle(dependsOn: 'cleanFile') << {
String date = cmdParams.execute().text.trim().toString() //带返回值 String date = cmdParams.execute().text.trim().toString() //带返回值
print date print date
} }
task cleanFile << { task cleanFile << {
println("cleanFile") println("cleanFile")
createFile(apkV2Path,true); createFile(apkV2Path, true);
createFile(apkWallePath,true); createFile(apkWallePath, true);
createFile(walleChalles,true); createFile(walleChalles, true);
} }
//Python脚本 //Python脚本
def jenkinsJobName="DuoBaoJingCai" def jenkinsJobName = "DuoBaoJingCai"
def jenkinsBuild="release" def jenkinsBuild = "release"
task uploadpython(type: Exec) { task uploadpython(type: Exec) {
workingDir '../' workingDir '../'
commandLine "python","pythondemo.py", "$jenkinsJobName", "$jenkinsBuild" commandLine "python", "pythondemo.py", "$jenkinsJobName", "$jenkinsBuild"
} }
//CMD控制台 //CMD控制台
//String cmd2 = 'explorer .' //String cmd2 = 'explorer .'
//task hello2(){ //task hello2(){
...@@ -251,16 +235,15 @@ task uploadpython(type: Exec) { ...@@ -251,16 +235,15 @@ task uploadpython(type: Exec) {
// println cmdResult // println cmdResult
// println "hello end" // println "hello end"
//} //}
//Shell脚本 //Shell脚本
/** /**
* explorer . * explorer .
* sh shell.sh DuoBaoJingCai release * sh shell.sh DuoBaoJingCai release
* F:\Tool\SSH\Git\Git\bin\sh.exe G:\Product\Android\DuoBaoJingCai\shell.sh DuoBaoJingCai release * F:\Tool\SSH\Git\Git\bin\sh.exe G:\Product\Android\DuoBaoJingCai\shell.sh DuoBaoJingCai release
*/ */
task execShell (type:Exec){ task execShell(type: Exec) {
executable 'sh' executable 'sh'
args "-c", "../shell.sh $APP_VERSION $networkType" args "-c", "../shell.sh $APP_VERSION $networkType"
} }
dependencies {
}
\ No newline at end of file
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<activity <activity
android:name=".view.activity.MainActivity" android:name=".view.activity.MainActivity"
android:exported="true" android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTask"
android:theme="@android:style/Theme.Translucent" android:theme="@android:style/Theme.Translucent"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
<intent-filter> <intent-filter>
......
...@@ -25,9 +25,9 @@ task clean(type: Delete) { ...@@ -25,9 +25,9 @@ task clean(type: Delete) {
ext { ext {
//版本 //版本
compileSdkVersion = 23 compileSdkVersion = 25
buildToolsVersion = "23.0.3" //23.0.3 buildToolsVersion = "25.0.1" //23.0.3
targetSdkVersion = 23 targetSdkVersion = 25
//项目依赖 //项目依赖
ButterKnife = "6.1.0" ButterKnife = "6.1.0"
......
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