From 3071de2d33ea94f9f74dfedd4695819c014aea11 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Sun, 22 Nov 2015 16:07:39 -0800 Subject: [PATCH] Build: Enforce that gradle idea was run before importing in intellij Due to how intellij imports gradle projects, the tasks which setup resources are not run. This means we must be sure to run gradle idea from the command line before importing into elasticsearch. This change adds a simple marker file to indicate we have run from the command line before importing. It won't help for new projects that add plugin metadata, but it will at least make sure the initial project is set up correctly. --- build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.gradle b/build.gradle index 614ff39be29..785db7ec0c4 100644 --- a/build.gradle +++ b/build.gradle @@ -169,6 +169,15 @@ idea { vcs = 'Git' } } +// Make sure gradle idea was run before running anything in intellij (including import). +File ideaMarker = new File(projectDir, '.local-idea-is-configured') +tasks.idea.doLast { + ideaMarker.setText('', 'UTF-8') +} +if (System.getProperty('idea.active') != null && ideaMarker.exists() == false) { + throw new GradleException('You must run gradle idea from the root of elasticsearch before importing into IntelliJ') +} + // eclipse configuration allprojects {