diff --git a/.idea/.gitignore b/.idea/.gitignore
index 72de84271..65f86d623 100644
--- a/.idea/.gitignore
+++ b/.idea/.gitignore
@@ -1,3 +1,6 @@
-/gradle.xml
-/modules
+*.iml
+/libraries/*.xml
+/modules.xml
+/tasks.xml
+/usage.statistics.xml
/workspace.xml
diff --git a/.idea/.name b/.idea/.name
deleted file mode 100644
index f15c23b30..000000000
--- a/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.wala
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 000000000..147050681
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/After_Opening_Pristine_Project.xml b/.idea/runConfigurations/After_Opening_Pristine_Project.xml
new file mode 100644
index 000000000..c3277521c
--- /dev/null
+++ b/.idea/runConfigurations/After_Opening_Pristine_Project.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 94a25f7f4..35eb1ddfb 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/README-Gradle.md b/README-Gradle.md
index ab712a9eb..e2f26e400 100644
--- a/README-Gradle.md
+++ b/README-Gradle.md
@@ -141,6 +141,63 @@ plugin](https://docs.gradle.org/current/userguide/eclipse_plugin.html).
A few WALA sub-projects already use this: look for `eclipse.project`
in `*/build.gradle` for examples.
+## IntelliJ IDEA
+
+### Opening WALA in IntelliJ IDEA
+
+WALA comes preconfigured as an openable IntelliJ IDEA project. Open
+the top-level WALA directory as a project; it should have a
+distinctive badge on its folder icon marking it as a directory
+containing a recognized IntelliJ IDEA project. Do *not* open the
+top-level WALA `build.gradle` in that directory as a project: this
+will begin an “Import Project from Gradle” process that is *not* the
+recommended way to bring WALA up in IntelliJ IDEA.
+
+The first time you open the WALA project, IntelliJ IDEA will
+synchronize its project model with the Gradle build configuration,
+including downloading some large supporting libraries. After the
+lengthy import process completes, **use “Run → Run… → After Opening
+Pristine Project” to perform some post-import configuration.** This
+also can take tens of minutes, but is only necessary in a clean,
+never-previously-built tree. Immediately after importing, you may see
+some Java compilation errors in the IntelliJ IDEA “Messages” view.
+These should all go away after running the “After Opening Pristine
+Project” step. [Be
+patient](#external-dependencies-patience-is-a-virtue) during the
+initial project open and also during the “After Opening Pristine
+Project” step, especially if you have a slow network connection.
+
+If you prefer a non-interactive approach, instead of using “After
+Opening Pristine Project” you can run `./gradlew prepareIntelliJIDEA`
+either before or after opening WALA in IntelliJ IDEA.
+
+### Benign Warning About Non-Managed Maven Project
+
+Each time you open the WALA project, IntelliJ IDEA may report
+“Non-managed pom.xml file found” in its event log. This arises
+because WALA supports both Gradle and Maven, but WALA in IntelliJ IDEA
+needs only the Gradle configuration. You can safely ignore this
+notification, permanently disable it using the offered “Disable
+notification” link, or even disable the IntelliJ IDEA Maven plugin
+entirely if you have no other need for it.
+
+### Project Configuration as Derived Model
+
+IntelliJ IDEA automatically derives its project models from the Gradle
+build configuration, including all information about both internal and
+external build dependencies. However, this synchronization only goes
+in one direction: from Gradle to IntelliJ IDEA, not from IntelliJ IDEA
+back into Gradle. If you manipulate the project structure using the
+IntelliJ IDEA’s user interface, your changes will likely be
+overwritten the next time IntelliJ IDEA scans the Gradle build
+configuration.
+
+This particularly applies to settings found in the “Modules” and
+“Libraries” sections of the “Project Structure” dialog. The right way
+to change module and library settings is to change the Gradle
+configuration such that the *derived* IntelliJ IDEA model is what you
+want it to be.
+
## Gradle Command Line
You do not need to install Gradle separately. **WALA includes its own
diff --git a/build.gradle b/build.gradle
index ff076f589..50fc956e0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -57,7 +57,6 @@ version '1.5.0-SNAPSHOT'
subprojects { subproject ->
// skip generic Java setup for the few projects that have no Java code whatsoever
switch (subproject.name) {
- case 'com.ibm.wala.cast.js.test.data':
case 'com.ibm.wala-repository':
case ~/.*_feature/:
return
@@ -79,6 +78,7 @@ subprojects { subproject ->
jar.manifest.from('META-INF/MANIFEST.MF')
task afterEclipseBuildshipImport(dependsOn: processTestResources)
+ task prepareIntelliJIDEA
test {
include '**/*Test.class'
diff --git a/com.ibm.wala.cast.js.html.nu_validator/build.gradle b/com.ibm.wala.cast.js.html.nu_validator/build.gradle
index aa1a76da1..08fc0b6b8 100644
--- a/com.ibm.wala.cast.js.html.nu_validator/build.gradle
+++ b/com.ibm.wala.cast.js.html.nu_validator/build.gradle
@@ -1,9 +1,6 @@
sourceSets {
main.java.srcDirs = ['src']
- test {
- java.srcDirs = ['tests']
- resources.srcDirs = [project(':com.ibm.wala.cast.js.test.data').file('examples-src')]
- }
+ test.java.srcDirs = ['tests']
}
dependencies {
@@ -21,6 +18,12 @@ dependencies {
)
}
+processTestResources {
+ def data = project(':com.ibm.wala.cast.js.test.data')
+ dependsOn data.processTestResources
+ from data.sourceSets.test.resources
+}
+
test {
maxHeapSize = '800M'
}
diff --git a/com.ibm.wala.cast.js.rhino.test/build.gradle b/com.ibm.wala.cast.js.rhino.test/build.gradle
index 44c9f1677..21ad888b3 100644
--- a/com.ibm.wala.cast.js.rhino.test/build.gradle
+++ b/com.ibm.wala.cast.js.rhino.test/build.gradle
@@ -2,10 +2,7 @@ plugins {
id 'com.github.hauner.jarTest'
}
-sourceSets.test {
- java.srcDirs = ['harness-src']
- resources.srcDirs = [project(':com.ibm.wala.cast.js.test.data').file('examples-src')]
-}
+sourceSets.test.java.srcDirs = ['harness-src']
dependencies {
testCompile(
@@ -22,6 +19,12 @@ dependencies {
)
}
+processTestResources {
+ def data = project(':com.ibm.wala.cast.js.test.data')
+ dependsOn data.processTestResources
+ from data.sourceSets.test.resources
+}
+
test {
environment 'TRAVIS', 1
maxHeapSize = '800M'
diff --git a/com.ibm.wala.cast.js.test.data/.settings/org.eclipse.jdt.core.prefs b/com.ibm.wala.cast.js.test.data/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..35068d95f
--- /dev/null
+++ b/com.ibm.wala.cast.js.test.data/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/com.ibm.wala.cast.js.test.data/build.gradle b/com.ibm.wala.cast.js.test.data/build.gradle
index 0f3d1ad90..89232a1e8 100644
--- a/com.ibm.wala.cast.js.test.data/build.gradle
+++ b/com.ibm.wala.cast.js.test.data/build.gradle
@@ -1,6 +1,4 @@
-plugins {
- id 'base'
-}
+sourceSets.test.resources.srcDirs = ['examples-src']
task downloadAjaxslt(type: VerifiedDownload) {
def version = '0.8.1'
@@ -21,3 +19,5 @@ task unpackAjaxslt(type: Sync, dependsOn: downloadAjaxslt) {
}
clean.dependsOn cleanUnpackAjaxslt
+
+processTestResources.dependsOn(unpackAjaxslt)
diff --git a/com.ibm.wala.cast.js.test/build.gradle b/com.ibm.wala.cast.js.test/build.gradle
index 350c43d03..37007296f 100644
--- a/com.ibm.wala.cast.js.test/build.gradle
+++ b/com.ibm.wala.cast.js.test/build.gradle
@@ -2,10 +2,7 @@ plugins {
id 'com.github.hauner.jarTest'
}
-sourceSets.test {
- java.srcDirs = ['harness-src']
- resources.srcDirs = [project(':com.ibm.wala.cast.js.test.data').file('examples-src')]
-}
+sourceSets.test.java.srcDirs = ['harness-src']
dependencies {
testCompile(
@@ -21,7 +18,11 @@ dependencies {
)
}
-processTestResources.dependsOn ':com.ibm.wala.cast.js.test.data:unpackAjaxslt'
+processTestResources {
+ def data = project(':com.ibm.wala.cast.js.test.data')
+ dependsOn data.processTestResources
+ from data.sourceSets.test.resources
+}
test {
maxHeapSize = '800M'
diff --git a/com.ibm.wala.cast.test/build.gradle b/com.ibm.wala.cast.test/build.gradle
index b570fb2d0..0ce96cbc5 100644
--- a/com.ibm.wala.cast.test/build.gradle
+++ b/com.ibm.wala.cast.test/build.gradle
@@ -6,6 +6,7 @@ plugins {
}
eclipse.project.natures 'org.eclipse.pde.PluginNature'
+prepareIntelliJIDEA.dependsOn jarTest
sourceSets.test.java.srcDirs = ['harness-src/java']
diff --git a/com.ibm.wala.dalvik.test/build.gradle b/com.ibm.wala.dalvik.test/build.gradle
index edc5a89a2..8aacf1445 100644
--- a/com.ibm.wala.dalvik.test/build.gradle
+++ b/com.ibm.wala.dalvik.test/build.gradle
@@ -93,6 +93,7 @@ clean.dependsOn cleanCopyDxJar
compileTestJava.dependsOn copyDxJar
afterEclipseBuildshipImport.dependsOn copyDxJar
+prepareIntelliJIDEA.dependsOn copyDxJar
task copyAndroidJar(type: Sync, dependsOn: installAndroidSdk) {
from "${installAndroidSdk.destinationDir}/platforms/${installAndroidSdk.components['platforms']}/android.jar"