Bug 1123416 - Part 3: Limit IntelliJ objdir indexing. r=sebastian
authorNick Alexander <nalexander@mozilla.com>
Tue, 20 Oct 2015 15:30:44 -0700
changeset 268855 d8bf6eec26273b90f2a92c6d1e7a967ede086c2b
parent 268854 fe2090d75defeed0132976b20b2f9d31a9d073eb
child 268856 ef1e7dec5bad489be4556a10344626adefffc38d
push id15804
push usernalexander@mozilla.com
push dateThu, 22 Oct 2015 02:21:45 +0000
treeherderfx-team@9b249dc7978b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1123416
milestone44.0a1
Bug 1123416 - Part 3: Limit IntelliJ objdir indexing. r=sebastian IntelliJ's exclusion mechanism (for Gradle-based projects) is not very flexible; we get just idea.module.excludeDirs. This patch crawls the file system to skip what we can.
build.gradle
--- a/build.gradle
+++ b/build.gradle
@@ -91,12 +91,37 @@ afterEvaluate {
 }
 
 apply plugin: 'idea'
 
 idea {
     project {
         languageLevel = '1.7'
     }
+
+    module {
+        // Object directories take a huge amount of time for IntelliJ to index.
+        // Exclude them.  Convention is that object directories start with obj.
+        // IntelliJ is clever and will not exclude the parts of the object
+        // directory that are referenced, if there are any.
+        def topsrcdirURI = file(topsrcdir).toURI()
+        excludeDirs += files(file(topsrcdir)
+            .listFiles({it.isDirectory()} as FileFilter)
+            .collect({topsrcdirURI.relativize(it.toURI()).toString()}) // Relative paths.
+            .findAll({it.startsWith('obj')}))
+
+        // If topobjdir is below topsrcdir, hide only some portions of that tree.
+        def topobjdirURI = file(topobjdir).toURI()
+        if (!topsrcdirURI.relativize(topobjdirURI).isAbsolute()) {
+            excludeDirs -= file(topobjdir)
+            excludeDirs += files(file(topobjdir).listFiles())
+            excludeDirs -= file("${topobjdir}/gradle")
+            excludeDirs -= file("${topobjdir}/mobile")
+        }
+
+        if (!mozconfig.substs.MOZ_INSTALL_TRACKING) {
+            excludeDirs += file("${topsrcdir}/mobile/android/thirdparty/com/adjust")
+        }
+    }
 }
 
 task wrapper(type: Wrapper) {
 }