weisJ / auto-dark-mode

IDEA plugin to automatically apply system theme settings on macOS and Windows.
https://plugins.jetbrains.com/plugin/14076-auto-dark-mode
MIT License
53 stars 14 forks source link

Gradle build may be unstable #11

Closed IncPlusPlus closed 4 years ago

IncPlusPlus commented 4 years ago

The Gradle build isn't very stable for me. The reason for this is beyond my knowledge with Gradle and the Gradle IntelliJ plugin. This can be replicated on the master branch and on the Gnome branch. The goal of the build is to launch the IDE with the built plugin installed.

There are two main issues that I run into when building.

  1. When running ./gradlew build, task :auto-dark-mode-plugin:buildSearchableOptions will fail with the error kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath. Also interesting is that auto-dark-mode-base will also try to run the same task during the build.
    1. :auto-dark-mode-plugin:buildSearchableOptions can also not fail the build while still logging errors.
  2. Running ./gradlew :auto-dark-mode-plugin:runIde will make the build hang on task :auto-dark-mode-base:compileJava > Resolve files of :auto-dark-mode-base:compileClasspath. This also happens when running ./gradlew build. I've checked the system monitor and the build seems to be doing nothing at this point. I've let the build sit for up to 10 minutes and it never will get past that point. Usually by killing the hung-up build and running the same command again, the build proceeds past this issue.

What I then do is use CTRL + C to terminate the build. Running ./gradlew :auto-dark-mode-plugin:runIde again after killing the failed run will then allow the IDE to launch without issue.

Steps to reproduce

  1. Clone the project (pick one of these)
    • git clone https://github.com/weisJ/auto-dark-mode.git && cd auto-dark-mode
    • git clone https://github.com/IncPlusPlus/auto-dark-mode.git -b feature/linux+gnome-support && cd auto-dark-mode
  2. Add your GH access token with githubAccessToken=[your token] in gradle.properties in the root of the project
  3. ./gradlew build
    • The build may hang here on :auto-dark-mode-base:compileJava > Resolve files of :auto-dark-mode-base:compileClasspath. If it does, kill the build and run ./gradlew build again. It should build normally
  4. ./gradlew :auto-dark-mode-plugin:runIde
    • The build may hang here on :auto-dark-mode-base:compileJava > Resolve files of :auto-dark-mode-base:compileClasspath. If it does, kill the build and run ./gradlew :auto-dark-mode-plugin:runIde again. It should build normally

I'm not sure what is causing this behavior. I may just be using Gradle wrong. Is this how I'm supposed to build the project or have I been going about this the wrong way?

weisJ commented 4 years ago
  1. Also interesting is that auto-dark-mode-base will also try to run the same task during the build.

That is because the org.jetbrains.intellij is applied to auto-dark-mode-base. I have removed it on the master branch. Could you try if this resolves the issue for you? I couldn't reproduce

will fail with the error kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath

:auto-dark-mode-plugin:buildSearchableOptions can also not fail the build while still logging errors.

That is expected and nothing that can be done about. There is almost no time where I don't get the already shutdown error.

IncPlusPlus commented 4 years ago

That seems to have fixed it. I'll just ignore the shutdown error since the build succeeds anyways.

A new quirk has surfaced, though. The build will stop on :auto-dark-mode-macos:jar or :auto-dark-mode-windows:jar and, depending on which one it got stuck on, won't print the typical output about getting the artifact from GitHub. It simply stops. Here's what it looks like when it gets stuck on the Windows part of the build.

ryan@pop-os:~/Downloads/tmp/auto-dark-mode$ ./gradlew build
./gradlew: 39: cd: can't cd to "./
'main' component in project ':auto-dark-mode-macos' cannot build on this machine.
'main' component in project ':auto-dark-mode-windows' cannot build on this machine.

> Task :auto-dark-mode-macos:jar
auto-dark-mode-macos: Using pre-build library from github for targetMachine macos-x86-64.
<==========---> 81% EXECUTING [1m 46s]
> IDLE
> IDLE
> :auto-dark-mode-windows:jar
> IDLE
> IDLE
> IDLE
> IDLE
> IDLE

I'm wondering if there may be some sort of bug with the plugin that retrieves the artifacts. Much like the previous issue, if I cancel this build and try again, the build proceeds past that point and completes successfully.

weisJ commented 4 years ago

Could you run with —info and upload the log.

IncPlusPlus commented 4 years ago

Sure thing. Here's the log.

weisJ commented 4 years ago

Looks like a lock wasn't always released. This wasn't an issue for me as it only resulted in an issue if more than one library needed to be downloaded. Could you confirm that the latest changes resolved the issue for you?

IncPlusPlus commented 4 years ago

Pulled the latest changes. Builds now complete successfully!