build: reorganize and reconfigure modules to resolve dependency resolution errors

Gradle, for some reason, does not the path of modules to identify them uniquely. Instead, the 'build id' is used to do so, which consists of the maven group and artifact ID. So, even if two modules are located in separate directories, but have the name group and artifact ID, including both of them in other modules may result in dependency resolution errors.
This commit is contained in:
Akash Yadav
2024-05-29 13:11:44 +05:30
parent c0c185cfb7
commit 1efd6a04d5
2457 changed files with 1069 additions and 709 deletions
+101 -1
View File
@@ -18,16 +18,30 @@
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.errorprone/error_prone_annotations/2.18.0/89b684257096f548fa39a7df9fdaa409d4d4df91/error_prone_annotations-2.18.0.jar" />
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.j2objc/j2objc-annotations/2.8/c85270e307e7b822f1086b93689124b89768e273/j2objc-annotations-2.8.jar" />
</processorPath>
<module name="AndroidIDE.annotation-processors.main" />
<module name="AndroidIDE.annotation.processors.main" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="1.8">
<module name="AndroidIDE.actions" target="17" />
<module name="AndroidIDE.annotation-ksp" target="17" />
<module name="AndroidIDE.annotation-ksp.main" target="17" />
<module name="AndroidIDE.annotation-ksp.test" target="17" />
<module name="AndroidIDE.annotation-processors" target="17" />
<module name="AndroidIDE.annotation-processors-java" target="11" />
<module name="AndroidIDE.annotation-processors-java.main" target="11" />
<module name="AndroidIDE.annotation-processors-java.test" target="11" />
<module name="AndroidIDE.annotation-processors-ksp" target="17" />
<module name="AndroidIDE.annotation-processors-ksp.main" target="17" />
<module name="AndroidIDE.annotation-processors-ksp.test" target="17" />
<module name="AndroidIDE.annotation-processors.main" target="17" />
<module name="AndroidIDE.annotation-processors.test" target="17" />
<module name="AndroidIDE.annotations" target="11" />
<module name="AndroidIDE.annotations.main" target="11" />
<module name="AndroidIDE.annotations.test" target="11" />
<module name="AndroidIDE.app" target="17" />
<module name="AndroidIDE.build-info" target="11" />
<module name="AndroidIDE.build-info.main" target="11" />
<module name="AndroidIDE.build-info.test" target="11" />
<module name="AndroidIDE.build-tools.aaptcompiler" target="11" />
<module name="AndroidIDE.build-tools.aaptcompiler.test" target="11" />
<module name="AndroidIDE.build-tools.builder-api" target="11" />
@@ -101,31 +115,78 @@
<module name="AndroidIDE.buildSrc.test" target="11" />
<module name="AndroidIDE.colorschemes" target="11" />
<module name="AndroidIDE.colorschemes.main" target="11" />
<module name="AndroidIDE.common" target="17" />
<module name="AndroidIDE.editor-api" target="17" />
<module name="AndroidIDE.editor-languages" target="11" />
<module name="AndroidIDE.editor-treesitter" target="17" />
<module name="AndroidIDE.emulatorview" target="17" />
<module name="AndroidIDE.eventbus" target="11" />
<module name="AndroidIDE.eventbus-android" target="17" />
<module name="AndroidIDE.eventbus-events" target="17" />
<module name="AndroidIDE.eventbus.main" target="11" />
<module name="AndroidIDE.eventbus.test" target="11" />
<module name="AndroidIDE.google-java-format" target="1.8" />
<module name="AndroidIDE.gradle-plugin" target="11" />
<module name="AndroidIDE.gradle-plugin-config" target="11" />
<module name="AndroidIDE.gradle-plugin-config.main" target="11" />
<module name="AndroidIDE.gradle-plugin-config.test" target="11" />
<module name="AndroidIDE.gradle-plugin.main" target="11" />
<module name="AndroidIDE.gradle-plugin.test" target="11" />
<module name="AndroidIDE.gradle-tooling" target="1.8" />
<module name="AndroidIDE.gradle-tooling.plugin" target="1.8" />
<module name="AndroidIDE.idestats" target="17" />
<module name="AndroidIDE.javac" target="1.8" />
<module name="AndroidIDE.ksp-processor" target="11" />
<module name="AndroidIDE.ksp-processor.main" target="11" />
<module name="AndroidIDE.ksp-processor.test" target="11" />
<module name="AndroidIDE.lexers" target="11" />
<module name="AndroidIDE.lexers.main" target="11" />
<module name="AndroidIDE.lexers.test" target="11" />
<module name="AndroidIDE.logger" target="11" />
<module name="AndroidIDE.logger.main" target="11" />
<module name="AndroidIDE.logger.test" target="11" />
<module name="AndroidIDE.logsender" target="17" />
<module name="AndroidIDE.logsender-sample" target="17" />
<module name="AndroidIDE.lookup" target="11" />
<module name="AndroidIDE.lookup.main" target="11" />
<module name="AndroidIDE.lookup.test" target="11" />
<module name="AndroidIDE.lsp.api" target="17" />
<module name="AndroidIDE.lsp.java" target="17" />
<module name="AndroidIDE.lsp.models" target="17" />
<module name="AndroidIDE.lsp.testing" target="17" />
<module name="AndroidIDE.lsp.xml" target="17" />
<module name="AndroidIDE.preferences" target="17" />
<module name="AndroidIDE.resources" target="17" />
<module name="AndroidIDE.sdk-info" target="11" />
<module name="AndroidIDE.shared" target="11" />
<module name="AndroidIDE.shared.main" target="11" />
<module name="AndroidIDE.shared.test" target="11" />
<module name="AndroidIDE.subprojects.aaptcompiler" target="17" />
<module name="AndroidIDE.subprojects.appintro" target="17" />
<module name="AndroidIDE.subprojects.benchmark" target="17" />
<module name="AndroidIDE.subprojects.builder-model-impl" target="11" />
<module name="AndroidIDE.subprojects.builder-model-impl.main" target="11" />
<module name="AndroidIDE.subprojects.builder-model-impl.test" target="11" />
<module name="AndroidIDE.subprojects.classfile" target="11" />
<module name="AndroidIDE.subprojects.classfile.main" target="11" />
<module name="AndroidIDE.subprojects.classfile.test" target="11" />
<module name="AndroidIDE.subprojects.database" target="17" />
<module name="AndroidIDE.subprojects.flashbar" target="17" />
<module name="AndroidIDE.subprojects.framework-stubs" target="11" />
<module name="AndroidIDE.subprojects.framework-stubs.main" target="11" />
<module name="AndroidIDE.subprojects.framework-stubs.test" target="11" />
<module name="AndroidIDE.subprojects.fuzzysearch" target="11" />
<module name="AndroidIDE.subprojects.fuzzysearch.main" target="11" />
<module name="AndroidIDE.subprojects.fuzzysearch.test" target="11" />
<module name="AndroidIDE.subprojects.google-java-format" target="17" />
<module name="AndroidIDE.subprojects.google-java-format.test" target="11" />
<module name="AndroidIDE.subprojects.indexing" target="17" />
<module name="AndroidIDE.subprojects.indexing.main" target="17" />
<module name="AndroidIDE.subprojects.indexing.test" target="17" />
<module name="AndroidIDE.subprojects.java-compiler-utils.main" target="8" />
<module name="AndroidIDE.subprojects.java-compiler-utils.test" target="8" />
<module name="AndroidIDE.subprojects.javac" target="11" />
<module name="AndroidIDE.subprojects.javac-services" target="17" />
<module name="AndroidIDE.subprojects.javac.main" target="11" />
<module name="AndroidIDE.subprojects.javac.test" target="11" />
<module name="AndroidIDE.subprojects.javapoet" target="17" />
@@ -138,20 +199,56 @@
<module name="AndroidIDE.subprojects.jdt.main" target="11" />
<module name="AndroidIDE.subprojects.jdt.test" target="11" />
<module name="AndroidIDE.subprojects.layoutlib-api" target="17" />
<module name="AndroidIDE.subprojects.projects" target="17" />
<module name="AndroidIDE.subprojects.termux-app" target="17" />
<module name="AndroidIDE.subprojects.termux-emulator" target="17" />
<module name="AndroidIDE.subprojects.termux-shared" target="17" />
<module name="AndroidIDE.subprojects.termux-view" target="17" />
<module name="AndroidIDE.subprojects.testing-android" target="17" />
<module name="AndroidIDE.subprojects.testing-common" target="11" />
<module name="AndroidIDE.subprojects.testing-common.main" target="11" />
<module name="AndroidIDE.subprojects.testing-common.test" target="11" />
<module name="AndroidIDE.subprojects.testing-lsp" target="17" />
<module name="AndroidIDE.subprojects.testing-tooling" target="11" />
<module name="AndroidIDE.subprojects.testing-tooling.main" target="11" />
<module name="AndroidIDE.subprojects.testing-tooling.test" target="11" />
<module name="AndroidIDE.subprojects.testing-unit" target="17" />
<module name="AndroidIDE.subprojects.tooling-api" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-config" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-config.main" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-config.test" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-events" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-events.main" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-events.test" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-impl" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-impl.main" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-impl.test" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-model" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-model.main" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-model.test" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-model2" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-model2.main" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-model2.test" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-testing" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-testing.main" target="11" />
<module name="AndroidIDE.subprojects.tooling-api-testing.test" target="11" />
<module name="AndroidIDE.subprojects.tooling-api.main" target="11" />
<module name="AndroidIDE.subprojects.tooling-api.test" target="11" />
<module name="AndroidIDE.subprojects.xml-dom" target="11" />
<module name="AndroidIDE.subprojects.xml-dom.main" target="11" />
<module name="AndroidIDE.subprojects.xml-dom.test" target="11" />
<module name="AndroidIDE.subprojects.xml-formatter.main" target="11" />
<module name="AndroidIDE.subprojects.xml-formatter.test" target="11" />
<module name="AndroidIDE.subprojects.xml-utils" target="17" />
<module name="AndroidIDE.templates-api" target="17" />
<module name="AndroidIDE.templates-impl" target="17" />
<module name="AndroidIDE.templates-testing" target="17" />
<module name="AndroidIDE.templates-testing.main" target="11" />
<module name="AndroidIDE.templates-testing.test" target="11" />
<module name="AndroidIDE.termux.termux-app" target="17" />
<module name="AndroidIDE.termux.termux-emulator" target="17" />
<module name="AndroidIDE.termux.termux-shared" target="17" />
<module name="AndroidIDE.termux.termux-view" target="17" />
<module name="AndroidIDE.testing-android" target="17" />
<module name="AndroidIDE.testing.android" target="17" />
<module name="AndroidIDE.testing.android.test" target="11" />
@@ -169,6 +266,9 @@
<module name="AndroidIDE.testing.unit" target="17" />
<module name="AndroidIDE.testing.unit.test" target="11" />
<module name="AndroidIDE.treesitter.test" target="1.7" />
<module name="AndroidIDE.treeview" target="17" />
<module name="AndroidIDE.uidesigner" target="17" />
<module name="AndroidIDE.xml-inflater" target="17" />
<module name="ATS.android-tree-sitter" target="17" />
<module name="ATS.app" target="17" />
<module name="ATS.tree-sitter-aidl" target="17" />
@@ -1,3 +1,5 @@
import com.itsaky.androidide.build.config.BuildConfig
/*
* This file is part of AndroidIDE.
*
@@ -21,9 +23,13 @@ plugins {
id("org.jetbrains.kotlin.jvm")
}
groupConfig {
groupIdSuffix.set("annotations")
}
dependencies {
implementation(libs.androidx.annotation)
implementation(libs.common.jkotlin)
compileOnly(projects.shared)
compileOnly(projects.subprojects.frameworkStubs)
compileOnly(projects.utilities.shared)
compileOnly(projects.utilities.frameworkStubs)
}
@@ -23,7 +23,9 @@ plugins {
kotlin("kapt")
}
group = "${BuildConfig.packageName}.annotations"
groupConfig {
groupIdSuffix.set("annotations")
}
dependencies {
kapt(libs.google.auto.service)
@@ -31,7 +33,7 @@ dependencies {
implementation(kotlin("stdlib"))
implementation(projects.annotations)
implementation(projects.annotation.annotations)
implementation(libs.androidx.annotation)
implementation(libs.common.javapoet)
@@ -22,13 +22,15 @@ plugins {
kotlin("jvm")
}
group = "${BuildConfig.packageName}.annotations"
groupConfig {
groupIdSuffix.set("annotations")
}
dependencies {
implementation(kotlin("stdlib"))
implementation(projects.annotations)
implementation(projects.eventbus)
implementation(projects.annotation.annotations)
implementation(projects.event.eventbus)
implementation(libs.androidx.annotation)
implementation(libs.common.javapoet)
-4
View File
@@ -1,4 +0,0 @@
o0OoO0
0oO00Oo0
oO0o0O0O
0O0o00
-129
View File
@@ -1,129 +0,0 @@
-ignorewarnings
-dontwarn **
-dontnote **
-dontobfuscate
-keep class javax.** { *; }
-keep class jdkx.** { *; }
# keep javac classes
-keep class openjdk.** { *; }
# Android builder model interfaces
-keep class com.android.** { *; }
# Tooling API classes
-keep class com.itsaky.androidide.tooling.** { *; }
# Builder model implementations
-keep class com.itsaky.androidide.builder.model.** { *; }
# Eclipse
-keep class org.eclipse.** { *; }
# JAXP
-keep class jaxp.** { *; }
-keep class org.w3c.** { *; }
-keep class org.xml.** { *; }
# Services
-keep @com.google.auto.service.AutoService class ** {
}
-keepclassmembers class ** {
@com.google.auto.service.AutoService <methods>;
}
# EventBus
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
<init>(java.lang.Throwable);
}
# Accessed reflectively
-keep class io.github.rosemoe.sora.widget.component.EditorAutoCompletion {
io.github.rosemoe.sora.widget.component.EditorCompletionAdapter adapter;
int currentSelection;
}
-keep class com.itsaky.androidide.projects.util.StringSearch {
packageName(java.nio.file.Path);
}
-keep class * implements org.antlr.v4.runtime.Lexer {
<init>(...);
}
-keep class * extends com.itsaky.androidide.lsp.java.providers.completion.IJavaCompletionProvider {
<init>(...);
}
-keep class com.itsaky.androidide.editor.api.IEditor { *; }
-keep class * extends com.itsaky.androidide.inflater.IViewAdapter { *; }
-keep class * extends com.itsaky.androidide.inflater.drawable.IDrawableParser {
<init>(...);
android.graphics.drawable.Drawable parse();
android.graphics.drawable.Drawable parseDrawable();
}
-keep class com.itsaky.androidide.utils.DialogUtils { public <methods>; }
# APK Metadata
-keep class com.itsaky.androidide.models.ApkMetadata { *; }
-keep class com.itsaky.androidide.models.ArtifactType { *; }
-keep class com.itsaky.androidide.models.MetadataElement { *; }
# Parcelable
-keepclassmembers class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator CREATOR;
}
# Used in preferences
-keep enum org.eclipse.lemminx.dom.builder.EmptyElements { *; }
-keep enum com.itsaky.androidide.xml.permissions.Permission { *; }
# Lots of native methods in tree-sitter
# There are some fields as well that are accessed from native field
-keepclasseswithmembers class ** {
native <methods>;
}
-keep class com.itsaky.androidide.treesitter.** { *; }
# Retrofit 2
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
# OkHttp3
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
# Stat uploader
-keep class com.itsaky.androidide.stats.** { *; }
# Gson
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
## Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
## Themes
-keep enum com.itsaky.androidide.ui.themes.IDETheme {
*;
}
## Contributor models - deserialized with GSON
-keep class * implements com.itsaky.androidide.contributors.Contributor {
*;
}
+2 -1
View File
@@ -21,6 +21,7 @@ import com.itsaky.androidide.build.config.BuildConfig
import com.itsaky.androidide.build.config.FDroidConfig
import com.itsaky.androidide.build.config.publishingVersion
import com.itsaky.androidide.plugins.AndroidIDEPlugin
import com.itsaky.androidide.plugins.GroupConfigPlugin
import com.itsaky.androidide.plugins.conf.configureAndroidModule
import com.itsaky.androidide.plugins.conf.configureJavaModule
import com.itsaky.androidide.plugins.conf.configureMavenPublish
@@ -50,11 +51,11 @@ subprojects {
// Always load the F-Droid config
FDroidConfig.load(project)
apply { plugin(GroupConfigPlugin::class.java) }
afterEvaluate {
apply { plugin(AndroidIDEPlugin::class.java) }
}
project.group = BuildConfig.packageName
project.version = rootProject.version
plugins.withId("com.android.application") {
@@ -78,7 +78,10 @@ class AndroidIDEAssetsPlugin : Plugin<Project> {
// Tooling API JAR copier
val copyToolingApiJar = tasks.register("copy${variantNameCapitalized}ToolingApiJar",
AddFileToAssetsTask::class.java) {
val toolingApi = rootProject.findProject(":subprojects:tooling-api-impl")!!
val implPath = ":tooling:impl"
val toolingApi = checkNotNull(rootProject.findProject(implPath)) {
"Cannot find the Tooling Impl module with project path: '$implPath'"
}
dependsOn(toolingApi.tasks.getByName("copyJar"))
val toolingApiJar = toolingApi.layout.buildDirectory.file("libs/tooling-api-all.jar")
@@ -0,0 +1,30 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.androidide.plugins
import org.gradle.api.Plugin
import org.gradle.api.Project
/**
* Marker plugin that is applied to the core application module project.
*
* @author Akash Yadav
*/
class AndroidIDECoreAppPlugin : Plugin<Project> {
override fun apply(target: Project) {}
}
@@ -30,43 +30,41 @@ import org.gradle.api.Project
*/
class AndroidIDEPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.run {
if (project.path == rootProject.path) {
throw GradleException("Cannot apply ${AndroidIDEPlugin::class.simpleName} to root project")
}
override fun apply(target: Project) = target.run {
if (project.path == rootProject.path) {
throw GradleException("Cannot apply ${AndroidIDEPlugin::class.simpleName} to root project")
}
if (!project.buildFile.exists() || !project.buildFile.isFile) {
return@run
}
if (!project.buildFile.exists() || !project.buildFile.isFile) {
return@run
}
val isAndroidModule = plugins.hasPlugin("com.android.application") ||
plugins.hasPlugin("com.android.library")
val isAndroidModule = plugins.hasPlugin("com.android.application") ||
plugins.hasPlugin("com.android.library")
if (isAndroidModule && !isFDroidBuild) {
// setup signing configuration
plugins.apply(SigningConfigPlugin::class.java)
}
if (isAndroidModule && !isFDroidBuild) {
// setup signing configuration
plugins.apply(SigningConfigPlugin::class.java)
}
if (isFDroidBuild && project.path == ":app") {
val baseExtension = extensions.getByType(BaseExtension::class.java)
logger.warn("Building for F-Droid with configuration:")
logger.warn("applicationId = ${baseExtension.defaultConfig.applicationId}")
logger.warn("versionName = ${baseExtension.defaultConfig.versionName}")
logger.warn("versionCode = ${baseExtension.defaultConfig.versionCode}")
logger.warn("--- x --- x ---")
}
if (isFDroidBuild && project.plugins.hasPlugin(AndroidIDECoreAppPlugin::class.java)) {
val baseExtension = extensions.getByType(BaseExtension::class.java)
logger.warn("Building for F-Droid with configuration:")
logger.warn("applicationId = ${baseExtension.defaultConfig.applicationId}")
logger.warn("versionName = ${baseExtension.defaultConfig.versionName}")
logger.warn("versionCode = ${baseExtension.defaultConfig.versionCode}")
logger.warn("--- x --- x ---")
}
val taskName = when {
isAndroidModule -> "testDebugUnitTest"
else -> "test"
}
val taskName = when {
isAndroidModule -> "testDebugUnitTest"
else -> "test"
}
logger.info("${project.path} will run task '$taskName' for tests in CI")
logger.info("${project.path} will run task '$taskName' for tests in CI")
project.tasks.create("runTestsInCI") {
dependsOn(taskName)
}
project.tasks.create("runTestsInCI") {
dependsOn(taskName)
}
}
}
@@ -0,0 +1,42 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.androidide.plugins
import com.itsaky.androidide.build.config.BuildConfig
import com.itsaky.androidide.plugins.exts.GroupConfigPluginExtension.Companion.groupConfigExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
/**
* @author Akash Yadav
*/
class GroupConfigPlugin : Plugin<Project> {
override fun apply(target: Project) = target.run {
val extension = groupConfigExtension()
extension.groupIdSuffix.convention("")
afterEvaluate {
val suffix = extension.groupIdSuffix.get().let {
if (it.isNotEmpty()) ".${it}" else ""
}
project.group = "${BuildConfig.packageName}${suffix}"
logger.info("Maven group ID set to : ${project.group}")
}
}
}
@@ -0,0 +1,30 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.androidide.plugins
import org.gradle.api.Plugin
import org.gradle.api.Project
/**
* Marker plugin to indicate that the desugaring plugin should not be applied to the project.
*
* @author Akash Yadav
*/
class NoDesugarPlugin : Plugin<Project> {
override fun apply(target: Project) {}
}
@@ -27,6 +27,8 @@ import com.itsaky.androidide.build.config.BuildConfig
import com.itsaky.androidide.build.config.FDroidConfig
import com.itsaky.androidide.build.config.isFDroidBuild
import com.itsaky.androidide.build.config.projectVersionCode
import com.itsaky.androidide.plugins.AndroidIDECoreAppPlugin
import com.itsaky.androidide.plugins.NoDesugarPlugin
import com.itsaky.androidide.plugins.util.SdkUtils.getAndroidJar
import org.gradle.api.Project
import org.gradle.api.artifacts.MinimalExternalModuleDependency
@@ -42,19 +44,20 @@ import org.gradle.api.provider.Provider
* flavor, the version code will be `100 * 270 + 1` i.e. `27001`
*/
internal val flavorsAbis = mapOf("armeabi-v7a" to 1, "arm64-v8a" to 2, "x86_64" to 3)
private val disableCoreLibDesugaringForModules = arrayOf(":logsender", ":logger")
fun Project.configureAndroidModule(
coreLibDesugDep: Provider<MinimalExternalModuleDependency>
) {
val isAppModule = plugins.hasPlugin("com.android.application")
assert(
plugins.hasPlugin("com.android.application") || plugins.hasPlugin("com.android.library")) {
isAppModule || plugins.hasPlugin("com.android.library")
) {
"${javaClass.simpleName} can only be applied to Android projects"
}
val androidJar = extensions.getByType(AndroidComponentsExtension::class.java)
.getAndroidJar(assertExists = true)
val frameworkStubsJar = findProject(":subprojects:framework-stubs")!!.file("libs/android.jar")
val frameworkStubsJar = findProject(":utilities:framework-stubs")!!.file("libs/android.jar")
.also { it.parentFile.mkdirs() }
if (!(frameworkStubsJar.exists() && frameworkStubsJar.isFile)) {
@@ -116,20 +119,13 @@ fun Project.configureAndroidModule(
configureCoreLibDesugaring(this, coreLibDesugDep)
if (":app" == project.path) {
if (project.plugins.hasPlugin(AndroidIDECoreAppPlugin::class.java)) {
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
flavorsAbis.forEach { (abi, _) ->
// the common defaultConfig, not the flavor-specific
defaultConfig.buildConfigField("String",
"ABI_${abi.replace('-', '_').uppercase()}",
"\"${abi}\"")
}
splits {
abi {
reset()
@@ -149,7 +145,8 @@ fun Project.configureAndroidModule(
// version code increment
val verCodeIncr = flavorsAbis[output.getFilter(
FilterConfiguration.FilterType.ABI)?.identifier]
FilterConfiguration.FilterType.ABI
)?.identifier]
?: throw UnsupportedOperationException("Universal APKs are not supported!")
output.versionCode.set(100 * projectVersionCode + verCodeIncr)
@@ -167,7 +164,11 @@ fun Project.configureAndroidModule(
buildTypes.getByName("debug") { isMinifyEnabled = false }
buildTypes.getByName("release") {
isMinifyEnabled = true
// from AGP 8.4.0 onwards, there are some behavioral changes in R8
// enabling R8 on library projects results in missing class errors
// see https://issuetracker.google.com/issues/338411137#comment11
isMinifyEnabled = isAppModule
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
@@ -177,7 +178,6 @@ fun Project.configureAndroidModule(
// the build are faster for this build type as compared to 'release'
buildTypes.register("dev") {
initWith(buildTypes.getByName("release"))
isMinifyEnabled = false
}
@@ -188,9 +188,11 @@ fun Project.configureAndroidModule(
}
}
private fun Project.configureCoreLibDesugaring(baseExtension: BaseExtension,
coreLibDesugDep: Provider<MinimalExternalModuleDependency>) {
val coreLibDesugaringEnabled = project.path !in disableCoreLibDesugaringForModules
private fun Project.configureCoreLibDesugaring(
baseExtension: BaseExtension,
coreLibDesugDep: Provider<MinimalExternalModuleDependency>
) {
val coreLibDesugaringEnabled = !project.plugins.hasPlugin(NoDesugarPlugin::class.java)
baseExtension.compileOptions.isCoreLibraryDesugaringEnabled = coreLibDesugaringEnabled
@@ -35,7 +35,7 @@ import org.gradle.kotlin.dsl.withType
import com.itsaky.androidide.build.config.publishingVersion
import java.io.File
private val projectsRequiringMavenLocalForTests = arrayOf(":gradle-plugin")
private val projectsRequiringMavenLocalForTests = arrayOf(":tooling:plugin")
private val mavenLocalRepos = hashMapOf<String, String>()
@Suppress("UnstableApiUsage")
@@ -45,6 +45,11 @@ fun Project.configureMavenPublish() {
}
gradle.projectsEvaluated {
for (path in projectsRequiringMavenLocalForTests) {
checkNotNull(rootProject.findProject(path)) {
"Unable to configure maven local for project '$path' (project cannot be found)."
}
}
rootProject.subprojects {
if (project.path in projectsRequiringMavenLocalForTests) {
tasks.withType<Test> {
@@ -0,0 +1,47 @@
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AndroidIDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*/
package com.itsaky.androidide.plugins.exts
import org.gradle.api.Project
import org.gradle.api.provider.Property
import org.gradle.kotlin.dsl.create
/**
* @author Akash Yadav
*/
abstract class GroupConfigPluginExtension {
/**
* The suffix for the maven group ID for the module.
*
* Example:
* If the [groupIdSuffix] is "core", then the maven group ID will be
* `${BuildConfig.packageName}.core`.
*/
abstract val groupIdSuffix: Property<String>
companion object {
/**
* Create the [GroupConfigPluginExtension] for the project.
*/
fun Project.groupConfigExtension(): GroupConfigPluginExtension {
return extensions.create<GroupConfigPluginExtension>("groupConfig")
}
}
}
@@ -23,6 +23,10 @@ plugins{
id("kotlin-kapt")
}
groupConfig {
groupIdSuffix.set("core")
}
android {
namespace = "${BuildConfig.packageName}.actions"
}
@@ -33,8 +37,8 @@ dependencies {
api(libs.androidx.nav.fragment)
api(libs.androidx.nav.ui)
implementation(projects.common)
implementation(projects.resources)
implementation(projects.core.common)
implementation(projects.core.resources)
implementation(libs.common.editor)
implementation(libs.common.kotlin)
implementation(libs.common.kotlin.coroutines.android)
@@ -3,6 +3,7 @@
import com.itsaky.androidide.build.config.BuildConfig
import com.itsaky.androidide.desugaring.utils.JavaIOReplacements.applyJavaIOReplacements
import com.itsaky.androidide.plugins.AndroidIDEAssetsPlugin
import com.itsaky.androidide.plugins.AndroidIDECoreAppPlugin
plugins {
id("com.android.application")
@@ -16,6 +17,7 @@ plugins {
apply {
plugin(AndroidIDEAssetsPlugin::class.java)
plugin(AndroidIDECoreAppPlugin::class.java)
}
buildscript {
@@ -25,6 +27,10 @@ buildscript {
}
}
groupConfig {
groupIdSuffix.set("core")
}
android {
namespace = BuildConfig.packageName
@@ -71,7 +77,7 @@ dependencies {
// Annotation processors
kapt(libs.common.glide.ap)
kapt(libs.google.auto.service)
kapt(projects.annotationProcessors)
kapt(projects.annotation.processors)
implementation(libs.common.editor)
implementation(libs.common.utilcode)
@@ -121,43 +127,43 @@ dependencies {
implementation(libs.composite.javapoet)
// Local projects here
implementation(projects.actions)
implementation(projects.buildInfo)
implementation(projects.common)
implementation(projects.editor)
implementation(projects.termux.termuxApp)
implementation(projects.termux.termuxView)
implementation(projects.termux.termuxEmulator)
implementation(projects.termux.termuxShared)
implementation(projects.eventbus)
implementation(projects.eventbusAndroid)
implementation(projects.eventbusEvents)
implementation(projects.gradlePluginConfig)
implementation(projects.idestats)
implementation(projects.subprojects.aaptcompiler)
implementation(projects.subprojects.indexing)
implementation(projects.subprojects.javacServices)
implementation(projects.subprojects.xmlUtils)
implementation(projects.subprojects.projects)
implementation(projects.subprojects.toolingApi)
implementation(projects.logsender)
implementation(projects.lsp.api)
implementation(projects.lsp.java)
implementation(projects.lsp.xml)
implementation(projects.lexers)
implementation(projects.lookup)
implementation(projects.preferences)
implementation(projects.resources)
implementation(projects.treeview)
implementation(projects.templatesApi)
implementation(projects.templatesImpl)
implementation(projects.uidesigner)
implementation(projects.xmlInflater)
implementation(projects.core.actions)
implementation(projects.core.common)
implementation(projects.core.indexing)
implementation(projects.core.lspApi)
implementation(projects.core.projects)
implementation(projects.core.resources)
implementation(projects.editor.impl)
implementation(projects.editor.lexers)
implementation(projects.event.eventbus)
implementation(projects.event.eventbusAndroid)
implementation(projects.event.eventbusEvents)
implementation(projects.java.javacServices)
implementation(projects.java.lsp)
implementation(projects.logging.idestats)
implementation(projects.logging.logsender)
implementation(projects.termux.application)
implementation(projects.termux.view)
implementation(projects.termux.emulator)
implementation(projects.termux.shared)
implementation(projects.tooling.api)
implementation(projects.tooling.pluginConfig)
implementation(projects.utilities.buildInfo)
implementation(projects.utilities.lookup)
implementation(projects.utilities.preferences)
implementation(projects.utilities.templatesApi)
implementation(projects.utilities.templatesImpl)
implementation(projects.utilities.treeview)
implementation(projects.utilities.uidesigner)
implementation(projects.utilities.xmlInflater)
implementation(projects.xml.aaptcompiler)
implementation(projects.xml.lsp)
implementation(projects.xml.utils)
// This is to build the tooling-api-impl project before the app is built
// So we always copy the latest JAR file to assets
compileOnly(projects.subprojects.toolingApiImpl)
compileOnly(projects.tooling.impl)
testImplementation(projects.subprojects.testingUnit)
androidTestImplementation(projects.subprojects.testingAndroid)
testImplementation(projects.testing.unitTest)
androidTestImplementation(projects.testing.androidTest)
}

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Some files were not shown because too many files have changed in this diff Show More