Skip to content

[flutter_tools] Support IntelliJ 2020.1 and later on Linux and Windows - #58853

Merged
jonahwilliams merged 4 commits into
flutter:masterfrom
jparound30:support_intellij2020_linux_win
Oct 13, 2020
Merged

jonahwilliams merged 4 commits into
flutter:masterfrom
jparound30:support_intellij2020_linux_win

Conversation

@jparound30

@jparound30 jparound30 commented Jun 6, 2020 •

Copy link
Copy Markdown
Contributor

Description

Even after PR #57963 merged, Flutter tools do not recognize IntelliJ IDEA/Community 2020.1 on Linux and Windows.

This PR will update IntelliJ IDEA/Community validation logic for 2020.1 and later on Linux and Windows.

Related Issues

Ref: #57963
Ref: #57684
Ref: #54867
Ref: #58384

Tests

I added the following tests:
packages/flutter_tools/test/general.shard/intellij/intellij_validator_test.dart

  • 'legacy intellij(<2020) plugins check on linux'
  • 'intellij(2020.1) plugins check on linux (installed via JetBrains ToolBox app)'
  • 'intellij(>=2020.2) plugins check on linux (installed via JetBrains ToolBox app)'
  • 'intellij(2020.1~) plugins check on linux (installed via tar.gz)'
  • 'legacy intellij(<2020) plugins check on windows'
  • 'intellij(2020.1 ~ 2020.2) plugins check on windows (installed via JetBrains ToolBox app)'
  • 'intellij(>=2020.3) plugins check on windows (installed via JetBrains ToolBox app and plugins)'
  • 'intellij(2020.1~) plugins check on windows (installed via installer)'

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read [Handling breaking changes].

  • No, no existing tests failed, so this is not a breaking change.

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 6, 2020
@jparound30 jparound30 changed the title Support intellij2020 linux win [flutter_tools] Support IntelliJ 2020.1 and later on Liinux and Windows Jun 6, 2020
@jparound30 jparound30 changed the title [flutter_tools] Support IntelliJ 2020.1 and later on Liinux and Windows [flutter_tools] Support IntelliJ 2020.1 and later on Linux and Windows Jun 9, 2020
@jparound30
jparound30 force-pushed the support_intellij2020_linux_win branch 5 times, most recently from 46e0293 to 8dc16ed Compare June 13, 2020 08:43
@zanderso
zanderso requested a review from jonahwilliams June 18, 2020 20:45
@jonahwilliams

Copy link
Copy Markdown
Contributor

Hi @jparound30 ,

This is a really well written PR, and with good test coverage too. I'm sorry it took so long to get to reviewing it, but we were a bit stuck on what our plans for the IDE validators are.

After discussing it for a while, it sounds like we're going to drop the IDE validation all together. It was proving to be a lot of work to maintain, and was often giving users the impression that they needed to use Android Studio/Intellij/VsCode - which isn't the case today.

Since we're going to turn down the feature, we can't merge this PR. I'm sorry that we didn't get to this one sooner, but I really appreciate the effort you put into it and I would love to see more contributions from you in the future.

@christopherfujino christopherfujino mentioned this pull request Jun 25, 2020
9 of 13 tasks
@jonahwilliams jonahwilliams reopened this Oct 10, 2020
@jonahwilliams

Copy link
Copy Markdown
Contributor

Hi @jparound30

We've backtracked a bit and we're still going to support IDE validators. If you are willing to rebase and update I'm happy to review and help you land this

@jparound30
jparound30 force-pushed the support_intellij2020_linux_win branch from 8dc16ed to 5d19dbb Compare October 10, 2020 16:46
@jparound30
jparound30 force-pushed the support_intellij2020_linux_win branch 2 times, most recently from 82ec72d to 41d4f51 Compare October 11, 2020 11:51
@jparound30
jparound30 force-pushed the support_intellij2020_linux_win branch from 41d4f51 to 26c9c08 Compare October 12, 2020 00:10
@jparound30

Copy link
Copy Markdown
Contributor Author

Hi @jonahwilliams

Thank you for giving me the opportunity!
I've updated this pull request so please review it.

@jonahwilliams

Copy link
Copy Markdown
Contributor

That is great to hear! I will take a look first thing in the morning 😄

@jonahwilliams jonahwilliams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just some minor style nits, otherwise this looks great.

String installPath;
try {
installPath = fileSystem.file(fileSystem.path.join(dir.path, '.home')).readAsStringSync();
} on Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: only catch the specific exception type thrown by the file system.

Suggested change
} on Exception {
} on FileSystemException{


// after IntelliJ 2020
final Directory cacheDir = fileSystem.directory(fileSystem.path.join(platform.environment['LOCALAPPDATA'], 'JetBrains'));
if (cacheDir.existsSync()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

since there are not validators added after this check, you could reduce some of the nesting here by doing an early return.

if (!cachedir.existsSync()) {
  return validators;
}

// IntelliJ 2020.3
pluginsPath = installPath + '.plugins';
addValidator(title, version, installPath, pluginsPath);
} else if (fileSystem.isDirectorySync(fileSystem.path.join(platform.environment['APPDATA'], 'JetBrains', name, 'plugins'))) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: pull out the value into a local like appData and reuse it.

}
// after IntelliJ 2020 ~
final Directory cacheDir = fileSystem.directory(fileSystem.path.join(fileSystemUtils.homeDirPath, '.cache', 'JetBrains'));
if (cacheDir.existsSync()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same general comments here as above

/// in another JAR.
const String kIntellijFlutterPluginXml = r'''
void createIntellijFlutterPluginJar(String pluginJarPath, FileSystem fileSystem, {String version = '0.1.3'}) {
/// These file contents were derived from the META-INF/plugin.xml from an Intellij Flutter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would leave this as a doc comment and place this on the method itself, maybe with an additional first sentence like "a helper to create a flutter plugin jar XML string"

/// in another JAR.
const String kIntellijDartPluginXml = r'''
void createIntellijDartPluginJar(String pluginJarPath, FileSystem fileSystem) {
/// These file contents were derived from the META-INF/plugin.xml from an Intellij Dart

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here

@jonahwilliams jonahwilliams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@jonahwilliams
jonahwilliams merged commit 1e18006 into flutter:master Oct 13, 2020
@jonahwilliams

Copy link
Copy Markdown
Contributor

Landed! Thank you so much @jparound30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants