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

Improve IntelliJ IDE integration #53747

Merged
merged 4 commits into from
Mar 19, 2020

Conversation

mark-vieira
Copy link
Contributor

@mark-vieira mark-vieira commented Mar 18, 2020

This commit makes a number of improvements when importing the
Elasticsearch project into IntelliJ IDEA. Specifically:

  • Contributing documentation has been updated to reflect that the
    'idea' task should no long be used and Gradle project import is
    instead the officially supported way of setting up the project.
  • Attempts to run the 'idea' task will result in a failure with a
    message directing folks to our CONTRIBUTING.md document.
  • The project JDK is explicit set rather that using whatever JAVA_HOME is.
  • Gradle build operation delegation is disabled, and test execution is
    configured to 'choose per test'.
  • Gradle is configured to inherit the project JDK.
  • Some code style conventions are automatically configured.
  • File encoding is explicitly set to UTF-8.
  • Parallel module compilation is enabled and deprecated feature
    warnings are disabled.
  • A remote debug run configuration using listen mode is created.
  • JUnit runner is configured with required system properties.
  • License headers are configured such that Apache 2 is the default
    notice added to all source files with exception of source in /x-pack
    which will use the Elastic license.

Closes #46118

This commit makes a number of improvements when importing the
Elasticsearch project into IntelliJ IDEA. Specifically:

 - Contributing documentation has been updated to reflect that the
   'idea' task should no long be used and Gradle project import is
   instead the officially supported way of setting up the project.
 - Attempts to run the 'idea' task will result in a failure with a
   message directing folks to our CONTRIBUTING.md document.
 - The project JDK is explicit set rather that using whatever JAVA_HOME
   is.
 - Gradle build operation delegation is disabled, and test execution is
   configured to 'choose per test'.
 - Gradle is configured to inherit the project JDK.
 - Some code style conventions are automatically configured.
 - File encoding is explicitly set to UTF-8.
 - Parallel module compilation is enabled and deprecated feature
   warnings are disabled.
 - A remote debug run configuration using listen mode is created.
 - JUnit runner is configured with required system properties.
 - License headers are configured such that Apache 2 is the default
   notice added to all source files with exception of source in /x-pack
   which will use the Elastic license.
@mark-vieira mark-vieira added the :Delivery/Build Build or test infrastructure label Mar 18, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Build)

@mark-vieira
Copy link
Contributor Author

mark-vieira commented Mar 18, 2020

Subsequent to this PR I intend on updating our team docs as well as an explanatory email to @dev instructing folks to clean their workspaces and follow the new guidance on project import.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

This is great! I have one question.

gradle/ide.gradle Show resolved Hide resolved
Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

LGTM.

gradle/ide.gradle Outdated Show resolved Hide resolved
@pugnascotia
Copy link
Contributor

I checked out your branch and imported it as a fresh project in IntelliJ.

  • ✅ Created a new class outside x-pack. The Apache license header was inserted, as expected
  • ❌ Created a new class inside x-pack. It was created with the Apache license header instead of the Elastic license header.

Other:

  • Could we configure IntelliJ to use the Eclipse formatter and our bundled format config? The downside of this is that it relies on the "Eclipse Code Formatter" plugin, though I also noticed a thing in IntelliJ about "Required Plugins", under "Build, Execution, Deployment". I tried adding the Eclipse plugin, and it created the file .idea/externalDependencies.xml with the following content:
    <?xml version="1.0" encoding="UTF-8"?>
    <project version="4">
      <component name="ExternalDependencies">
        <plugin id="EclipseCodeFormatter" />
      </component>
    </project>
    Configuring the plugin created: .idea/eclipseCodeFormatter.xml with contents:
    <?xml version="1.0" encoding="UTF-8"?>
    <project version="4">
      <component name="EclipseCodeFormatterProjectSettings">
        <option name="projectSpecificProfile">
          <ProjectSpecificProfile>
            <option name="formatter" value="ECLIPSE" />
            <option name="pathToConfigFileJava" value="$PROJECT_DIR$/.eclipseformat.xml" />
            <option name="selectedJavaProfile" value="Elasticsearch" />
          </ProjectSpecificProfile>
        </option>
      </component>
    </project>
    It's also referenced in .idea/workspace.xml:
    <project>
      <component name="PropertiesComponent">
        <property name="settings.editor.selected.configurable" value="EclipseFormatter" />

@mark-vieira
Copy link
Contributor Author

❌ Created a new class inside x-pack. It was created with the Apache license header instead of the Elastic license header.

Where exactly? I'm not able to reproduce this locally. Perhaps there's some directory that's not betting matched by the imported scope.

