| | |
| | | //插件脚本 |
| | | plugins.each { |
| | | applyGradle("${rootPath}/plugins/${it}/build") |
| | | applyGradle("${rootPath}/plugins/${it}/deps") |
| | | } |
| | | |
| | | //渠道需要覆盖主目录的java文件 |
| | |
| | | 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" |
| | | } |
| | | //清单只能合并一个,所有插件的清单需要手动复制到对应的渠道里 |
| | | } |
| | | } |
| | | } |
| | |
| | | variant.outputs.all { |
| | | outputFileName = "library-${buildType.name}-${CHANNEL_NAME}.aar" |
| | | } |
| | | } |
| | | //拷贝渠道的第三方依赖库脚本 |
| | | task copyDepsGradle(type: Copy) { |
| | | from "${channelPath}/" |
| | | include "deps.gradle" |
| | | into "${outPutPath}\\${CHANNEL_NAME}\\" |
| | | } |
| | | |
| | | //拷贝清单文件 |
| | |
| | | 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') |
| | | } |