Reorganize how we deal with shared JavaScript test examples

When IntelliJ IDEA imports WALA's Gradle configuration, it creates
what is calls a "module" for each sourceSet of each Gradle subproject.
In so doing, it automatically picks up the source and resource
directories used by each of these sourceSets.  Unfortunately, IntelliJ
IDEA does not allow multiple modules to share a single root directory
as their source or resource directories, and that's exactly what was
going on with the "example-src" subdirectory under
"com.ibm.wala.cast.js.test.data".

This revised Gradle configuration still has is copying the necessary
"example-src" resources to the appropriate locations for use as test
resources.  But IntelliJ IDEA no longer treats "example-src" as a root
directory for resources in the automatically-generated modules.  So
now we get along nicer with IntelliJ IDEA while keeping everything
working with Gradle as well.
This commit is contained in:
Ben Liblit 2018-07-08 18:17:06 -05:00
parent 3d9e4d23d8
commit 858148e91b
5 changed files with 23 additions and 17 deletions

View File

@ -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

View File

@ -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'
}

View File

@ -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'

View File

@ -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)

View File

@ -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'