@mark-vieira
Copy link
Contributor Author

Could we configure IntelliJ to use the Eclipse formatter and our bundled format config?

Perhaps, I didn't look into using the plugin. I initially tried this by just importing the XML config itself bu that generated a huge file in the global preferences directory which would have been a pain to keep up to date. Can you create a separate issue for this. I don't want to hold up merging this for folks while we work out the code style stuff. I'm more concerned about folks having project compilation issues associated with using ./gradlew idea.

@pugnascotia
Copy link
Contributor

Where exactly? I'm not able to reproduce this locally. Perhaps there's some directory that's not betting matched by the imported scope.

I literally just picked a random java file under x-pack somewhere and created another file alongside it. Did you try with a fresh location / checkout / worktree?

@jasontedor / @rjernst can you replicate, either successfully or otherwise?

@pugnascotia
Copy link
Contributor

I created #53812 for the formatting stuff.

@pugnascotia
Copy link
Contributor

I confirmed that commit 7eacee5 has fixed the license issue.

@mark-vieira
Copy link
Contributor Author

@elasticmachine test this please

@mark-vieira mark-vieira merged commit 2e617c3 into elastic:master Mar 19, 2020
@mark-vieira mark-vieira deleted the intellij-ide-improvements branch March 19, 2020 18:23
mark-vieira added a commit that referenced this pull request Mar 19, 2020
This commit makes a number of improvements when importing the
Elasticsearch project into IntelliJ IDEA. Specifically:

- Contributing documentation has been updated to reflect that the
  'idea' task should no long be used and Gradle project import is
  instead the officially supported way of setting up the project.
- Attempts to run the 'idea' task will result in a failure with a
  message directing folks to our CONTRIBUTING.md document.
- The project JDK is explicit set rather that using whatever JAVA_HOME
  is.
- Gradle build operation delegation is disabled, and test execution is
  configured to 'choose per test'.
- Gradle is configured to inherit the project JDK.
- Some code style conventions are automatically configured.
- File encoding is explicitly set to UTF-8.
- Parallel module compilation is enabled and deprecated feature
  warnings are disabled.
- A remote debug run configuration using listen mode is created.
- JUnit runner is configured with required system properties.
- License headers are configured such that Apache 2 is the default
  notice added to all source files with exception of source in /x-pack
  which will use the Elastic license.
mark-vieira added a commit that referenced this pull request Mar 19, 2020
This commit makes a number of improvements when importing the
Elasticsearch project into IntelliJ IDEA. Specifically:

- Contributing documentation has been updated to reflect that the
  'idea' task should no long be used and Gradle project import is
  instead the officially supported way of setting up the project.
- Attempts to run the 'idea' task will result in a failure with a
  message directing folks to our CONTRIBUTING.md document.
- The project JDK is explicit set rather that using whatever JAVA_HOME
  is.
- Gradle build operation delegation is disabled, and test execution is
  configured to 'choose per test'.
- Gradle is configured to inherit the project JDK.
- Some code style conventions are automatically configured.
- File encoding is explicitly set to UTF-8.
- Parallel module compilation is enabled and deprecated feature
  warnings are disabled.
- A remote debug run configuration using listen mode is created.
- JUnit runner is configured with required system properties.
- License headers are configured such that Apache 2 is the default
  notice added to all source files with exception of source in /x-pack
  which will use the Elastic license.
mark-vieira added a commit that referenced this pull request Mar 19, 2020
This commit makes a number of improvements when importing the
Elasticsearch project into IntelliJ IDEA. Specifically:

 - Contributing documentation has been updated to reflect that the
   'idea' task should no long be used and Gradle project import is
   instead the officially supported way of setting up the project.
 - Attempts to run the 'idea' task will result in a failure with a
   message directing folks to our CONTRIBUTING.md document.
 - The project JDK is explicit set rather that using whatever JAVA_HOME
   is.
 - Gradle build operation delegation is disabled, and test execution is
   configured to 'choose per test'.
 - Gradle is configured to inherit the project JDK.
 - Some code style conventions are automatically configured.
 - File encoding is explicitly set to UTF-8.
 - Parallel module compilation is enabled and deprecated feature
   warnings are disabled.
 - A remote debug run configuration using listen mode is created.
 - JUnit runner is configured with required system properties.
 - License headers are configured such that Apache 2 is the default
   notice added to all source files with exception of source in /x-pack
   which will use the Elastic license.

(cherry picked from commit 2e617c3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v6.8.9 v7.6.3 v7.7.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce intellij gradle - junit plugin
6 participants