From 13fd3e22b670c6f7df4dbd473a4188e9007d9518 Mon Sep 17 00:00:00 2001 From: laoyuyu Date: Fri, 13 Jan 2023 16:07:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8catalog=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppFrame/build.gradle | 8 ++--- Aria/build.gradle | 17 +++++----- AriaAnnotations/build.gradle | 2 +- FtpComponent/build.gradle | 13 +++++--- HttpComponent/build.gradle | 13 +++++--- M3U8Component/build.gradle | 13 +++++--- PublicComponent/build.gradle | 14 +++++---- SFtpComponent/build.gradle | 13 +++++--- app/build.gradle | 8 ++--- build.gradle | 40 ++++-------------------- gradle/wrapper/gradle-wrapper.properties | 2 +- libs.versions.toml | 31 ++++++++++++++++++ settings.gradle | 24 ++++++++++++++ 13 files changed, 121 insertions(+), 77 deletions(-) create mode 100644 libs.versions.toml diff --git a/AppFrame/build.gradle b/AppFrame/build.gradle index c6be7353..023c37b6 100644 --- a/AppFrame/build.gradle +++ b/AppFrame/build.gradle @@ -3,12 +3,12 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion libs.versions.compilesdk.get().toInteger() + buildToolsVersion libs.versions.buildToolsVersion.get() defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdkVersion libs.versions.minSdk.get().toInteger() + targetSdkVersion libs.versions.targetsdk.get().toInteger() versionCode 1 versionName "1.0" diff --git a/Aria/build.gradle b/Aria/build.gradle index c795d6b6..520e2caa 100644 --- a/Aria/build.gradle +++ b/Aria/build.gradle @@ -1,12 +1,15 @@ -apply plugin: 'com.android.library' +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' +} android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion libs.versions.compilesdk.get().toInteger() + buildToolsVersion libs.versions.buildToolsVersion.get() defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdkVersion libs.versions.minSdk.get().toInteger() + targetSdkVersion libs.versions.targetsdk.get().toInteger() versionCode rootProject.ext.versionCode versionName rootProject.ext.versionName } @@ -25,8 +28,8 @@ android { } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - testImplementation 'junit:junit:4.12' -// implementation "androidx.appcompat:appcompat:${rootProject.ext.XAppcompatVersion}" + testImplementation(libs.bundles.android.test) + implementation(libs.appcompat) api project(path: ':AriaAnnotations') api project(path: ':PublicComponent') api project(path: ':HttpComponent') diff --git a/AriaAnnotations/build.gradle b/AriaAnnotations/build.gradle index a77f0adb..c65cb88b 100644 --- a/AriaAnnotations/build.gradle +++ b/AriaAnnotations/build.gradle @@ -8,7 +8,7 @@ sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) +// compile fileTree(dir: 'libs', include: ['*.jar']) } //apply from: 'bintray-release.gradle' diff --git a/FtpComponent/build.gradle b/FtpComponent/build.gradle index 701738be..7af2f0e1 100644 --- a/FtpComponent/build.gradle +++ b/FtpComponent/build.gradle @@ -1,12 +1,15 @@ -apply plugin: 'com.android.library' +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' +} android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion libs.versions.compilesdk.get().toInteger() + buildToolsVersion libs.versions.buildToolsVersion.get() defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdkVersion libs.versions.minSdk.get().toInteger() + targetSdkVersion libs.versions.targetsdk.get().toInteger() versionCode rootProject.ext.versionCode versionName rootProject.ext.versionName diff --git a/HttpComponent/build.gradle b/HttpComponent/build.gradle index d9e3222d..530299de 100644 --- a/HttpComponent/build.gradle +++ b/HttpComponent/build.gradle @@ -1,12 +1,15 @@ -apply plugin: 'com.android.library' +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' +} android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion libs.versions.compilesdk.get().toInteger() + buildToolsVersion libs.versions.buildToolsVersion.get() defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdkVersion libs.versions.minSdk.get().toInteger() + targetSdkVersion libs.versions.targetsdk.get().toInteger() versionCode rootProject.ext.versionCode versionName rootProject.ext.versionName diff --git a/M3U8Component/build.gradle b/M3U8Component/build.gradle index 834a5421..1781786d 100644 --- a/M3U8Component/build.gradle +++ b/M3U8Component/build.gradle @@ -1,12 +1,15 @@ -apply plugin: 'com.android.library' +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' +} android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion libs.versions.compilesdk.get().toInteger() + buildToolsVersion libs.versions.buildToolsVersion.get() defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdkVersion libs.versions.minSdk.get().toInteger() + targetSdkVersion libs.versions.targetsdk.get().toInteger() versionCode rootProject.ext.versionCode versionName rootProject.ext.versionName diff --git a/PublicComponent/build.gradle b/PublicComponent/build.gradle index ebb5075b..5a949b5f 100644 --- a/PublicComponent/build.gradle +++ b/PublicComponent/build.gradle @@ -1,13 +1,15 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' +} android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion libs.versions.compilesdk.get().toInteger() + buildToolsVersion libs.versions.buildToolsVersion.get() defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdkVersion libs.versions.minSdk.get().toInteger() + targetSdkVersion libs.versions.targetsdk.get().toInteger() versionCode rootProject.ext.versionCode versionName rootProject.ext.versionName diff --git a/SFtpComponent/build.gradle b/SFtpComponent/build.gradle index 66af9f6e..b6e149a9 100644 --- a/SFtpComponent/build.gradle +++ b/SFtpComponent/build.gradle @@ -1,12 +1,15 @@ -apply plugin: 'com.android.library' +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' +} android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion libs.versions.compilesdk.get().toInteger() + buildToolsVersion libs.versions.buildToolsVersion.get() defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdkVersion libs.versions.minSdk.get().toInteger() + targetSdkVersion libs.versions.targetsdk.get().toInteger() versionCode rootProject.ext.versionCode versionName rootProject.ext.versionName diff --git a/app/build.gradle b/app/build.gradle index a317d495..4c90c0a7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,13 +4,13 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion libs.versions.compilesdk.get().toInteger() + buildToolsVersion libs.versions.buildToolsVersion.get() defaultConfig { applicationId "com.arialyy.simple" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdkVersion libs.versions.minSdk.get().toInteger() + targetSdkVersion libs.versions.targetsdk.get().toInteger() versionCode 1 versionName "1.0" multiDexEnabled true diff --git a/build.gradle b/build.gradle index e72e2a9d..848262f4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,45 +1,17 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.5.20' - // ext.kotlin_version = '1.3.20' - repositories { - jcenter() - mavenCentral() - google() - maven { url 'https://jitpack.io' } - } + ext.kotlin_version = '1.7.20' dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' -// classpath 'com.novoda:bintray-release:0.9.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" + classpath files(libs.class.superclass.protectionDomain.codeSource.location) classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.30" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // kotlin 文档引擎 - // classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7' - // classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - jcenter() - mavenCentral() - google() - maven { url 'https://jitpack.io' } - } - - tasks.withType(Javadoc) { - options { - encoding "UTF-8" - charSet 'UTF-8' - links "http://docs.oracle.com/javase/7/docs/api" - } } } -task clean(type: Delete) { - delete rootProject.buildDir +plugins { + id 'com.android.application' version '7.3.1' apply false + id 'com.android.library' version '7.3.1' apply false + id 'org.jetbrains.kotlin.android' version '1.7.20' apply false } ext { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6cbf6275..d4f5c300 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -5,4 +5,4 @@ zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists #distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip #distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/libs.versions.toml b/libs.versions.toml new file mode 100644 index 00000000..7fd036a7 --- /dev/null +++ b/libs.versions.toml @@ -0,0 +1,31 @@ +[versions] +minSdk = "21" +compilesdk = "33" +targetsdk = "33" +appcompat = "1.5.1" +recyclerview = "1.2.1" +buildToolsVersion="33.0.1" +room = "2.4.3" +test-junit = "4.13.2" +android-junit = "1.1.4" +android-espresso = "3.5.0" +android-ktx = "1.7.0" +lifecycle = "2.5.1" + + +[libraries] +recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" } +room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } +room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" } +junit = { module = "junit:junit", version.ref = "test-junit" } +android-junit = { module = "androidx.test.ext:junit", version.ref = "android-junit" } +android-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "android-espresso" } +android-ktx = { module = "androidx.core:core-ktx", version.ref = "android-ktx" } +appcompat = {module = "androidx.appcompat:appcompat", version.ref = "appcompat"} +lifecycle-viewmodel-ktx = {module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle"} +lifecycle-viewmodel-compose = {module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycle"} +lifecycle-runtime-ktx = {module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle"} + +[bundles] +android-test = ["android-junit", "android-espresso"] +lifecycle = ["lifecycle-viewmodel-ktx", "lifecycle-viewmodel-compose", "lifecycle-runtime-ktx"] diff --git a/settings.gradle b/settings.gradle index cee643c8..40f558c1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,26 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + mavenLocal() + } +} +enableFeaturePreview('VERSION_CATALOGS') +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + mavenLocal() + } + + versionCatalogs { + libs { + from(files("libs.versions.toml")) + } + } +} + + include ':app', ':Aria', ':AriaAnnotations', ':AriaCompiler', ':AppFrame', ':HttpComponent', ':M3U8Component', ':SFtpComponent', ':FtpComponent', ':PublicComponent'