diff --git a/.idea/compiler.xml b/.idea/compiler.xml index c4eed3e..4333bff 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -14,7 +14,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 9e7459d..b07c978 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -92,7 +92,7 @@ - + diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/build.gradle b/build.gradle index 5903ec7..c237d24 100644 --- a/build.gradle +++ b/build.gradle @@ -1,55 +1,41 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { - def moduleConfigProps = new Properties() - File moduleConfig = rootProject.file("moduleConfig.properties") - if (moduleConfig.exists()) { - moduleConfigProps.load(new FileInputStream(moduleConfig)) - } - def localMavenDir = file(moduleConfigProps.localMavenPath) - - ext.kotlin_version = '1.4.31' - - ext.shadow_version = '2.0.15' + apply from: "${gradle.ext.localGradleDir}/settings/deps.gradle" repositories { - maven { url "file://${localMavenDir.absolutePath}" } + maven { url "file://${gradle.ext.localMavenDir.absolutePath}" } + google() + mavenCentral() maven { url "https://jitpack.io" } + maven { url "https://plugins.gradle.org/m2/" } - google() - jcenter() + maven { url "https://repo1.maven.org/maven2/" } } dependencies { - classpath 'com.android.tools.build:gradle:4.1.2' - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + classpath 'com.android.tools.build:gradle:7.0.0' + classpath classpath.kotlin + classpath classpath.component_router + classpath classpath.bugly + classpath classpath.analysis + classpath classpath.upload } } -def moduleConfigProps = new Properties() -File moduleConfig = rootProject.file("moduleConfig.properties") -if (moduleConfig.exists()) { - moduleConfigProps.load(new FileInputStream(moduleConfig)) -} -def localMavenDir = file(moduleConfigProps.localMavenPath) -def localGradleDir = file(moduleConfigProps.localGradlePath) - allprojects { repositories { - maven { url "file://${localMavenDir.absolutePath}" } + maven { url "file://${gradle.ext.localMavenDir.absolutePath}" } google() - jcenter() - mavenLocal() + mavenCentral() maven { url "https://jitpack.io" } maven { url "https://plugins.gradle.org/m2/" } + maven { url "https://repo1.maven.org/maven2/" } + + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } // for org-java } } task clean(type: Delete) { delete rootProject.buildDir } - -apply from: "${localGradleDir}/deps.gradle" \ No newline at end of file diff --git a/context.gradle b/context.gradle new file mode 100644 index 0000000..31eb531 --- /dev/null +++ b/context.gradle @@ -0,0 +1,38 @@ +def loadProperties(filename) { + Properties properties = new Properties() + + def file = new File(settingsDir, filename) + + if (file.exists()) { + properties.load(file.newDataInputStream()) + } else { + logger.warn("Properties file ${file} does not exist") + } + + return properties +} + +gradle.ext.appProperties = loadProperties('app.properties') +gradle.ext.moduleConfig = loadProperties('moduleConfig.properties') +gradle.ext.localMavenDir = file(gradle.ext.moduleConfig.localMavenPath) +gradle.ext.localGradleDir = file(gradle.ext.moduleConfig.localGradlePath) + + +// 引入composing的设置 +apply from: "gradle/composingConfig.gradle" +// 遍历composing_dependencies中的所有配置 +ext.getProperty("composing_dependencies").each { projectConfig -> + def isLocal = projectConfig["isLocal"] + def projectPath = projectConfig["projectPath"] + def projectMaven = projectConfig["projectMaven"] + def projectName = projectConfig["projectName"] + // 如果是本地依赖 + if (isLocal) { + // 使用本地依赖进行替换 + includeBuild(projectPath) { + dependencySubstitution { + substitute module(projectMaven) with project(projectName) + } + } + } +} diff --git a/gradle/library/publish_to_local_maven.gradle b/gradle/library/publish_to_local_maven.gradle deleted file mode 100644 index d7d3438..0000000 --- a/gradle/library/publish_to_local_maven.gradle +++ /dev/null @@ -1,36 +0,0 @@ -apply plugin: 'maven' - -def moduleConfigProps = new Properties() -File moduleConfig = project.file("moduleConfig.properties") -if (moduleConfig.exists()) { - moduleConfigProps.load(new FileInputStream(moduleConfig)) -} -def rootProps = new Properties() -File rootConfig = rootProject.file("moduleConfig.properties") -if (rootConfig.exists()) { - rootProps.load(new FileInputStream(rootConfig)) -} - -ext { - DIST_PATH = new File(rootDir, rootProps.localMavenPath) - PUBLISH_GROUP_ID = moduleConfigProps.PUBLISH_GROUP_ID - PUBLISH_ARTIFACT_ID = moduleConfigProps.PUBLISH_ARTIFACT_ID - PUBLISH_VERSION = moduleConfigProps.PUBLISH_VERSION -} - -uploadArchives { - repositories.mavenDeployer { - def deployPath = file(project.DIST_PATH) - repository(url: "file://${deployPath.absolutePath}") - pom.project { - groupId project.PUBLISH_GROUP_ID - artifactId project.PUBLISH_ARTIFACT_ID - version project.PUBLISH_VERSION - } - } -} - -task autoUploadArchives(dependsOn: ["${project.path}:assembleRelease"]) { - group = "upload" - finalizedBy tasks.getByName("uploadArchives") -} \ No newline at end of file diff --git a/gradle/library_header.gradle b/gradle/library_header.gradle index 82cfbcc..0f73974 100644 --- a/gradle/library_header.gradle +++ b/gradle/library_header.gradle @@ -1,68 +1 @@ -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' - -android { - compileSdkVersion 29 - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 29 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi'] - - javaCompileOptions { - annotationProcessorOptions { - arguments = [ - "moduleName" : project.getName(), - "HOST" : project.getName().replace("-", ""), - "RouterDocFolder": "${project.rootDir}/RouterDocument".toString(), - "RouterDocEnable": String.valueOf("true") - ] - } - } - } - - buildTypes { - debug { - buildConfigField "boolean", "LOG_DEBUG", "true" - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', file(rootProject.ext.android["globalProguardFilesPath"]) - } - - release { - buildConfigField "boolean", "LOG_DEBUG", "false" - zipAlignEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', file(rootProject.ext.android["globalProguardFilesPath"]) - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - lintOptions { - disable 'MissingTranslation' - disable 'ExtraTranslation' - disable 'BlockedPrivateApi' - } - - dexOptions { - jumboMode = true - } - - useLibrary 'org.apache.http.legacy' -} - - -dependencies { - kapt rootProject.ext.dependencies["dagger2-compiler"] - kapt rootProject.ext.dependencies["router-compiler"] - - api rootProject.ext.dependencies["kotlin-stdlib"] -} +apply from: "${gradle.ext.localGradleDir}/library/header.gradle" diff --git a/gradle/library_tail.gradle b/gradle/library_tail.gradle index 850f496..261c50a 100644 --- a/gradle/library_tail.gradle +++ b/gradle/library_tail.gradle @@ -1,16 +1 @@ -def moduleConfigProps = new Properties() -File moduleConfig = rootProject.file("moduleConfig.properties") -if (moduleConfig.exists()) { - moduleConfigProps.load(new FileInputStream(moduleConfig)) -} - -def localMavenDir = new File(rootDir, moduleConfigProps.localMavenPath) -def localGradleDir = new File(rootDir, moduleConfigProps.localGradlePath) -def localLibraryGradleDir = new File(localGradleDir, "library") -if (localLibraryGradleDir.exists()) { - FilenameFilter filter = { dir, filename -> filename.endsWith(".gradle") } - def gradleFiles = localLibraryGradleDir.listFiles filter - gradleFiles.each { file -> - apply from: "file://${file.absolutePath}" - } -} +apply from: "${gradle.ext.localGradleDir}/library/footer.gradle" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ce0de31..fe4ddd8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jun 25 20:58:55 CST 2021 +#Sat Mar 13 10:38:09 CST 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip diff --git a/moduleConfig.properties b/moduleConfig.properties index 3751c93..e93ad72 100644 --- a/moduleConfig.properties +++ b/moduleConfig.properties @@ -1,4 +1,4 @@ # 本地 maven 的路径 -localMavenPath=/Users/zby/Documents/GitHub/mempool/TimeCatMaven +localMavenPath=/Users/zby/Documents/timecat/mempool/TimeCatMaven # 本地 gradle 的路径 -localGradlePath=/Users/zby/Documents/GitHub/mempool/TimeCatGradle +localGradlePath=/Users/zby/Documents/timecat/mempool/TimeCatGradle diff --git a/plugin-main-lib/src/main/java/com/timecat/plugin/picturebed/github/view/GithubBedView.java b/plugin-main-lib/src/main/java/com/timecat/plugin/picturebed/github/view/GithubBedView.java index 7438fe2..25f8d80 100644 --- a/plugin-main-lib/src/main/java/com/timecat/plugin/picturebed/github/view/GithubBedView.java +++ b/plugin-main-lib/src/main/java/com/timecat/plugin/picturebed/github/view/GithubBedView.java @@ -103,7 +103,7 @@ public void onClick(View v) { }); } - private void bindEt(final EditText editText, final GithubSetting setting) { + private void bindEt(EditText editText, GithubSetting setting) { String text = DEF.githubApp().getString(setting.key, setting.defaultValue); editText.setText(text); editText.addTextChangedListener(new TextWatcher() { diff --git a/plugin-normal-apk/build.gradle b/plugin-normal-apk/build.gradle index ea87fcf..c2307f7 100644 --- a/plugin-normal-apk/build.gradle +++ b/plugin-normal-apk/build.gradle @@ -1,40 +1,21 @@ -apply plugin: 'com.android.application' +apply from: "${gradle.ext.localGradleDir}/project/plugin_header.gradle" android { - compileSdkVersion 29 defaultConfig { applicationId "com.tencent.shadow.sample.plugin" - minSdkVersion 21 - targetSdkVersion 28 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - - signingConfig signingConfigs.create("release") - signingConfig.initWith(buildTypes.debug.signingConfig) - } - } - packagingOptions { - exclude 'META-INF/DEPENDENCIES' - exclude 'META-INF/rxjava.properties' } } dependencies { api project(':plugin-main-lib') -// implementation 'androidx.appcompat:appcompat:1.0.2' -// implementation 'com.tencent:mmkv:1.0.16' -// -// def retrofitSdkVersion = "2.6.0" -// implementation "com.squareup.retrofit2:retrofit:$retrofitSdkVersion" -// implementation "com.squareup.retrofit2:converter-gson:$retrofitSdkVersion" -// implementation "com.squareup.retrofit2:adapter-rxjava:$retrofitSdkVersion" -// implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitSdkVersion" -// implementation "com.squareup.okhttp3:okhttp:3.10.0" -// implementation "io.reactivex.rxjava2:rxandroid:2.0.1" + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'com.tencent:mmkv:1.0.16' + + def retrofitSdkVersion = "2.6.0" + implementation "com.squareup.retrofit2:retrofit:$retrofitSdkVersion" + implementation "com.squareup.retrofit2:converter-gson:$retrofitSdkVersion" + implementation "com.squareup.retrofit2:adapter-rxjava:$retrofitSdkVersion" + implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitSdkVersion" + implementation "com.squareup.okhttp3:okhttp:3.10.0" + implementation "io.reactivex.rxjava2:rxandroid:2.0.1" } diff --git a/plugin-shadow-apk/build.gradle b/plugin-shadow-apk/build.gradle index 55ea540..3b8ca2e 100644 --- a/plugin-shadow-apk/build.gradle +++ b/plugin-shadow-apk/build.gradle @@ -1,5 +1,4 @@ -//先照抄一下plugin-normal-apk -apply from: '../plugin-normal-apk/build.gradle' +apply from: "${gradle.ext.localGradleDir}/project/plugin_header.gradle" android { defaultConfig { diff --git a/sample-loader/build.gradle b/sample-loader/build.gradle index 8fc590b..7b6348c 100644 --- a/sample-loader/build.gradle +++ b/sample-loader/build.gradle @@ -23,6 +23,12 @@ android { signingConfig.initWith(buildTypes.debug.signingConfig) } } + lintOptions { + checkReleaseBuilds false + // Or, if you prefer, you can continue to check for errors in release builds, + // but continue the build even when errors are found: + abortOnError false + } } dependencies { diff --git a/sample-runtime/build.gradle b/sample-runtime/build.gradle index 9645f52..c50d06b 100644 --- a/sample-runtime/build.gradle +++ b/sample-runtime/build.gradle @@ -23,6 +23,12 @@ android { signingConfig.initWith(buildTypes.debug.signingConfig) } } + lintOptions { + checkReleaseBuilds false + // Or, if you prefer, you can continue to check for errors in release builds, + // but continue the build even when errors are found: + abortOnError false + } } dependencies { diff --git a/settings.gradle b/settings.gradle index 2f68801..20b4641 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,7 @@ +rootProject.name = "TimeCat-Plugin-PictureBed-Github" + +apply from: "context.gradle" + include ':plugin-main-lib' include ':plugin-normal-apk'//把plugin-main-lib编成apk include ':plugin-shadow-apk'//把plugin-main-lib编成Shadow插件