Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh for compat with IJ 2020+ #15

Merged
merged 8 commits into from Sep 25, 2020
Merged

Refresh for compat with IJ 2020+ #15

merged 8 commits into from Sep 25, 2020

Conversation

Tristan971
Copy link
Contributor

@Tristan971 Tristan971 commented Aug 13, 2020

Hi,

Am getting into Nix, and I do love my IJ so I thought it'd be cool to get this plugin refreshed (and later on improved upon).

So this is a first PR related to refreshing the project structure, which, thanks to Jetbrains making quite a few leaps in plugin development QoL, wasn't too difficult.

With this I'm able to gradle build the project which yields a usable plugin package at build/distributions/NixIDEA-<version>.zip. No idea how to wire automatic update to the marketplace however, so keep it manual as it was before for now.

Let me know your thoughts and apologies for the out-of-nowhere PR.

Cheers

Note: I'm no fan of Gradle personally, but alas it's the route Jetbrains has chosen for plugins, and it does allow almost all the Lexer/Parser setup and plugin packaging to be trivialized, so we might as well embrace the recommended way (from: https://github.com/JetBrains/intellij-platform-plugin-template )

@Tristan971 Tristan971 mentioned this pull request Aug 13, 2020
@jonringer
Copy link

O.o this is a big update. Unfortunately, I'm not qualified to give a good PR review :(

@Tristan971
Copy link
Contributor Author

Tristan971 commented Aug 13, 2020

That's fine, note that 99% of the changes is deleting files under src/gen which are... well... generated at build time and hence shouldn't have been here to begin with 🙂

if you run it locally, with the old files in there, you will see that they are pretty much the same, except the Jetbrain plugin now generates stub implementation classes for each Interface generated.

No worries anyway, the review can wait for someone to have a bit of time 👍

@Tristan971 Tristan971 force-pushed the master branch 2 times, most recently from 90a9126 to ea2c5c8 Compare August 13, 2020 17:00
Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Also I never build a intellij plugin myself (mostly android stuff).

@Mic92
Copy link
Member

Mic92 commented Aug 13, 2020

cc @mrVanDalo for testing.

Copy link

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love to have a nix plugin for jetbrains

no testing, and probably won't have time to do a proper review til after 20.09 is released

@jul1u5
Copy link

jul1u5 commented Sep 23, 2020

Hi, this seems very cool! I wanted to try it out on NixOS, but the :runIde Gradle task ran into an error:

> Task :runIde FAILED
 A problem occurred starting process 'command '/home/julius/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr-11_0_6-linux-x64-b765.25/jbr/bin/java''

The issue seems to be quite trivial: the Gradle task downloaded a JRE that doesn't work on NixOS because it isn't patched, e.g., the interpreter is set to /lib64/ld-linux-x86-64.so.2 which isn't there in NixOS.

I came up with a very brittle solution that seems to work (IDEA launches successfuly):

# Remove the downloaded JRE directory
$ rm -rf /home/julius/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr-11_0_6-linux-x64-b765.25

# Symlink the same directory to a patched JetBrains JDK from nixpkgs
$ ln -s $(nix-build '<nixpkgs>' -A jetbrains.jdk)/lib/openjdk /home/julius/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr-11_0_6-linux-x64-b765.25

# Run the previously failing task
$ ./gradlew runIde

Perhaps this could be improved so that people running NixOS would have better experience contributing to the project. Maybe it's possible to bypass downloading the JRE by specifying a local path in build.gradle.kts?

@Mic92
Copy link
Member

Mic92 commented Sep 25, 2020

@jul1u5 were you able to test the plugin? When worst comes to worst, one could also use fhsuservenv: https://gist.github.com/Mic92/b59054188c595e5652cacf50485583e0 to make the jetbrains build working.

@jul1u5
Copy link

jul1u5 commented Sep 25, 2020

@Mic92 Hi, the syntax highlighting and error reporting seemed to work fine. However, I didn't know how to test the linting, profile management and template features that are mentioned in the README.

I was thinking, that maybe the development environment for NixOS could be implemented in another PR after this one is merged. For now we could just add the fhsuserenv file that you linked, or at least mention it in the README.

@Mic92 Mic92 merged commit c2abc0a into NixOS:master Sep 25, 2020
@Mic92
Copy link
Member

Mic92 commented Sep 25, 2020

If at least syntax highlight works, we should also publish a new version as I suspect in the current state no one can use it in idea with newer versions.

@Tristan971
Copy link
Contributor Author

Ah yeah, I didn't try the "runIde" task, only focused on the "build" one, since that generates the zip-packaged plugin.

It's only a matter of adding a GitHub action for example replicating travis and artifacting it as a release I suppose.

Can do it, or let it for others to figure out ; I'm not familiar how publication to the Jetbrains marketplace happens however, and I'm not sure the project is set up to allow individuals to try that out either?

@Mic92
Copy link
Member

Mic92 commented Sep 26, 2020

Maybe @edwtjo has more insights into the jetbrain marketplace. However github actions for uploading stuff on github tags should be a good starter.

@JojOatXGME
Copy link
Contributor

@Tristan971 Are you working on a release job? Otherwiese, I could also take a look. My experiance with GitHub Actions is limited but uploading an artifact when certain tags are pushed sounds easy enough.

@Tristan971
Copy link
Contributor Author

@Tristan971 Are you working on a release job? Otherwiese, I could also take a look. My experiance with GitHub Actions is limited but uploading an artifact when certain tags are pushed sounds easy enough.

Hi @JojOatXGME, unfortunately I don't quite have the time to work on it right now, so by all means go ahead with that 🙇

@JojOatXGME
Copy link
Contributor

I created pull request #16 about a release job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants