From d255507e6686779f1a0e33d03d8e28094ecdead9 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 17 九月 2021 15:45:33 +0800
Subject: [PATCH] 0312 增加qkbt4渠道,优化code和key为各版本管理 修改了qkbt3和qkbt4

---
 SdkProject/library/build.gradle |   74 +++++++++++++++++++++++++-----------
 1 files changed, 51 insertions(+), 23 deletions(-)

diff --git a/SdkProject/library/build.gradle b/SdkProject/library/build.gradle
index 49ec44b..0fc6fa5 100644
--- a/SdkProject/library/build.gradle
+++ b/SdkProject/library/build.gradle
@@ -25,6 +25,7 @@
 //鎻掍欢鑴氭湰
 plugins.each {
     applyGradle("${rootPath}/plugins/${it}/build")
+    applyGradle("${rootPath}/plugins/${it}/deps")
 }
 
 //娓犻亾闇�瑕佽鐩栦富鐩綍鐨刯ava鏂囦欢
@@ -97,11 +98,7 @@
                 java.srcDirs "${pluginPath}/java"
                 jniLibs.srcDirs "${pluginPath}libs"
                 res.srcDirs "${pluginPath}/res"
-                manifest {
-                    File file = file("${pluginPath}/AndroidManifest.xml")
-                    if (file.exists())
-                        srcFile "${pluginPath}/AndroidManifest.xml"
-                }
+                //娓呭崟鍙兘鍚堝苟涓�涓紝鎵�鏈夋彃浠剁殑娓呭崟闇�瑕佹墜鍔ㄥ鍒跺埌瀵瑰簲鐨勬笭閬撻噷
             }
         }
     }
@@ -111,12 +108,6 @@
     variant.outputs.all {
         outputFileName = "library-${buildType.name}-${CHANNEL_NAME}.aar"
     }
-}
-//鎷疯礉娓犻亾鐨勭涓夋柟渚濊禆搴撹剼鏈�
-task copyDepsGradle(type: Copy) {
-    from "${channelPath}/"
-    include "deps.gradle"
-    into "${outPutPath}\\${CHANNEL_NAME}\\"
 }
 
 //鎷疯礉娓呭崟鏂囦欢
@@ -140,30 +131,67 @@
     into "${outPutPath}\\${CHANNEL_NAME}\\debug\\libs\\"
 }
 
-//鎵ц鎵撳寘浠诲姟浠ュ強鎷疯礉鍒板閮�
-task assembleAndCopySdk(type: Copy) {
-    delete "${outPutPath}\\${CHANNEL_NAME}"
-
-    dependsOn 'assembleMerger'
-//    dependsOn copyManifest
-    dependsOn copyDebugSdk
-    dependsOn copyDepsGradle
-
+task copyReleaseSdk(type: Copy) {
     from "build/outputs/aar/"
     include "library-release-${CHANNEL_NAME}.aar"
     into "${outPutPath}\\${CHANNEL_NAME}\\release\\libs\\"
 }
 
+task deleteSdk() {
+    delete "${outPutPath}\\${CHANNEL_NAME}\\debug"
+    delete "${outPutPath}\\${CHANNEL_NAME}\\release"
+}
+
+//鎵ц鎵撳寘浠诲姟浠ュ強鎷疯礉鍒板閮�
+task assembleAndCopySdk() {
+    dependsOn 'assemble'
+    dependsOn deleteSdk
+    dependsOn copyDebugSdk
+    dependsOn copyReleaseSdk
+
+    tasks.findByName('deleteSdk').mustRunAfter 'assembleMerger'
+    tasks.findByName('copyDebugSdk').mustRunAfter 'deleteSdk'
+    tasks.findByName('copyReleaseSdk').mustRunAfter 'deleteSdk'
+
+    //瀵煎嚭鎵�鏈夊閮ㄥ紩鐢�
+    String content = ""
+    def deps = file("${channelPath}\\deps.gradle")
+    deps.eachLine { line ->
+        if (line != null)
+            content += line + "\n"
+    }
+    plugins.each {
+        deps = file("${rootPath}/plugins/${it}/deps.gradle")
+        if(deps.exists()){
+            deps.eachLine { line ->
+                if (line != null)
+                    content += line + "\n"
+            }
+        }
+    }
+    def dir = new File("${outPutPath}\\${CHANNEL_NAME}")
+    def libraries = new File("${outPutPath}\\${CHANNEL_NAME}\\deps.gradle")
+    dir.mkdir()
+    if (libraries.exists())
+        libraries.delete()
+    if (!libraries.exists())
+        libraries.createNewFile()
+    libraries.text = content
+}
+
 dependencies {
     implementation 'com.android.support:support-annotations:28.0.0'
-    testImplementation 'junit:junit:4.13.1'
+    testImplementation 'junit:junit:4.13.2'
 
     //noinspection GradleCompatible
-    implementation 'com.android.support:appcompat-v7:28.0.0'
+//    implementation 'com.android.support:appcompat-v7:28.0.0'
 
 //    implementation 'com.github.pqpo:Log4a:1.4.2@aar'
 
-    implementation fileTree(dir:"../channel/${CHANNEL_NAME}/libs/", include: ['*.jar'])
+    implementation fileTree(dir: "../channel/${CHANNEL_NAME}/libs/", include: ['*.jar'])
+    plugins.each {
+        implementation fileTree(dir: "${rootPath}/plugins/${it}/libs/", include: ['*.jar'])
+    }
     implementation fileTree(dir: 'libs', include: ['*.jar'], exclude: ['unity-classes.jar'])
     compileOnly files('libs/unity-classes.jar')
 }
\ No newline at end of file

--
Gitblit v1.8.0