You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2019/08/19 00:24:31 UTC

[lucene-solr] branch jira/SOLR-13452_gradle_5 updated: Fill IDEA setup script.

This is an automated email from the ASF dual-hosted git repository.

tomoko pushed a commit to branch jira/SOLR-13452_gradle_5
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/jira/SOLR-13452_gradle_5 by this push:
     new da36544  Fill IDEA setup script.
da36544 is described below

commit da3654411aca3b9b74b1845f90c03de2e7dc6594
Author: Tomoko Uchida <to...@apache.org>
AuthorDate: Mon Aug 19 09:23:50 2019 +0900

    Fill IDEA setup script.
---
 buildSrc/ide/idea.gradle | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/buildSrc/ide/idea.gradle b/buildSrc/ide/idea.gradle
index 9da3ca8..04bcdd7 100644
--- a/buildSrc/ide/idea.gradle
+++ b/buildSrc/ide/idea.gradle
@@ -15,6 +15,59 @@
  * limitations under the License.
  */
 
+def rootProjectDir = project.rootProject.projectDir
+def projectDir = project.projectDir
+
 idea {
+    module {
+
+        iml.beforeMerged {
+            // copy IDEA configuration / template files
+            if (projectDir.name == "buildSrc") {
+                copy {
+                    from file("${rootProjectDir}/dev-tools/idea/.idea")
+                    into file("${rootProjectDir}/.idea")
+                }
+                copy {
+                    from file("${rootProjectDir}/dev-tools/idea/parent.iml")
+                    into file("${rootProjectDir}")
+                }
+                copy {
+                    from file("${rootProjectDir}/dev-tools/idea/dev-tools/scripts")
+                    into file("${rootProjectDir}/dev-tools/scripts")
+                }
+            } else {
+                copy {
+                    def tmplPath = projectDir.canonicalPath.replaceFirst(rootProjectDir.canonicalPath, "")
+                    from file("${rootProjectDir}/dev-tools/idea${tmplPath}")
+                    into file("${projectDir}")
+                }
+            }
+        }
+
+        iml.whenMerged {
+            // if .iml exists, fix module name
+            def imlFiles = fileTree(dir: ".", include: "*.iml").files.name
+            if (!imlFiles.isEmpty()) {
+                def imlFile = imlFiles.get(0)
+                name = imlFile.substring(0, imlFile.length() - 4)
+            }
+        }
+    }
 
 }
+
+
+task cleanUpCustomConfig() {
+    doLast {
+        if (projectDir.name == "buildSrc") {
+            delete file("${rootProjectDir}/.idea")
+            delete file("${rootProjectDir}/parent.iml")
+            delete file("${rootProjectDir}/dev-tools/scripts/scripts.iml")
+        } else {
+            delete fileTree(".") { include "**/*.iml" }
+        }
+    }
+}
+
+tasks.cleanIdea.dependsOn cleanUpCustomConfig