├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── demo │ │ └── buildsrc │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── demo │ │ │ └── buildsrc │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── demo │ └── buildsrc │ └── ExampleUnitTest.java ├── build.gradle ├── buildSrc ├── .gitignore ├── build.gradle ├── src │ └── main │ │ └── groovy │ │ └── Dependencies.groovy ├── updateDependencies.gradle ├── versions.gradle └── xVersions.gradle ├── captures ├── capture_1.png ├── capture_2.png ├── capture_3.png └── capture_4.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | .externalNativeBuild 13 | .idea 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BuildSrcDemo 2 | 3 | ### 管理插件和依赖库信息有新的方式了喔,可以了解下:[ComposingBuildDemo](https://gitee.com/cbfg5210/ComposingBuildDemo) 4 | 5 | 初识 buildSrc 是在[掘金](https://juejin.im/)的一篇文章中:[[译]Kotlin + buildSrc:更好的管理Gadle依赖](https://juejin.im/post/5b0fb0e56fb9a00a012b7fda)。 6 | 7 | 从此就一直使用 buildSrc 来管理插件和依赖库信息了,并且介绍给团队之后团队也是采用了这种方法。但是随着 kotlin 的升级,不记得是在哪个版本的时候发现 Sync 的时候有问题,需要修改 buildSrc 中的 kotlin 脚本配置才行,于是考虑把 kotlin 换成了 groovy,这样 kotlin 的升级就不会影响到 buildSrc 了。 8 | 9 | ![部分代码截图](https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/master/captures/capture_1.png) 10 | ![部分代码截图](https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/master/captures/capture_3.png) 11 | 12 | 之后在使用过程中又发现了一个问题,插件或者依赖有新版本的话在 Dependencies.groovy 的代码是看不到提示的,而在 build.gradle 中是有新版本提示的。怎么解决这个问题呢,写个插件? 写个脚本? 还是写个 task 吧! 我们的办法是:把插件和依赖库信息配置在一个 versions.gradle 的文件中,这样在 versions.gradle 中就可以看到是否有版本提示了,以后信息的修改都是在 versions.gradle 中进行,通过 updateDependencies.gradle 中的 task 把 version.gradle 中的信息同步到 Dependencies.groovy 中。 13 | 14 | ![部分代码截图](https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/master/captures/capture_2.png) 15 | 16 | 到后来,AndroidX 出来了,为了对应之前的配置,我们增加了 xVersions.gradle 文件,在 xVersions.gradle 中,support 包的依赖换成了对应的 AndroidX 依赖。如果需要在两者之间切换的话,只需要在 updateDependencies.gradle 中把配置文件修改成对应的文件即可。 17 | 18 | ![部分代码截图](https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/master/captures/capture_4.png) 19 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion Versions.compileSdk 5 | 6 | defaultConfig { 7 | applicationId "com.demo.buildsrc" 8 | targetSdkVersion Versions.targetSdk 9 | minSdkVersion Versions.minSdk 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | 22 | compileOptions { 23 | sourceCompatibility JavaVersion.VERSION_1_8 24 | targetCompatibility JavaVersion.VERSION_1_8 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation fileTree(dir: 'libs', include: ['*.jar']) 30 | implementation Deps.appcompat 31 | implementation Deps.constraintLayout 32 | } 33 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/demo/buildsrc/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.demo.buildsrc; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.demo.buildsrc", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/demo/buildsrc/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.demo.buildsrc; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_main); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BuildSrcDemo 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/demo/buildsrc/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.demo.buildsrc; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | 9 | dependencies { 10 | classpath Deps.gradlePlugin 11 | classpath Deps.kotlinGradlePlugin 12 | classpath Deps.appJoint 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | google() 19 | jcenter() 20 | } 21 | 22 | //全局设置编码 23 | tasks.withType(JavaCompile) { 24 | options.encoding = "UTF-8" 25 | } 26 | } 27 | 28 | task clean(type: Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /buildSrc/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /build 3 | *.iml -------------------------------------------------------------------------------- /buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'groovy' 2 | apply from: 'updateDependencies.gradle' -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/Dependencies.groovy: -------------------------------------------------------------------------------- 1 | /** 2 | * 版本信息 3 | */ 4 | interface Versions { 5 | def minSdk = 17 6 | def targetSdk = 28 7 | def compileSdk = 28 8 | def buildTools = "28.0.3" 9 | } 10 | 11 | /** 12 | * 依赖库路径 13 | */ 14 | interface Deps { 15 | /* 16 | * repository plugin 17 | */ 18 | //gradlePlugin 19 | def gradlePlugin = "com.android.tools.build:gradle:3.4.1" 20 | //mavenGradlePlugin 21 | def mavenGradlePlugin = "com.github.dcendents:android-maven-gradle-plugin:2.1" 22 | 23 | /* 24 | * test 25 | */ 26 | //junit 27 | def junit = "junit:junit:4.12" 28 | //runner 29 | def runner = "com.android.support.test:runner:1.0.2" 30 | //espresso 31 | def espresso = "com.android.support.test.espresso:espresso-core:3.0.2" 32 | 33 | /* 34 | * support 35 | */ 36 | //appcompat 37 | def appcompat = "com.android.support:appcompat-v7:28.0.0" 38 | //supportV4 39 | def supportV4 = "com.android.support:support-v4:28.0.0" 40 | //supportFragment 41 | def supportFragment = "com.android.support:support-fragment:28.0.0" 42 | //supportCoreUtils 43 | def supportCoreUtils = "com.android.support:support-core-utils:28.0.0" 44 | //annotations 45 | def annotations = "com.android.support:support-annotations:28.0.0" 46 | //design 47 | def design = "com.android.support:design:28.0.0" 48 | //cardView 49 | def cardView = "com.android.support:cardview-v7:28.0.0" 50 | //recyclerView 51 | def recyclerView = "com.android.support:recyclerview-v7:28.0.0" 52 | //transition 53 | def transition = "com.android.support:transition:28.0.0" 54 | //constraintLayout 55 | def constraintLayout = "com.android.support.constraint:constraint-layout:1.1.3" 56 | //multiDex 57 | def multiDex = "com.android.support:multidex:1.0.3" 58 | 59 | /* 60 | * room 61 | */ 62 | //roomRuntime 63 | def roomRuntime = "android.arch.persistence.room:runtime:1.1.1" 64 | //roomCompiler 65 | def roomCompiler = "android.arch.persistence.room:compiler:1.1.1" 66 | //roomRxJava2 67 | def roomRxJava2 = "android.arch.persistence.room:rxjava2:1.1.1" 68 | //roomTesting 69 | def roomTesting = "android.arch.persistence.room:testing:1.1.1" 70 | 71 | /* 72 | * lifecycle 73 | */ 74 | //lifecycleExtensions : view model + live data 75 | def lifecycleExtensions = "android.arch.lifecycle:extensions:1.1.1" 76 | //viewModel 77 | def viewModel = "android.arch.lifecycle:viewmodel:1.1.1" 78 | //liveData 79 | def liveData = "android.arch.lifecycle:livedata:1.1.1" 80 | //lifecycleRuntime : no view model or live data 81 | def lifecycleRuntime = "android.arch.lifecycle:runtime:1.1.1" 82 | //lifecycleCompiler 83 | def lifecycleCompiler = "android.arch.lifecycle:compiler:1.1.1" 84 | //lifecycleCommonJava8 : if using Java8, use the following instead of compiler 85 | def lifecycleCommonJava8 = "android.arch.lifecycle:common-java8:1.1.1" 86 | //lifecycleReactiveStreams : ReactiveStreams support for LiveData 87 | def lifecycleReactiveStreams = "android.arch.lifecycle:reactivestreams:1.1.1" 88 | 89 | /* 90 | * google 91 | */ 92 | //playServicesAd 93 | def playServicesAd = "com.google.android.gms:play-services-ads:17.2.0" 94 | //googleService 95 | def googleService = "com.google.gms:google-services:4.2.0" 96 | //flexBox : https://github.com/google/flexbox-layout 97 | def flexBox = "com.google.android:flexbox:1.1.0" 98 | //gson : https://github.com/google/gson 99 | def gson = "com.google.code.gson:gson:2.8.5" 100 | //pagingRuntime 101 | def pagingRuntime = "android.arch.paging:runtime:1.0.1" 102 | 103 | //kotlinStdlib 104 | def kotlinStdlib = "org.jetbrains.kotlin:kotlin-stdlib:1.3.31" 105 | //kotlinStdlibJdk7 106 | def kotlinStdlibJdk7 = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31" 107 | //kotlinStdlibJdk8 108 | def kotlinStdlibJdk8 = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31" 109 | //kotlinGradlePlugin 110 | def kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21" 111 | 112 | /* 113 | * 模块化框架 114 | */ 115 | //appJoint : https://github.com/PrototypeZ/AppJoint/blob/master/README_zh.md 116 | def appJoint = "io.github.prototypez:app-joint:1.6.1" 117 | //appJointCore 118 | def appJointCore = "io.github.prototypez:app-joint-core:1.6.1" 119 | 120 | /* 121 | * 网络 122 | */ 123 | //okHttp3 : https://github.com/square/okhttp 124 | def okHttp3 = "com.squareup.okhttp3:okhttp:3.11.0" 125 | //okHttp3LoggingInterceptor 126 | def okHttp3LoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:3.11.0" 127 | 128 | /* 129 | * retrofit2 130 | */ 131 | //retrofit2 : https://github.com/square/retrofit 132 | def retrofit2 = "com.squareup.retrofit2:retrofit:2.4.0" 133 | //retrofit2ConverterGson 134 | def retrofit2ConverterGson = "com.squareup.retrofit2:converter-gson:2.4.0" 135 | //retrofit2ConverterScalars 136 | def retrofit2ConverterScalars = "com.squareup.retrofit2:converter-scalars:2.4.0" 137 | //retrofit2AdapterRxJava2 138 | def retrofit2AdapterRxJava2 = "com.squareup.retrofit2:adapter-rxjava2:2.4.0" 139 | 140 | //retrofitUrlManager : https://github.com/JessYanCoding/RetrofitUrlManager 141 | def retrofitUrlManager = "me.jessyan:retrofit-url-manager:1.4.0" 142 | 143 | /* 144 | * 路由 145 | */ 146 | //aRouterApi : https://github.com/alibaba/ARouter 147 | def aRouterApi = "com.alibaba:arouter-api:1.4.1" 148 | //aRouterCompiler 149 | def aRouterCompiler = "com.alibaba:arouter-compiler:1.1.4" 150 | 151 | /* 152 | * 图片加载 153 | */ 154 | //picasso : https://github.com/square/picasso 155 | def picasso = "com.squareup.picasso:picasso:2.71828" 156 | 157 | //glideV3 : https://github.com/bumptech/glide 158 | def glideV3 = "com.github.bumptech.glide:glide:3.8.0" 159 | //glideV4 : https://github.com/bumptech/glide 160 | def glideV4 = "com.github.bumptech.glide:glide:4.9.0" 161 | //glideV4Compiler 162 | def glideV4Compiler = "com.github.bumptech.glide:compiler:4.8.0" 163 | 164 | /* 165 | * 资源选择 166 | */ 167 | //matisse : https://github.com/zhihu/Matisse 168 | def matisse = "com.zhihu.android:matisse:0.5.2-beta2" 169 | 170 | /* 171 | * 事件总线 172 | */ 173 | //eventBus : https://github.com/greenrobot/EventBus 174 | def eventBus = "org.greenrobot:eventbus:3.1.1" 175 | 176 | /* 177 | * bug反馈 178 | */ 179 | //bugly 180 | def bugly = "com.tencent.bugly:crashreport:2.8.6.0" 181 | 182 | /* 183 | * 自定义view 184 | */ 185 | //discreteScrollview : https://github.com/yarolegovich/DiscreteScrollView 186 | def discreteScrollview = "com.yarolegovich:discrete-scrollview:1.4.9" 187 | //easySwipeMenuLayout : https://github.com/anzaizai/EasySwipeMenuLayout 188 | def easySwipeMenuLayout = "com.github.anzaizai:EasySwipeMenuLayout:1.1.2" 189 | //pageIndicatorView : https://github.com/romandanylyk/PageIndicatorView 190 | def pageIndicatorView = "com.romandanylyk:pageindicatorview:1.0.1" 191 | //swipeBack : https://github.com/gongwen/SwipeBackLayout 192 | def swipeBack = "com.gongwen:swipeback:1.0.2" 193 | //banner : https://github.com/youth5201314/banner 194 | def banner = "com.youth.banner:banner:1.4.10" 195 | //photoView : https://github.com/chrisbanes/PhotoView 196 | def photoView = "com.github.chrisbanes:PhotoView:2.2.0" 197 | //shapedImageView : https://github.com/gavinliu/ShapedImageView 198 | def shapedImageView = "cn.gavinliu:ShapedImageView:0.8.6" 199 | 200 | /* 201 | * 动画 202 | */ 203 | //transitionsEverywhere : https://github.com/andkulikov/Transitions-Everywhere 204 | def transitionsEverywhere = "com.andkulikov:transitionseverywhere:1.8.0" 205 | 206 | /* 207 | * 权限 208 | */ 209 | //andPermission : https://github.com/yanzhenjie/AndPermission 210 | def andPermission = "com.yanzhenjie:permission:2.0.0-rc5" 211 | 212 | /* 213 | * 实用 214 | */ 215 | //butterKnife : https://github.com/JakeWharton/butterknife 216 | def butterKnife = "com.jakewharton:butterknife:8.8.1" 217 | //butterKnifeCompiler 218 | def butterKnifeCompiler = "com.jakewharton:butterknife-compiler:8.8.1" 219 | //butterKnifeGradlePlugin 220 | def butterKnifeGradlePlugin = "com.jakewharton:butterknife-gradle-plugin:8.8.1" 221 | 222 | //rxJava2 : https://github.com/ReactiveX/RxJava 223 | def rxJava2 = "io.reactivex.rxjava2:rxjava:2.2.8" 224 | //rxAndroid2 225 | def rxAndroid2 = "io.reactivex.rxjava2:rxandroid:2.1.0" 226 | 227 | //rxLifecycle : https://github.com/trello/RxLifecycle 228 | def rxLifecycle = "com.trello.rxlifecycle2:rxlifecycle:2.2.2" 229 | //rxLifecycleComponents 230 | def rxLifecycleComponents = "com.trello.rxlifecycle2:rxlifecycle-components:2.2.2" 231 | 232 | //oneDrawable : https://github.com/maoruibin/OneDrawable 233 | def oneDrawable = "com.github.maoruibin:OneDrawable:1.1.0" 234 | 235 | //zxing : https://github.com/zxing/zxing 236 | def zxing = "com.google.zxing:core:3.3.0" 237 | //greenDao : https://github.com/greenrobot/greenDAO 238 | def greenDao = "de.greenrobot:greendao:2.1.0" 239 | //mmkv : 基于mmap的高性能通用key-value组件 https://github.com/Tencent/MMKV/blob/master/readme_cn.md 240 | def mmkv = "com.tencent:mmkv:1.0.16" 241 | 242 | /* 243 | * 插件 244 | */ 245 | //saveState : https://github.com/PrototypeZ/SaveState 246 | def saveState = "io.github.prototypez:save-state:0.1.7" 247 | 248 | /* 249 | * 测试工具 250 | */ 251 | //stetho : https://github.com/facebook/stetho 252 | def stetho = "com.facebook.stetho:stetho:1.5.0" 253 | //stethoOkHttp3 254 | def stethoOkHttp3 = "com.facebook.stetho:stetho-okhttp3:1.5.0" 255 | //stethoUrlConnection 256 | def stethoUrlConnection = "com.facebook.stetho:stetho-urlconnection:1.5.0" 257 | 258 | //leakCanaryAndroid : https://github.com/square/leakcanary 259 | def leakCanaryAndroid = "com.squareup.leakcanary:leakcanary-android:1.6.1" 260 | //leakCanaryAndroidNoOp 261 | def leakCanaryAndroidNoOp = "com.squareup.leakcanary:leakcanary-android-no-op:1.6.1" 262 | //leakCanarySupportFragment 263 | def leakCanarySupportFragment = "com.squareup.leakcanary:leakcanary-support-fragment:1.6.1" 264 | 265 | //blockCanaryAndroid :卡顿监控和提示 https://github.com/markzhai/AndroidPerformanceMonitor 266 | def blockCanaryAndroid = "com.github.markzhai:blockcanary-android:1.5.0" 267 | 268 | //crashwoodpecker 269 | def crashwoodpecker = "me.drakeet.library:crashwoodpecker:2.1.1" 270 | 271 | //debugDb : https://github.com/amitshekhariitbhu/Android-Debug-Database 272 | def debugDb = "com.amitshekhar.android:debug-db:1.0.4" 273 | } 274 | -------------------------------------------------------------------------------- /buildSrc/updateDependencies.gradle: -------------------------------------------------------------------------------- 1 | /** 2 | * 将versions.gradle/xVersion.gradle中配置的版本信息生成到src/main/groovy/Dependencies.groovy中 3 | * 执行该task方法: 4 | * 方法1: 5 | * New: 在gradle task列表面板点击'Execute Gradle Task'(类似大象的)按钮,在输入框输入'-p buildSrc updateDependencies'然后点回车键; 6 | * Deprecated: 在gradle task列表面板点击'Run Gradle Task'(类似大象的)按钮,在'Gradle Project'栏选中buildSrc模块,在'Command line'栏输入'updateDependencies'然后点击'OK'; 7 | * 方法2: 8 | * New: 在Terminal输入'gradlew -p buildSrc updateDependencies'然后执行 9 | * Deprecated: 在Terminal输入'gradlew updateDependencies'然后执行 10 | * 方法3: 11 | * AS->Edit Configurations->Gradle,点击左上角'+'添加配置: 12 | * Name: $projectName:buildSrc [updateDependencies] 13 | * Gradle project: $projectName/buildSrc 14 | * Tasks: updateDependencies 15 | * 点击'Apply'保存此配置,后续在项目的 gradle task 列表中就可以找到此 task 双击执行了 16 | */ 17 | task("updateDependencies") { 18 | String inputFilePath = "versions.gradle" 19 | String outputFilePath = "src/main/groovy/Dependencies.groovy" 20 | 21 | // 将inputFilePath声明为该Task的inputs 22 | inputs.file(inputFilePath) 23 | // 将outputFilePath声明为outputs 24 | outputs.file(outputFilePath) 25 | 26 | doLast { 27 | File inputFile = file(inputFilePath) 28 | if (!inputFile.exists()) { 29 | return 30 | } 31 | 32 | String inputTxt = inputFile.text 33 | StringBuilder builder = new StringBuilder() 34 | 35 | /* 36 | * 解析拼接版本object 37 | */ 38 | builder.append("/**\n") 39 | .append(" * 版本信息\n") 40 | .append(" */\n") 41 | .append("interface Versions {\n") 42 | 43 | String startFlag = "/**/" 44 | String endFlag = "/**/" 45 | 46 | int start = inputTxt.indexOf(startFlag) 47 | int end = inputTxt.indexOf(endFlag) 48 | 49 | builder.append(" ") 50 | .append(inputTxt.substring(start + startFlag.length(), end).trim()) 51 | .append("\n}\n\n") 52 | 53 | /* 54 | * 解析拼接依赖object 55 | */ 56 | builder.append("/**\n") 57 | .append(" * 依赖库路径\n") 58 | .append(" */\n") 59 | .append("interface Deps {\n") 60 | 61 | startFlag = "/**/" 62 | endFlag = "/**/" 63 | 64 | start = inputTxt.indexOf(startFlag) 65 | end = inputTxt.indexOf(endFlag) 66 | 67 | String depsTxt = inputTxt.substring(start + startFlag.length(), end).trim() 68 | 69 | int implementationIndex 70 | int doubleSlashIndex 71 | 72 | while (true) { 73 | implementationIndex = depsTxt.indexOf("implementation") 74 | if (implementationIndex == -1) { 75 | break 76 | } 77 | doubleSlashIndex = depsTxt.lastIndexOf("//", implementationIndex) 78 | String namePart 79 | String name 80 | while (true) { 81 | namePart = depsTxt.substring(doubleSlashIndex + 2, implementationIndex) 82 | name = namePart.split(":")[0].trim() 83 | if (!name.contains("/")) { 84 | break 85 | } 86 | doubleSlashIndex = depsTxt.lastIndexOf("//", doubleSlashIndex - 2) 87 | } 88 | depsTxt = depsTxt.replaceFirst("implementation", String.format("def %s =", name)) 89 | } 90 | 91 | builder.append(" ") 92 | .append(depsTxt) 93 | .append("\n}\n") 94 | 95 | String resultTxt = builder.toString() 96 | 97 | file(outputFilePath).withPrintWriter("utf-8", { writer -> 98 | writer.print(resultTxt) 99 | writer.flush() 100 | }) 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /buildSrc/versions.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | /* readme * 3 | * 4 | * 为了统一管理插件/依赖库版本,避免版本冲突,统一将插件/依赖库信息配置在此文件中, 5 | * 通过gradlew updateDependencies task 6 | * 解析此文件生成对应内容到Dependencies.kt中进行统一引用 7 | * 8 | * 之间是一些版本的配置 , 解析后会放到Dependencies.kt的object Versions中 9 | * 10 | * 之间是插件/依赖库引用路径 , 解析后会放到Dependencies.kt的object Deps中 11 | * 12 | * 配置插件/依赖库引用说明: 13 | * 0、版本配置格式:def = 14 | * 1、配置插件/依赖库引用路径前备注格式: //<插件/依赖库名> : <备注>,这个部分会被解析确定插件/依赖库引用名称 15 | * 2、配置插件/依赖库引用路径时以 implementation 作为开头 16 | * 3、更新配置后执行 updateDependencies.gradle 的 updateDependencies task 同步更新到Dependencies.kt 17 | * 18 | * Extra: 19 | * [Google's Maven Repository] (https://dl.google.com/dl/android/maven2/index.html) 20 | */ 21 | 22 | /* 23 | * version部分 24 | */ 25 | 26 | /**/ 27 | 28 | def minSdk = 17 29 | def targetSdk = 28 30 | def compileSdk = 28 31 | def buildTools = "28.0.3" 32 | 33 | /**/ 34 | 35 | /* 36 | * 插件/依赖库路径部分 37 | */ 38 | 39 | /**/ 40 | 41 | /* 42 | * repository plugin 43 | */ 44 | //gradlePlugin 45 | implementation "com.android.tools.build:gradle:3.4.1" 46 | //mavenGradlePlugin 47 | implementation "com.github.dcendents:android-maven-gradle-plugin:2.1" 48 | 49 | /* 50 | * test 51 | */ 52 | //junit 53 | implementation "junit:junit:4.12" 54 | //runner 55 | implementation "com.android.support.test:runner:1.0.2" 56 | //espresso 57 | implementation "com.android.support.test.espresso:espresso-core:3.0.2" 58 | 59 | /* 60 | * support 61 | */ 62 | //appcompat 63 | implementation "com.android.support:appcompat-v7:28.0.0" 64 | //supportV4 65 | implementation "com.android.support:support-v4:28.0.0" 66 | //supportFragment 67 | implementation "com.android.support:support-fragment:28.0.0" 68 | //supportCoreUtils 69 | implementation "com.android.support:support-core-utils:28.0.0" 70 | //annotations 71 | implementation "com.android.support:support-annotations:28.0.0" 72 | //design 73 | implementation "com.android.support:design:28.0.0" 74 | //cardView 75 | implementation "com.android.support:cardview-v7:28.0.0" 76 | //recyclerView 77 | implementation "com.android.support:recyclerview-v7:28.0.0" 78 | //transition 79 | implementation "com.android.support:transition:28.0.0" 80 | //constraintLayout 81 | implementation "com.android.support.constraint:constraint-layout:1.1.3" 82 | //multiDex 83 | implementation "com.android.support:multidex:1.0.3" 84 | 85 | /* 86 | * room 87 | */ 88 | //roomRuntime 89 | implementation "android.arch.persistence.room:runtime:1.1.1" 90 | //roomCompiler 91 | implementation "android.arch.persistence.room:compiler:1.1.1" 92 | //roomRxJava2 93 | implementation "android.arch.persistence.room:rxjava2:1.1.1" 94 | //roomTesting 95 | implementation "android.arch.persistence.room:testing:1.1.1" 96 | 97 | /* 98 | * lifecycle 99 | */ 100 | //lifecycleExtensions : view model + live data 101 | implementation "android.arch.lifecycle:extensions:1.1.1" 102 | //viewModel 103 | implementation "android.arch.lifecycle:viewmodel:1.1.1" 104 | //liveData 105 | implementation "android.arch.lifecycle:livedata:1.1.1" 106 | //lifecycleRuntime : no view model or live data 107 | implementation "android.arch.lifecycle:runtime:1.1.1" 108 | //lifecycleCompiler 109 | implementation "android.arch.lifecycle:compiler:1.1.1" 110 | //lifecycleCommonJava8 : if using Java8, use the following instead of compiler 111 | implementation "android.arch.lifecycle:common-java8:1.1.1" 112 | //lifecycleReactiveStreams : ReactiveStreams support for LiveData 113 | implementation "android.arch.lifecycle:reactivestreams:1.1.1" 114 | 115 | /* 116 | * google 117 | */ 118 | //playServicesAd 119 | implementation "com.google.android.gms:play-services-ads:17.2.0" 120 | //googleService 121 | implementation "com.google.gms:google-services:4.2.0" 122 | //flexBox : https://github.com/google/flexbox-layout 123 | implementation "com.google.android:flexbox:1.1.0" 124 | //gson : https://github.com/google/gson 125 | implementation "com.google.code.gson:gson:2.8.5" 126 | //pagingRuntime 127 | implementation "android.arch.paging:runtime:1.0.1" 128 | 129 | //kotlinStdlib 130 | implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.31" 131 | //kotlinStdlibJdk7 132 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31" 133 | //kotlinStdlibJdk8 134 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31" 135 | //kotlinGradlePlugin 136 | implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21" 137 | 138 | /* 139 | * 模块化框架 140 | */ 141 | //appJoint : https://github.com/PrototypeZ/AppJoint/blob/master/README_zh.md 142 | implementation "io.github.prototypez:app-joint:1.6.1" 143 | //appJointCore 144 | implementation "io.github.prototypez:app-joint-core:1.6.1" 145 | 146 | /* 147 | * 网络 148 | */ 149 | //okHttp3 : https://github.com/square/okhttp 150 | implementation "com.squareup.okhttp3:okhttp:3.11.0" 151 | //okHttp3LoggingInterceptor 152 | implementation "com.squareup.okhttp3:logging-interceptor:3.11.0" 153 | 154 | /* 155 | * retrofit2 156 | */ 157 | //retrofit2 : https://github.com/square/retrofit 158 | implementation "com.squareup.retrofit2:retrofit:2.4.0" 159 | //retrofit2ConverterGson 160 | implementation "com.squareup.retrofit2:converter-gson:2.4.0" 161 | //retrofit2ConverterScalars 162 | implementation "com.squareup.retrofit2:converter-scalars:2.4.0" 163 | //retrofit2AdapterRxJava2 164 | implementation "com.squareup.retrofit2:adapter-rxjava2:2.4.0" 165 | 166 | //retrofitUrlManager : https://github.com/JessYanCoding/RetrofitUrlManager 167 | implementation "me.jessyan:retrofit-url-manager:1.4.0" 168 | 169 | /* 170 | * 路由 171 | */ 172 | //aRouterApi : https://github.com/alibaba/ARouter 173 | implementation "com.alibaba:arouter-api:1.4.1" 174 | //aRouterCompiler 175 | implementation "com.alibaba:arouter-compiler:1.1.4" 176 | 177 | /* 178 | * 图片加载 179 | */ 180 | //picasso : https://github.com/square/picasso 181 | implementation "com.squareup.picasso:picasso:2.71828" 182 | 183 | //glideV3 : https://github.com/bumptech/glide 184 | implementation "com.github.bumptech.glide:glide:3.8.0" 185 | //glideV4 : https://github.com/bumptech/glide 186 | implementation "com.github.bumptech.glide:glide:4.9.0" 187 | //glideV4Compiler 188 | implementation "com.github.bumptech.glide:compiler:4.8.0" 189 | 190 | /* 191 | * 资源选择 192 | */ 193 | //matisse : https://github.com/zhihu/Matisse 194 | implementation "com.zhihu.android:matisse:0.5.2-beta2" 195 | 196 | /* 197 | * 事件总线 198 | */ 199 | //eventBus : https://github.com/greenrobot/EventBus 200 | implementation "org.greenrobot:eventbus:3.1.1" 201 | 202 | /* 203 | * bug反馈 204 | */ 205 | //bugly 206 | implementation "com.tencent.bugly:crashreport:2.8.6.0" 207 | 208 | /* 209 | * 自定义view 210 | */ 211 | //discreteScrollview : https://github.com/yarolegovich/DiscreteScrollView 212 | implementation "com.yarolegovich:discrete-scrollview:1.4.9" 213 | //easySwipeMenuLayout : https://github.com/anzaizai/EasySwipeMenuLayout 214 | implementation "com.github.anzaizai:EasySwipeMenuLayout:1.1.2" 215 | //pageIndicatorView : https://github.com/romandanylyk/PageIndicatorView 216 | implementation "com.romandanylyk:pageindicatorview:1.0.1" 217 | //swipeBack : https://github.com/gongwen/SwipeBackLayout 218 | implementation "com.gongwen:swipeback:1.0.2" 219 | //banner : https://github.com/youth5201314/banner 220 | implementation "com.youth.banner:banner:1.4.10" 221 | //photoView : https://github.com/chrisbanes/PhotoView 222 | implementation "com.github.chrisbanes:PhotoView:2.2.0" 223 | //shapedImageView : https://github.com/gavinliu/ShapedImageView 224 | implementation "cn.gavinliu:ShapedImageView:0.8.6" 225 | 226 | /* 227 | * 动画 228 | */ 229 | //transitionsEverywhere : https://github.com/andkulikov/Transitions-Everywhere 230 | implementation "com.andkulikov:transitionseverywhere:1.8.0" 231 | 232 | /* 233 | * 权限 234 | */ 235 | //andPermission : https://github.com/yanzhenjie/AndPermission 236 | implementation "com.yanzhenjie:permission:2.0.0-rc5" 237 | 238 | /* 239 | * 实用 240 | */ 241 | //butterKnife : https://github.com/JakeWharton/butterknife 242 | implementation "com.jakewharton:butterknife:8.8.1" 243 | //butterKnifeCompiler 244 | implementation "com.jakewharton:butterknife-compiler:8.8.1" 245 | //butterKnifeGradlePlugin 246 | implementation "com.jakewharton:butterknife-gradle-plugin:8.8.1" 247 | 248 | //rxJava2 : https://github.com/ReactiveX/RxJava 249 | implementation "io.reactivex.rxjava2:rxjava:2.2.8" 250 | //rxAndroid2 251 | implementation "io.reactivex.rxjava2:rxandroid:2.1.0" 252 | 253 | //rxLifecycle : https://github.com/trello/RxLifecycle 254 | implementation "com.trello.rxlifecycle2:rxlifecycle:2.2.2" 255 | //rxLifecycleComponents 256 | implementation "com.trello.rxlifecycle2:rxlifecycle-components:2.2.2" 257 | 258 | //oneDrawable : https://github.com/maoruibin/OneDrawable 259 | implementation "com.github.maoruibin:OneDrawable:1.1.0" 260 | 261 | //zxing : https://github.com/zxing/zxing 262 | implementation "com.google.zxing:core:3.3.0" 263 | //greenDao : https://github.com/greenrobot/greenDAO 264 | implementation "de.greenrobot:greendao:2.1.0" 265 | //mmkv : 基于mmap的高性能通用key-value组件 https://github.com/Tencent/MMKV/blob/master/readme_cn.md 266 | implementation "com.tencent:mmkv:1.0.16" 267 | 268 | /* 269 | * 插件 270 | */ 271 | //saveState : https://github.com/PrototypeZ/SaveState 272 | implementation "io.github.prototypez:save-state:0.1.7" 273 | 274 | /* 275 | * 测试工具 276 | */ 277 | //stetho : https://github.com/facebook/stetho 278 | implementation "com.facebook.stetho:stetho:1.5.0" 279 | //stethoOkHttp3 280 | implementation "com.facebook.stetho:stetho-okhttp3:1.5.0" 281 | //stethoUrlConnection 282 | implementation "com.facebook.stetho:stetho-urlconnection:1.5.0" 283 | 284 | //leakCanaryAndroid : https://github.com/square/leakcanary 285 | implementation "com.squareup.leakcanary:leakcanary-android:1.6.1" 286 | //leakCanaryAndroidNoOp 287 | implementation "com.squareup.leakcanary:leakcanary-android-no-op:1.6.1" 288 | //leakCanarySupportFragment 289 | implementation "com.squareup.leakcanary:leakcanary-support-fragment:1.6.1" 290 | 291 | //blockCanaryAndroid :卡顿监控和提示 https://github.com/markzhai/AndroidPerformanceMonitor 292 | implementation "com.github.markzhai:blockcanary-android:1.5.0" 293 | 294 | //crashwoodpecker 295 | implementation "me.drakeet.library:crashwoodpecker:2.1.1" 296 | 297 | //debugDb : https://github.com/amitshekhariitbhu/Android-Debug-Database 298 | implementation "com.amitshekhar.android:debug-db:1.0.4" 299 | 300 | /**/ 301 | } -------------------------------------------------------------------------------- /buildSrc/xVersions.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | /* readme * 3 | * 4 | * 为了统一管理插件/依赖库版本,避免版本冲突,统一将插件/依赖库信息配置在此文件中, 5 | * 通过gradlew updateDependencies task 6 | * 解析此文件生成对应内容到Dependencies.kt中进行统一引用 7 | * 8 | * 之间是一些版本的配置 , 解析后会放到Dependencies.kt的object Versions中 9 | * 10 | * 之间是插件/依赖库引用路径 , 解析后会放到Dependencies.kt的object Deps中 11 | * 12 | * 配置插件/依赖库引用说明: 13 | * 0、版本配置格式:def = 14 | * 1、配置插件/依赖库引用路径前备注格式: //<插件/依赖库名> : <备注>,这个部分会被解析确定插件/依赖库引用名称 15 | * 2、配置插件/依赖库引用路径时以 implementation 作为开头 16 | * 3、更新配置后执行 updateDependencies.gradle 的 updateDependencies task 同步更新到Dependencies.kt 17 | * 18 | * Extra: 19 | * [Google's Maven Repository] (https://dl.google.com/dl/android/maven2/index.html) 20 | */ 21 | 22 | /* 23 | * version部分 24 | */ 25 | 26 | /**/ 27 | 28 | def minSdk = 17 29 | def targetSdk = 28 30 | def compileSdk = 28 31 | def buildTools = "28.0.3" 32 | 33 | /**/ 34 | 35 | /* 36 | * 插件/依赖库路径部分 37 | */ 38 | 39 | /**/ 40 | 41 | /* 42 | * repository plugin 43 | */ 44 | //gradlePlugin 45 | implementation "com.android.tools.build:gradle:3.4.1" 46 | //mavenGradlePlugin 47 | implementation "com.github.dcendents:android-maven-gradle-plugin:2.1" 48 | 49 | /* 50 | * test 51 | */ 52 | //junit 53 | implementation "junit:junit:4.12" 54 | //runner 55 | implementation "androidx.test:runner:1.1.1" 56 | //espresso 57 | implementation "androidx.test.espresso:espresso-core:3.1.1" 58 | 59 | /* 60 | * support 61 | */ 62 | //appcompat 63 | implementation "androidx.appcompat:appcompat:1.0.2" 64 | //supportV4 65 | implementation "androidx.legacy:legacy-support-v4:1.0.0" 66 | //supportFragment 67 | implementation "androidx.fragment:fragment:1.0.0" 68 | //supportCoreUtils 69 | implementation "androidx.legacy:legacy-support-core-utils:1.0.0" 70 | //annotations 71 | implementation "androidx.annotation:annotation:1.0.2" 72 | //design 73 | implementation "com.google.android.material:material:1.1.0-alpha06" 74 | //cardView 75 | implementation "androidx.cardview:cardview:1.0.0" 76 | //recyclerView 77 | implementation "androidx.recyclerview:recyclerview:1.0.0" 78 | //transition 79 | implementation "androidx.transition:transition:1.0.1" 80 | //constraintLayout 81 | implementation "androidx.constraintlayout:constraintlayout:1.1.3" 82 | //multiDex 83 | implementation "androidx.multidex:multidex:2.0.1" 84 | //coreKtx 85 | implementation "androidx.core:core-ktx:1.0.2" 86 | 87 | /* 88 | * room 89 | */ 90 | //roomRuntime 91 | implementation "androidx.room:room-runtime:2.1.0-beta01" 92 | //roomCompiler 93 | implementation "androidx.room:room-compiler:2.1.0-beta01" 94 | //roomRxJava2 95 | implementation "androidx.room:room-rxjava2:2.1.0-beta01" 96 | //roomTesting 97 | implementation "androidx.room:room-testing:2.1.0-beta01" 98 | 99 | /* 100 | * lifecycle 101 | */ 102 | //lifecycleExtensions : view model + live data 103 | implementation "androidx.lifecycle:lifecycle-extensions:2.2.0-alpha01" 104 | //viewModel 105 | implementation "androidx.lifecycle:lifecycle-viewmodel:2.2.0-alpha01" 106 | //liveData 107 | implementation "androidx.lifecycle:lifecycle-livedata:2.2.0-alpha01" 108 | //lifecycleRuntime : no view model or live data 109 | implementation "androidx.lifecycle:lifecycle-runtime:2.2.0-alpha01" 110 | //lifecycleCompiler 111 | implementation "androidx.lifecycle:lifecycle-compiler:2.2.0-alpha01" 112 | //lifecycleCommonJava8 : if using Java8, use the following instead of compiler 113 | implementation "androidx.lifecycle:lifecycle-common-java8:2.2.0-alpha01" 114 | //lifecycleReactiveStreams : ReactiveStreams support for LiveData 115 | implementation "androidx.lifecycle:lifecycle-reactivestreams:2.2.0-alpha01" 116 | 117 | /* 118 | * google 119 | */ 120 | //pagingRuntime 121 | implementation "androidx.paging:paging-runtime:2.1.0" 122 | 123 | //playServicesAd 124 | implementation "com.google.android.gms:play-services-ads:17.2.0" 125 | //googleService 126 | implementation "com.google.gms:google-services:4.2.0" 127 | //flexBox : https://github.com/google/flexbox-layout 128 | implementation "com.google.android:flexbox:1.1.0" 129 | //gson : https://github.com/google/gson 130 | implementation "com.google.code.gson:gson:2.8.5" 131 | 132 | //kotlinStdlib 133 | implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.31" 134 | //kotlinStdlibJdk7 135 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31" 136 | //kotlinStdlibJdk8 137 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31" 138 | //kotlinGradlePlugin 139 | implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21" 140 | 141 | /* 142 | * 模块化框架 143 | */ 144 | //appJoint : https://github.com/PrototypeZ/AppJoint/blob/master/README_zh.md 145 | implementation "io.github.prototypez:app-joint:1.6.1" 146 | //appJointCore 147 | implementation "io.github.prototypez:app-joint-core:1.6.1" 148 | 149 | /* 150 | * 网络 151 | */ 152 | //okHttp3 : https://github.com/square/okhttp 153 | implementation "com.squareup.okhttp3:okhttp:3.11.0" 154 | //okHttp3LoggingInterceptor 155 | implementation "com.squareup.okhttp3:logging-interceptor:3.11.0" 156 | 157 | /* 158 | * retrofit2 159 | */ 160 | //retrofit2 : https://github.com/square/retrofit 161 | implementation "com.squareup.retrofit2:retrofit:2.4.0" 162 | //retrofit2ConverterGson 163 | implementation "com.squareup.retrofit2:converter-gson:2.4.0" 164 | //retrofit2ConverterScalars 165 | implementation "com.squareup.retrofit2:converter-scalars:2.4.0" 166 | //retrofit2AdapterRxJava2 167 | implementation "com.squareup.retrofit2:adapter-rxjava2:2.4.0" 168 | 169 | //retrofitUrlManager : https://github.com/JessYanCoding/RetrofitUrlManager 170 | implementation "me.jessyan:retrofit-url-manager:1.4.0" 171 | 172 | /* 173 | * 路由 174 | */ 175 | //aRouterApi : https://github.com/alibaba/ARouter 176 | implementation "com.alibaba:arouter-api:1.4.1" 177 | //aRouterCompiler 178 | implementation "com.alibaba:arouter-compiler:1.1.4" 179 | 180 | /* 181 | * 图片加载 182 | */ 183 | //picasso : https://github.com/square/picasso 184 | implementation "com.squareup.picasso:picasso:2.71828" 185 | 186 | //glideV3 : https://github.com/bumptech/glide 187 | implementation "com.github.bumptech.glide:glide:3.8.0" 188 | //glideV4 : https://github.com/bumptech/glide 189 | implementation "com.github.bumptech.glide:glide:4.9.0" 190 | //glideV4Compiler 191 | implementation "com.github.bumptech.glide:compiler:4.8.0" 192 | 193 | /* 194 | * 资源选择 195 | */ 196 | //matisse : https://github.com/zhihu/Matisse 197 | implementation "com.zhihu.android:matisse:0.5.2-beta2" 198 | 199 | /* 200 | * 事件总线 201 | */ 202 | //eventBus : https://github.com/greenrobot/EventBus 203 | implementation "org.greenrobot:eventbus:3.1.1" 204 | 205 | /* 206 | * bug反馈 207 | */ 208 | //bugly 209 | implementation "com.tencent.bugly:crashreport:2.8.6.0" 210 | 211 | /* 212 | * 自定义view 213 | */ 214 | //discreteScrollview : https://github.com/yarolegovich/DiscreteScrollView 215 | implementation "com.yarolegovich:discrete-scrollview:1.4.9" 216 | //easySwipeMenuLayout : https://github.com/anzaizai/EasySwipeMenuLayout 217 | implementation "com.github.anzaizai:EasySwipeMenuLayout:1.1.2" 218 | //pageIndicatorView : https://github.com/romandanylyk/PageIndicatorView 219 | implementation "com.romandanylyk:pageindicatorview:1.0.1" 220 | //swipeBack : https://github.com/gongwen/SwipeBackLayout 221 | implementation "com.gongwen:swipeback:1.0.2" 222 | //banner : https://github.com/youth5201314/banner 223 | implementation "com.youth.banner:banner:1.4.10" 224 | //photoView : https://github.com/chrisbanes/PhotoView 225 | implementation "com.github.chrisbanes:PhotoView:2.2.0" 226 | //shapedImageView : https://github.com/gavinliu/ShapedImageView 227 | implementation "cn.gavinliu:ShapedImageView:0.8.6" 228 | 229 | /* 230 | * 动画 231 | */ 232 | //transitionsEverywhere : https://github.com/andkulikov/Transitions-Everywhere 233 | implementation "com.andkulikov:transitionseverywhere:1.8.0" 234 | 235 | /* 236 | * 权限 237 | */ 238 | //andPermission : https://github.com/yanzhenjie/AndPermission 239 | implementation "com.yanzhenjie:permission:2.0.0-rc5" 240 | 241 | /* 242 | * 实用 243 | */ 244 | //butterKnife : https://github.com/JakeWharton/butterknife 245 | implementation "com.jakewharton:butterknife:8.8.1" 246 | //butterKnifeCompiler 247 | implementation "com.jakewharton:butterknife-compiler:8.8.1" 248 | //butterKnifeGradlePlugin 249 | implementation "com.jakewharton:butterknife-gradle-plugin:8.8.1" 250 | 251 | //rxJava2 : https://github.com/ReactiveX/RxJava 252 | implementation "io.reactivex.rxjava2:rxjava:2.2.8" 253 | //rxAndroid2 254 | implementation "io.reactivex.rxjava2:rxandroid:2.1.0" 255 | 256 | //rxLifecycle : https://github.com/trello/RxLifecycle 257 | implementation "com.trello.rxlifecycle2:rxlifecycle:2.2.2" 258 | //rxLifecycleComponents 259 | implementation "com.trello.rxlifecycle2:rxlifecycle-components:2.2.2" 260 | 261 | //oneDrawable : https://github.com/maoruibin/OneDrawable 262 | implementation "com.github.maoruibin:OneDrawable:1.1.0" 263 | 264 | //zxing : https://github.com/zxing/zxing 265 | implementation "com.google.zxing:core:3.3.0" 266 | //greenDao : https://github.com/greenrobot/greenDAO 267 | implementation "de.greenrobot:greendao:2.1.0" 268 | //mmkv : 基于mmap的高性能通用key-value组件 https://github.com/Tencent/MMKV/blob/master/readme_cn.md 269 | implementation "com.tencent:mmkv:1.0.16" 270 | 271 | /* 272 | * 插件 273 | */ 274 | //saveState : https://github.com/PrototypeZ/SaveState 275 | implementation "io.github.prototypez:save-state:0.1.7" 276 | 277 | /* 278 | * 测试工具 279 | */ 280 | //stetho : https://github.com/facebook/stetho 281 | implementation "com.facebook.stetho:stetho:1.5.0" 282 | //stethoOkHttp3 283 | implementation "com.facebook.stetho:stetho-okhttp3:1.5.0" 284 | //stethoUrlConnection 285 | implementation "com.facebook.stetho:stetho-urlconnection:1.5.0" 286 | 287 | //leakCanaryAndroid : https://github.com/square/leakcanary 288 | implementation "com.squareup.leakcanary:leakcanary-android:1.6.1" 289 | //leakCanaryAndroidNoOp 290 | implementation "com.squareup.leakcanary:leakcanary-android-no-op:1.6.1" 291 | //leakCanarySupportFragment 292 | implementation "com.squareup.leakcanary:leakcanary-support-fragment:1.6.1" 293 | 294 | //blockCanaryAndroid :卡顿监控和提示 https://github.com/markzhai/AndroidPerformanceMonitor 295 | implementation "com.github.markzhai:blockcanary-android:1.5.0" 296 | 297 | //crashwoodpecker 298 | implementation "me.drakeet.library:crashwoodpecker:2.1.1" 299 | 300 | //debugDb : https://github.com/amitshekhariitbhu/Android-Debug-Database 301 | implementation "com.amitshekhar.android:debug-db:1.0.4" 302 | 303 | /**/ 304 | } -------------------------------------------------------------------------------- /captures/capture_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/captures/capture_1.png -------------------------------------------------------------------------------- /captures/capture_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/captures/capture_2.png -------------------------------------------------------------------------------- /captures/capture_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/captures/capture_3.png -------------------------------------------------------------------------------- /captures/capture_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/captures/capture_4.png -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | 15 | 16 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cbfg5210/BuildSrcDemo/8210592e996367c25df09dd1708e90bb9df5c593/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jun 05 09:12:08 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------