intellij-platform-plugin-template icon indicating copy to clipboard operation
intellij-platform-plugin-template copied to clipboard

Github action / workflow failed because of Android local path

Open vsay01 opened this issue 3 years ago • 4 comments

Hi,

I am creating an Android plugin that generate android related file. My repository was generated from this and it contains github workflows.

After I added android codes template, it complains about unresolved reference, so I added path to Android Studio Content.

In my gradle.properties file, I added

StudioCompilePath = /Applications/Android Studio.app/Contents

StudioRunPath=/Applications/Android Studio.app/Contents

Then in my build.gradle.kts file inside intellij, I called:

intellij.localPath = if (project.hasProperty("StudioRunPath")) properties("StudioRunPath") else properties("StudioRunPath")

When I Run ./gradlew check locally, it works fine. But it failed when it run on Github action with following error related to the path.


Welcome to Gradle 6.8.3!

Here are the highlights of this release:
 - Faster Kotlin DSL script compilation
 - Vendor selection for Java toolchains
 - Convenient execution of tasks in composite builds
 - Consistent dependency resolution

For more details see https://docs.gradle.org/6.8.3/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
[gradle-intellij-plugin :MVP Setup] Both `localPath` and `version` specified, second would be ignored

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':test'.
> Could not resolve all dependencies for configuration ':testRuntimeClasspath'.
   > Specified localPath '/Applications/Android Studio.app/Contents' doesn't exist or is not a directory

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 2s
Error: Process completed with exit code 1.

Do I expect to add local path if I added android related codes or is there any other way to resolve this without using the local path?

vsay01 avatar Mar 10 '21 01:03 vsay01

@vsay01 Looking at your intellij.localPath = if ... code – both condition branches result with the same value: properties("StudioRunPath").

hsz avatar Mar 29 '21 19:03 hsz

I think that condition can be removed, and just assign properties("StudioRunPath") to intellij.localPath.

The thing is that since this is plugin for Android Studio, if I don't give studio run path to local path, it will complain about android references not resolved such as Activity, Context, ... etc.

If I give the path intellij.localPath = properties("StudioRunPath"), the plugin in generated fine. but github action failed because the path is not found.

Any suggestion to get github action for this template resolved while maintain android path?

vsay01 avatar Mar 31 '21 10:03 vsay01

Sorry for the delay, Vortana. Ok, I got your point.

To provide AS for GitHub Actions, you can introduce an additional workflow step before building/testing the plugging that will download AS to the specific directory within the GHA container and provide that path as intellij.localPath.

hsz avatar Apr 06 '21 10:04 hsz

Thanks for the response @hsz .

Do you know any resources / documentations on how I can add Android Studio to the GitHub container?

vsay01 avatar Apr 07 '21 00:04 vsay01