[desc]:抽象公共配置

[author]:wangyimiao
master
yimiao 3 years ago
parent aaf76a2ab7
commit 8216c12bd7

@ -5,16 +5,19 @@ plugins {
id 'kotlin-kapt'
}
apply from: "${rootProject.rootDir}/buildCommon/commonLibConfig.gradle"
project.ext.setArouterConfig project
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
compileSdkVersion rootProject.ext.versions.compileSdkVersion
buildToolsVersion rootProject.ext.versions.buildToolsVersion
defaultConfig {
applicationId "com.common.commonlibtest"
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
minSdkVersion rootProject.ext.versions.minSdkVersion
targetSdkVersion rootProject.ext.versions.targetSdkVersion
versionCode rootProject.ext.versions.versionCode
versionName rootProject.ext.versions.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@ -52,10 +55,11 @@ android {
}
dependencies {
implementation project(path: ':commonLib')
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation project(path: ':commonLib')
// kotlin
implementation rootProject.ext.dependencies.kotlin

@ -1,5 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: "commonLibConfig.gradle"
apply from: "${rootProject.rootDir}/buildCommon/commonLibConfig.gradle"
buildscript {
repositories {
google()

@ -1,13 +1,4 @@
ext {
android = [
compileSdkVersion: 30,
buildToolsVersion: "30.0.3",
minSdkVersion : 23,
targetSdkVersion : 28,
versionCode : 1,
versionName : "1.0"
]
project.ext {
sign = [
keystore_path : "../innovationapp.jks",
keystore_pwd : "123456",
@ -20,6 +11,14 @@ ext {
]
versions = [
compileSdkVersion : 30,
buildToolsVersion : "30.0.3",
minSdkVersion : 23,
targetSdkVersion : 28,
versionCode : 1,
versionName : "1.0",
jvmTarget : "1.8",
appcompat : "1.2.0",
material : "1.2.1",
okhttp : "4.9.1",
@ -38,6 +37,7 @@ ext {
luban : "1.1.8",
kotlin_android : "1.4.1",
gson : "2.8.6",
arouter : "1.5.2",
]
dependencies = [
@ -63,5 +63,77 @@ ext {
photo_view : "com.github.chrisbanes:PhotoView:${versions.photo_view}",
luban : "top.zibin:Luban:${versions.luban}",
gson : "com.google.code.gson:gson${versions.gson}",
arouter : "com.alibaba:arouter-api:${versions.arouter}",
arouter_compiler : "com.alibaba:arouter-compiler:${versions.arouter}",
]
/**
* android project android {} default config
*/
setAndroidConfig = {
extension ->
extension.compileSdkVersion versions.compileSdkVersion
extension.defaultConfig {
minSdkVersion versions.minSdkVersion
targetSdkVersion versions.targetSdkVersion
versionCode versions.versionCode
versionName versions.vserionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
extension.compileOptions {
targetCompatibility = compileOptions.targetCompatibility
sourceCompatibility = compileOptions.sourceCompatibility
}
extension.kotlinOptions {
jvmTarget = versions.jvmTarget
}
}
/**
* android project dependencies {} default config
*/
setDependencies = {
extension ->
extension.implementation fileTree(include: ['*.jar'], dir: 'libs')
}
/**
* android library default config
*/
setLibDefaultConfig = {
extension ->
extension.apply plugin: 'com.android.library'
extension.apply plugin: 'kotlin-android'
extension.apply plugin: 'kotlin-parcelize'
extension.apply plugin: 'kotlin-kapt'
extension.description "lib"
setAndroidConfig extension.android
setDependencies extension.dependencies
}
/**
* android library common config
*/
setArouterConfig = {
extension ->
extension.android.defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
// ARouter
extension.dependencies.implementation(rootProject.ext.dependencies.arouter) {
exclude group: 'com.android.support'
}
extension.dependencies.annotationProcessor rootProject.ext.dependencies.arouter_compiler
}
}

@ -1,22 +1,7 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
}
apply from: "${rootProject.rootDir}/buildCommon/commonLibConfig.gradle"
project.ext.setLibDefaultConfig project
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
debug {
minifyEnabled false
@ -29,15 +14,6 @@ android {
buildConfigField 'String', 'BASE_URL_CONFIG_PATH', '"baseUrl.properties"'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
androidExtensions {
// kotlin
experimental = true
}
}
dependencies {

@ -1,34 +1,16 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-parcelize'
}
apply from: "${rootProject.rootDir}/buildCommon/commonLibConfig.gradle"
project.ext.setLibDefaultConfig project
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
viewBinding {
enabled = true
buildFeatures {
viewBinding true
}
}

Loading…
Cancel
Save