Gradle: improve dependencies management

This commit is contained in:
zt515
2017-12-15 00:14:46 +08:00
parent 548e0c6e72
commit c6aee23bbe
6 changed files with 43 additions and 34 deletions

View File

@ -3,18 +3,18 @@ apply plugin: 'kotlin'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile rootProject.ext.deps["kotlin-stdlib"]
}
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
buildscript {
ext.kotlin_version = '1.2.0'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath rootProject.ext.deps["kotlin-gradle-plugin"]
}
}
repositories {
@ -32,5 +32,5 @@ compileTestKotlin {
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile rootProject.ext.deps["junit"]
}

View File

@ -1,13 +1,12 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
compileSdkVersion rootProject.ext.android.COMPILE_SDK_VERSION
buildToolsVersion rootProject.ext.android.BUILD_TOOL_VERSION
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
minSdkVersion rootProject.ext.android.MIN_SDK_VERSION
targetSdkVersion rootProject.ext.android.TARGET_SDK_VERSION
versionCode 1
versionName "1.0"
@ -32,8 +31,10 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation rootProject.ext.deps["appcompat-v7"]
testImplementation rootProject.ext.deps["junit"]
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}

View File

@ -6,7 +6,7 @@ android {
buildToolsVersion rootProject.ext.android.BUILD_TOOL_VERSION
defaultConfig {
applicationId "io.neoterm"
minSdkVersion 21
minSdkVersion rootProject.ext.android.MIN_SDK_VERSION
targetSdkVersion rootProject.ext.android.TARGET_SDK_VERSION
versionCode 32
versionName "2.0.0"
@ -53,19 +53,21 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile rootProject.ext.deps["junit"]
androidTestImplementation project(path: ':NeoLang')
compile rootProject.ext.deps["kotlin-stdlib"]
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation rootProject.ext.deps["design"]
implementation rootProject.ext.deps["cardview-v7"]
compile 'org.greenrobot:eventbus:3.0.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
compile 'com.github.wrdlbrnft:modular-adapter:0.2.0.6'
compile 'com.github.wrdlbrnft:sorted-list-adapter:0.2.0.19'
compile 'com.simplecityapps:recyclerview-fastscroll:1.0.16'
compile 'de.psdev.licensesdialog:licensesdialog:1.8.3'
compile 'com.github.GrenderG:Color-O-Matic:1.1.5'
implementation project(':chrome-tabs')
implementation project(path: ':NeoLang')
androidTestImplementation project(path: ':NeoLang')
implementation project(':Xorg')
}

View File

@ -26,20 +26,26 @@ buildscript {
KOTLIN_VERSION : '1.2.0',
MIN_SDK_VERSION : 21,
COMPILE_SDK_VERSION : 27,
TARGET_SDK_VERSION : 27,
BUILD_TOOL_VERSION : '27.0.2',
JUNIT_VERSION : "4.12"
]
ext.deps =
[
"appcompat-v7": "com.android.support:appcompat-v7: ${ext.android.ANDROID_SUPPORT_VERSION}",
"design" : "com.android.support:design: ${ext.android.ANDROID_SUPPORT_VERSION}",
"cardview-v7" : "com.android.support:cardview-v7: ${ext.android.ANDROID_SUPPORT_VERSION}",
"kotlin-stdlib": "org.jetbrains.kotlin:kotlin-stdlib-jre7:${ext.android.KOTLIN_VERSION}"
]
ext.deps = [
"annotations" : "com.android.support:support-annotations:${ext.android.ANDROID_SUPPORT_VERSION}",
"appcompat-v7" : "com.android.support:appcompat-v7:${ext.android.ANDROID_SUPPORT_VERSION}",
"design" : "com.android.support:design:${ext.android.ANDROID_SUPPORT_VERSION}",
"cardview-v7" : "com.android.support:cardview-v7:${ext.android.ANDROID_SUPPORT_VERSION}",
"kotlin-stdlib" : "org.jetbrains.kotlin:kotlin-stdlib-jre7:${ext.android.KOTLIN_VERSION}",
"kotlin-gradle-plugin": "org.jetbrains.kotlin:kotlin-gradle-plugin:${ext.android.KOTLIN_VERSION}",
"junit" : "junit:junit:${ext.android.JUNIT_VERSION}"
]
repositories {
@ -48,7 +54,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.ext.android.KOTLIN_VERSION}"
classpath rootProject.ext.deps["kotlin-gradle-plugin"]
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,12 +1,12 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion rootProject.ext.android.COMPILE_SDK_VERSION
buildToolsVersion rootProject.ext.android.BUILD_TOOL_VERSION
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
minSdkVersion rootProject.ext.android.MIN_SDK_VERSION
targetSdkVersion rootProject.ext.android.TARGET_SDK_VERSION
versionCode 1
versionName "1.0"
}
@ -23,7 +23,7 @@ android {
dependencies {
compile 'com.github.michael-rapp:android-util:1.15.0'
compile 'com.android.support:support-annotations:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
testCompile 'junit:junit:4.12'
compile rootProject.ext.deps["annotations"]
compile rootProject.ext.deps["appcompat-v7"]
testCompile rootProject.ext.deps["junit"]
}

View File