Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Revert "fix: configure Dagger Hilt for DI"
Browse files Browse the repository at this point in the history
This reverts commit 874d32b.
  • Loading branch information
itsaky committed Jul 20, 2024
1 parent c806ece commit 788ae2d
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 153 deletions.
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ plugins {
alias(libs.plugins.gradle.publish) apply false
alias(libs.plugins.protobuf) apply false
alias(libs.plugins.benchmark) apply false
alias(libs.plugins.hilt) apply false
}

buildscript {
Expand Down
1 change: 0 additions & 1 deletion composite-builds/build-logic/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ dependencies {
implementation(projects.buildLogic.propertiesParser)

implementation("com.android.tools.build:gradle:${libs.versions.agp.asProvider().get()}")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.kotlin.asProvider().get()}")
implementation(libs.maven.publish)

implementation(libs.common.jkotlin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ class AndroidIDEPlugin : Plugin<Project> {
return@run
}

// Apply dependency injection for all modules
plugins.apply(DIConfigPlugin::class.java)

if (this.isAndroidModule && !isFDroidBuild) {
if (isAndroidModule && !isFDroidBuild) {
// setup signing configuration
plugins.apply(SigningConfigPlugin::class.java)
}
Expand All @@ -58,7 +55,7 @@ class AndroidIDEPlugin : Plugin<Project> {
}

val taskName = when {
this.isAndroidModule -> "testDebugUnitTest"
isAndroidModule -> "testDebugUnitTest"
else -> "test"
}

Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions core/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ plugins {
id("realm-android")
id("androidx.navigation.safeargs.kotlin")
id("com.itsaky.androidide.desugaring")
id("com.google.dagger.hilt.android")
}

apply {
Expand Down Expand Up @@ -59,8 +58,6 @@ kapt {
arguments {
arg("eventBusIndex", "${BuildConfig.packageName}.events.AppEventsIndex")
}

correctErrorTypes = true
}

desugaring {
Expand All @@ -79,7 +76,6 @@ dependencies {
// Annotation processors
kapt(libs.common.glide.ap)
kapt(libs.google.auto.service)
kapt(libs.hilt.compiler)
kapt(projects.annotation.processors)

implementation(libs.common.editor)
Expand All @@ -96,8 +92,6 @@ dependencies {
implementation(libs.google.gson)
implementation(libs.google.guava)

implementation(libs.hilt.android)

// Git
implementation(libs.git.jgit)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ import com.itsaky.androidide.viewmodel.EditorViewModel
import com.itsaky.androidide.xml.resources.ResourceTableRegistry
import com.itsaky.androidide.xml.versions.ApiVersionsRegistry
import com.itsaky.androidide.xml.widgets.WidgetTableRegistry
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import org.greenrobot.eventbus.Subscribe
Expand All @@ -119,7 +118,6 @@ import kotlin.math.roundToLong
* @author Akash Yadav
*/
@Suppress("MemberVisibilityCanBePrivate")
@AndroidEntryPoint
abstract class BaseEditorActivity : EdgeToEdgeIDEActivity(), TabLayout.OnTabSelectedListener,
DiagnosticClickListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ abstract class ProjectHandlerActivity : BaseEditorActivity() {

buildServiceConnection.onConnected = null
editorViewModel.isBoundToBuildSerice = true

Lookup.getDefault().update(BuildService.KEY_BUILD_SERVICE, service)
service.setEventListener(mBuildEventListener)

if (!service.isToolingServerStarted()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import com.itsaky.androidide.utils.VMUtils
import com.itsaky.androidide.utils.flashError
import com.termux.app.TermuxApplication
import com.termux.shared.reflection.ReflectionUtils
import dagger.hilt.android.HiltAndroidApp
import io.github.rosemoe.sora.widget.schemes.EditorColorScheme
import io.realm.Realm
import kotlinx.coroutines.DelicateCoroutinesApi
Expand All @@ -72,7 +71,7 @@ import java.lang.Thread.UncaughtExceptionHandler
import java.time.Duration
import kotlin.system.exitProcess

@HiltAndroidApp

class IDEApplication : TermuxApplication() {

private var uncaughtExceptionHandler: UncaughtExceptionHandler? = null
Expand Down
30 changes: 0 additions & 30 deletions core/app/src/main/java/com/itsaky/androidide/di/ActivityModule.kt

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import com.itsaky.androidide.tooling.api.models.ToolingServerMetadata
import com.itsaky.androidide.tooling.events.ProgressEvent
import com.itsaky.androidide.utils.Environment
import com.termux.shared.termux.shell.command.environment.TermuxShellEnvironment
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -79,7 +78,6 @@ import java.util.concurrent.TimeUnit
*
* @author Akash Yadav
*/
@AndroidEntryPoint
class GradleBuildService : Service(), BuildService, IToolingApiClient,
ToolingServerRunner.Observer {

Expand All @@ -102,8 +100,7 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient,
private var eventListener: EventListener? = null

private val buildServiceScope = CoroutineScope(
Dispatchers.Default + CoroutineName("GradleBuildService")
)
Dispatchers.Default + CoroutineName("GradleBuildService"))

private val isGradleWrapperAvailable: Boolean
get() {
Expand All @@ -125,6 +122,7 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient,
}

companion object {

private val log = LoggerFactory.getLogger(GradleBuildService::class.java)
private val NOTIFICATION_ID = R.string.app_name
private val SERVER_System_err = LoggerFactory.getLogger("ToolingApiErrorStream")
Expand All @@ -140,10 +138,8 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient,
return isToolingServerStarted && server != null
}

private fun showNotification(
message: String,
@Suppress("SameParameterValue") isProgress: Boolean
) {
private fun showNotification(message: String,
@Suppress("SameParameterValue") isProgress: Boolean) {
log.info("Showing notification to user...")
createNotificationChannels()
startForeground(NOTIFICATION_ID, buildNotification(message, isProgress))
Expand All @@ -153,8 +149,7 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient,
val buildNotificationChannel = NotificationChannel(
BaseApplication.NOTIFICATION_GRADLE_BUILD_SERVICE,
getString(string.title_gradle_service_notification_channel),
NotificationManager.IMPORTANCE_LOW
)
NotificationManager.IMPORTANCE_LOW)
NotificationManagerCompat.from(this)
.createNotificationChannel(buildNotificationChannel)
}
Expand Down Expand Up @@ -320,8 +315,7 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient,

override fun checkGradleWrapperAvailability(): CompletableFuture<GradleWrapperCheckResult> {
return if (isGradleWrapperAvailable) CompletableFuture.completedFuture(
GradleWrapperCheckResult(true)
) else installWrapper()
GradleWrapperCheckResult(true)) else installWrapper()
}

internal fun setServerListener(listener: OnServerStartListener?) {
Expand All @@ -341,10 +335,8 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient,

private fun doInstallWrapper(): GradleWrapperCheckResult {
val extracted = File(Environment.TMP_DIR, "gradle-wrapper.zip")
if (!ResourceUtils.copyFileFromAssets(
ToolsManager.getCommonAsset("gradle-wrapper.zip"),
extracted.absolutePath
)
if (!ResourceUtils.copyFileFromAssets(ToolsManager.getCommonAsset("gradle-wrapper.zip"),
extracted.absolutePath)
) {
log.error("Unable to extract gradle-plugin.zip from IDE resources.")
return GradleWrapperCheckResult(false)
Expand All @@ -366,10 +358,8 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient,
}

private fun doUpdateNotification(message: String, isProgress: Boolean) {
(getSystemService(NOTIFICATION_SERVICE) as NotificationManager).notify(
NOTIFICATION_ID,
buildNotification(message, isProgress)
)
(getSystemService(NOTIFICATION_SERVICE) as NotificationManager).notify(NOTIFICATION_ID,
buildNotification(message, isProgress))
}

override fun metadata(): CompletableFuture<ToolingServerMetadata> {
Expand All @@ -378,8 +368,7 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient,
}

override fun initializeProject(
params: InitializeProjectParams
): CompletableFuture<InitializeResult> {
params: InitializeProjectParams): CompletableFuture<InitializeResult> {
checkServerStarted()
Objects.requireNonNull(params)
return performBuildTasks(server!!.initialize(params))
Expand Down Expand Up @@ -492,8 +481,7 @@ class GradleBuildService : Service(), BuildService, IToolingApiClient,
}

outputReaderJob = buildServiceScope.launch(
Dispatchers.IO + CoroutineName("ToolingServerErrorReader")
) {
Dispatchers.IO + CoroutineName("ToolingServerErrorReader")) {
val reader = input.bufferedReader()
try {
reader.forEachLine { line ->
Expand Down
9 changes: 0 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ logback = "1.5.3"
realm = "10.18.0"
benchmark = "1.2.4"
benchmark-junit4 = "1.2.4"
hilt = "2.51.1"

[libraries]

Expand Down Expand Up @@ -76,13 +75,6 @@ common-hiddenApiBypass = { module = "org.lsposed.hiddenapibypass:hiddenapibypass
common-termuxAmLib = { module = "com.termux:termux-am-library", version = "v2.0.0" }
common-charts = { module = "com.github.AppDevNext:AndroidChart", version = "3.1.0.21" }

# Dependency Injection
## DO NOT REMOVE
## Accessed programmatically in DIConfigPlugin
## Update DIConfigPlugin if renamed
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }

# AndroidX
androidx-annotation = { module = "androidx.annotation:annotation", version = "1.7.1" }
androidx-appcompat = { module = "androidx.appcompat:appcompat", version = "1.6.1" }
Expand Down Expand Up @@ -187,4 +179,3 @@ maven-publish = { id = "com.vanniktech.maven.publish.base", version.ref = "maven
gradle-publish = { id = "com.gradle.plugin-publish", version = "1.2.1" }
protobuf = { id = "com.google.protobuf", version = "0.9.4" }
benchmark = { id = "androidx.benchmark", version.ref = "benchmark" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }

0 comments on commit 788ae2d

Please sign in to comment.