Skip to content

Commit

Permalink
Fixed Startup Issue. (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
Unthrottled authored Jan 22, 2023
1 parent 468295a commit 4e5e156
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 40 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# AMII Android Extensions Changelog

## [0.3.0]

## Fixed

- Not being able to open up projects.

## [0.2.0]

## Added
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ intellij {
updateSinceUntilBuild.set(true)

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins.set(listOf("io.unthrottled.amii:0.15.1", "android", "org.jetbrains.android"))
plugins.set(listOf("io.unthrottled.amii:1.1.4", "android", "org.jetbrains.android"))
}

// Configure detekt plugin.
Expand Down
4 changes: 2 additions & 2 deletions docs/RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Added
## Fixed

- 2022.1 Build Support
- Not being able to open up projects.
10 changes: 6 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@

pluginGroup = io.unthrottled
pluginName_ = Anime Memes - Android Extension
pluginVersion = 0.2.0
pluginSinceBuild = 203.5981.155
pluginUntilBuild = 221.*
pluginVersion = 0.3.0
pluginSinceBuild = 213.7172
pluginUntilBuild = 223.*
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
# See https://jb.gg/intellij-platform-builds-list for available build versions
pluginVerifierIdeVersions = 2021.1, 2021.3.2, 2022.1.4

platformType = IU
platformVersion = 2021.3.2
platformVersion = 2021.3.1
platformDownloadSources = true

idePath=
#idePath=/Users/alexsimons/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents
#idePath=/home/alex/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7717.56.2111.7361063
#idePath=/home/alex/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/211.6085.15

6 changes: 0 additions & 6 deletions src/main/kotlin/io/unthrottled/amii/android/PluginMaster.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package io.unthrottled.amii.android

import com.android.tools.idea.gradle.project.build.invoker.GradleBuildInvoker
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ProjectManager
import com.intellij.openapi.project.ProjectManagerListener
import io.unthrottled.amii.android.listeners.GradleListener
import io.unthrottled.amii.android.onboarding.UserOnBoarding
import io.unthrottled.amii.android.platform.LifeCycleManager
import io.unthrottled.amii.android.tools.Logging
Expand Down Expand Up @@ -55,10 +53,6 @@ internal data class ProjectListeners(
private val project: Project,
) : Disposable {

init {
project.getService(GradleBuildInvoker::class.java)?.add(GradleListener(project))
}

override fun dispose() {
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.unthrottled.amii.android.listeners

import com.android.tools.idea.gradle.project.build.BuildContext
import com.android.tools.idea.gradle.project.build.BuildStatus
import com.android.tools.idea.gradle.project.build.GradleBuildListener
import com.android.tools.idea.gradle.project.build.invoker.GradleBuildInvoker
import com.android.tools.idea.gradle.project.build.invoker.GradleInvocationResult
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
Expand All @@ -19,7 +21,7 @@ internal enum class TaskStatus {
class GradleListener(
private val project: Project,
) :
GradleBuildInvoker.AfterGradleInvocationTask,
GradleBuildListener,
UserEventListener,
Disposable {

Expand All @@ -33,12 +35,33 @@ class GradleListener(
}
}

override fun execute(result: GradleInvocationResult) {
override fun onDispatch(userEvent: UserEvent) {
previousTaskStatus = when (userEvent.type) {
UserEvents.TASK -> {
when (userEvent.category) {
UserEventCategory.NEGATIVE -> TaskStatus.FAIL
UserEventCategory.POSITIVE -> TaskStatus.PASS
else -> TaskStatus.UNKNOWN
}
}

else -> TaskStatus.UNKNOWN
}
}

override fun dispose() {
messageBusConnection.dispose()
}

override fun buildExecutorCreated(request: GradleBuildInvoker.Request) {
}

override fun buildStarted(context: BuildContext) {
}

override fun buildFinished(status: BuildStatus, context: BuildContext?) {
when {
!(
result.isBuildSuccessful ||
result.isBuildCancelled
) -> {
status == BuildStatus.FAILED -> {
project.messageBus
.syncPublisher(EVENT_TOPIC)
.onDispatch(
Expand All @@ -50,7 +73,9 @@ class GradleListener(
),
)
}
previousTaskStatus == TaskStatus.FAIL -> {

previousTaskStatus == TaskStatus.FAIL &&
status == BuildStatus.SUCCESS -> {
project.messageBus
.syncPublisher(EVENT_TOPIC)
.onDispatch(
Expand All @@ -64,21 +89,4 @@ class GradleListener(
}
}
}

override fun onDispatch(userEvent: UserEvent) {
previousTaskStatus = when (userEvent.type) {
UserEvents.TASK -> {
when (userEvent.category) {
UserEventCategory.NEGATIVE -> TaskStatus.FAIL
UserEventCategory.POSITIVE -> TaskStatus.PASS
else -> TaskStatus.UNKNOWN
}
}
else -> TaskStatus.UNKNOWN
}
}

override fun dispose() {
messageBusConnection.dispose()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private fun buildUpdateMessage(updateAsset: String): String =
"""
What's New?<br>
<ul>
<li>Added Jetbrains Platform 2022.1 Build Support</li>
<li>Fixed not being able to open up projects</li>
</ul>
<br>See the <a href="https://github.com/ani-memes/amii-android-extension#documentation">documentation</a> for features, usages, and configurations.
<br>The <a href="https://github.com/ani-memes/amii-android-extension/blob/master/CHANGELOG.md">changelog</a> is available for more details.
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>Anime Memes - Android Extension</name>
<vendor>Unthrottled</vendor>

<idea-version since-build="203.5981.155"/>
<idea-version since-build="213.7172"/>

<!-- Product and plugin compatibility requirements -->
<!-- https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html -->
Expand All @@ -26,6 +26,8 @@
topic="com.intellij.ide.plugins.DynamicPluginListener"/>
</applicationListeners>
<projectListeners>
<listener class="io.unthrottled.amii.android.listeners.GradleListener"
topic="com.android.tools.idea.gradle.project.build.GradleBuildListener"/>
</projectListeners>
<actions>
</actions>
Expand Down

0 comments on commit 4e5e156

Please sign in to comment.