Commit Graph

5997 Commits

Author SHA1 Message Date
Ben Liblit 5d5fa18b5f Replace source directories rather than appending to them
I was confused about the differences among:

	srcDir 'foo'
	srcDirs ['foo']
	srcDirs = ['foo']

As it turns out, the first two append to the set of source
directories, while the last replaces this set entirely.  I generally
want replacement, since WALA's current directory layout never matches
Gradle's assumed defaults.
2018-04-18 11:29:25 -05:00
Ben Liblit 0704a66ab1 Cleaner way to form colon-deliminated search path from list of paths 2018-04-18 11:29:25 -05:00
Ben Liblit 0f69db6fe3 Cleaner approach to augmenting Javadoc classpath 2018-04-18 11:29:25 -05:00
Ben Liblit 01a4fe025e Start getting some unit tests to pass
The main requirement here is to arrange for the proper classpath
settings when tests are running so that they can find any associated
resources (i.e., other supporting files).
2018-04-18 11:29:25 -05:00
Ben Liblit 04d9397a1d Tweak classpath for some Javadoc build tasks
This comes up when the Javadoc comments refer to classes in other
subprojects that the corresponding Java code did not actually depend
upon.
2018-04-18 11:29:25 -05:00
Ben Liblit e52c8d981d Declare common library dependencies for source sets, not binaries
No sense repeating this for each binary when it's the same for all of
them.
2018-04-18 11:29:25 -05:00
Ben Liblit b9e712bfa9 Add a second native library and a native executable 2018-04-18 11:29:25 -05:00
Ben Liblit 43a482dfae Add Gradle logic for building a native library
This approach uses no external makefiles; it's pure Gradle.  Nice!
2018-04-18 11:29:25 -05:00
Ben Liblit 6007b11c3f Compile test code, but don't run it for now
The tests are currently broken due to some sort of problem using class
loaders to find supporting resources.  Until I figure this out, better
to have Travis-CI verify only the things we think work.
2018-04-18 11:29:25 -05:00
Ben Liblit 377d7586ef Consistently use simple sorted order for dependencies
This isn't even sorting by library or subproject name.  It's just a
dumb textual sort of the contents of each line.
2018-04-18 11:29:25 -05:00
Ben Liblit db2d34b60d Leave Gradle linter turned on by default, now that it's quieter 2018-04-18 11:29:25 -05:00
Ben Liblit afa982adf2 Properly distinguish main from test code, now that I know how 2018-04-18 11:29:25 -05:00
Ben Liblit a56a3616dc Selectively disable some Gradle linter rules
Specifically, we're not really in a position now to deal with
duplicated classes among our dependencies.  Maybe we can try harder to
examine those in the future, but for now they are a distraction from
other issues that we can attack more readily.
2018-04-18 11:29:25 -05:00
Ben Liblit 9cd5d2ba56 Split generic Java setup from OSGi substitution setup 2018-04-18 11:29:25 -05:00
Ben Liblit 1ca17e93be Automated Gradle-driven download of JLex test input 2018-04-18 11:29:25 -05:00
Ben Liblit 9664b1e5b3 Disable Javadoc linter for now
Some of the linter's checks produce failures (errors) when Gradle
builds the Javadoc documentation.  Fixing them isn't really a Gradle
issue, though, so I don't want to deal with them now.
2018-04-18 11:29:24 -05:00
Ben Liblit 18495ab44d Improve documentation for broad sections of top-level build script 2018-04-18 11:29:24 -05:00
Ben Liblit 9e905c7a04 More Gradle dependency clean-ups suggested by linter
Unfortunately the linter does not reach a fixpoint if you keep trying
to apply its suggestions.  If you include "compile
'org.eclipse.core:org.eclipse.core.runtime:3.10.0.v20140318-2214'" in
the dependencies for "com.ibm.wala.ide.jdt", then the linter tells you
that this dependency is unused and can be removed.  If you remove it,
then the linter tells you that it should be added.  Sigh.
2018-04-18 11:29:24 -05:00
Ben Liblit b3dbdd3357 Fix a tricky cross-subproject Javadoc dependency
By default, each subproject's Javadoc task depends on the same
subproject's Java compilation task, and uses the same classpath.
Thus, any classes that some Java code uses will also be visible when
building the same Java code's documentation.

In this case, we need to see one of the "com.ibm.wala.core" classes in
order to build the "com.ibm.wala.util" documentation.  However, we
cannot have Java compilation of "com.ibm.wala.util" depend on Java
compilation of "com.ibm.wala.core", because that would create a
dependency cycle.  So we need to add this as a special dependency just
for the "com.ibm.wala.util" documentation task, and add the
appropriate classpath as well.

I'm quite proud of myself for figuring out how to do this properly.
2018-04-18 11:29:24 -05:00
Ben Liblit ad60605fe8 In Travis-CI, test Maven and Gradle separately and concurrently
This should help identify cases where the Gradle build only works if
it runs before or after a Maven build.  It will also help us recognize
any Maven regressions accidentally introduced by our Gradle work.
2018-04-18 11:29:24 -05:00
Ben Liblit dec3b8f15b Add a Gradle linter to help me write clean build configurations
The linter does not run by default.  To activate it, use "./gradlew
autoLintGradle".
2018-04-18 11:29:24 -05:00
Ben Liblit 2ef04905c2 Additional explicit dependencies suggested by Gradle linter 2018-04-18 11:29:24 -05:00
Ben Liblit eac47334ca Automated Gradle-driven download of AJAXSLT test inputs
I'm not sure that I am doing this in the best way possible.  But it
seems to be working.  Refinements are welcome!
2018-04-18 11:29:24 -05:00
Ben Liblit 2716731357 Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit 209c1d25c6 Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit cd304237ea Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit 8e5415e3db Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit 25a52254f5 Add Gradle build script for a subproject that previously had none 2018-04-18 11:29:24 -05:00
Ben Liblit f41baeb0f8 Add a direct dependency that previously we picked up transitively 2018-04-18 11:29:24 -05:00
Ben Liblit cebf14c8c5 Run a Gradle build after the Maven build
Eventually I'll want to swap that order, so that we know that Gradle
builds work even without any help from Maven build setup logic.  For
now, though, I just want to test whether the Gradle build works at
all.
2018-04-18 11:29:24 -05:00
Ben Liblit 530d74929f Many improvements to Gradle build support, including within Eclipse 2018-04-18 11:29:24 -05:00
Sungho Lee ffaa2e4626 change hamcrest library version of core.tests 2018-04-18 11:29:24 -05:00
Sungho Lee b4fa7f425b Support the gradlew build 2018-04-18 11:29:24 -05:00
Sungho Lee 50d0f7ee71 Change build.gradle files for proper format and delete all tests 2018-04-18 11:29:24 -05:00
Sungho Lee 4a31927b00 Gradle build scripts 2018-04-18 11:29:24 -05:00
Ben Liblit 99c2493e37 Revert "Build WALA using Gradle instead of Maven" (#298) 2018-04-18 12:15:56 -04:00
Julian Dolby 8f41069b23
Merge pull request #278 from liblit/gradle-and-buildship
Build WALA using Gradle instead of Maven
2018-04-18 08:22:25 -04:00
Ben Liblit 6639d8b93a Bump version to 1.5.0-SNAPSHOT before merging with WALA master
This gives the WALA maintainers the option of doing future 1.4.5+
releases from of a pre-Gradle branch if these merged Gradle changes
turn out to be more disruptive than expected.
2018-04-17 15:32:01 -05:00
Ben Liblit 742cad58e9 Use Gradle to create selected Eclipse metadata before Maven builds
The Eclipse metadata files created in this way are not identical to
those that Buildship would create when importing into Eclipse.  The
tests in com.ibm.wala.cast.java.test.JDTJava15IRTests and
com.ibm.wala.cast.java.test.JDTJavaIRTests seem to pass using either
the Gradle-generated or the Buildship-generated versions.

As an aside, if you generate these files using Gradle first and *then*
import using Buildship, you end up with metadata that is identical to
what you would have had if you'd only imported with
Buildship.  (There's one irrelevant difference in an unimportant
"<comment>" element.)  So Maven's tests should run fine under any
wacky mix of Gradle- and Buildship-generated Eclipse metadata files.

That being said, I recommend not mixing build systems.  WALA can be
built using either Maven, Gradle, or Eclipse+Buildship, but you're
probably better off only using one of these in any given build tree.
A mixed tree *should* probably work, but I haven't tested it
thoroughly, and consider better to avoid doing.

Incidentally, if there are other Maven-preparation steps that we'd
like Gradle to automate for us, that can now be done easily by
creating more "prepareMavenBuild" Gradle tasks in other subprojects
and adding the appropriate dependencies.  For example, it would be
trivial to use this to automate downloading "/tmp/DroidBench",
installing the Android SDK, etc.
2018-04-17 15:02:36 -05:00
Julian Dolby 89ffb96acf more work on file names 2018-04-17 15:02:36 -05:00
Julian Dolby 1ba0082896 fixes for nodejs performance 2018-04-17 15:02:36 -05:00
Ben Liblit 563d7446d1 Tell Travis CI to be even more patient during initial p2AsMaven downloads 2018-04-17 15:02:36 -05:00
Ben Liblit 0290469ba7 Tell Travis CI to be more patient during initial p2AsMaven downloads 2018-04-17 15:02:36 -05:00
Ben Liblit 5df33f85d7 Simplify how we refer to the outputs of certain tasks 2018-04-17 15:02:36 -05:00
Ben Liblit 929fdb99af Exclude a test that has started failing due to running out of memory
I don't know what changes are triggering this.  Presumably it's
something to do with the temporary-file code, but I don't see why that
would happen.  For now, let's just skip this test.
2018-04-17 15:02:36 -05:00
Ben Liblit 7886fa13dc Don't put fixed-name, writable files into "java.io.tmpdir"
If multiple tests both write to "/tmp/cg.txt" (for example), then
these tests cannot safely run concurrently.  That never used to be a
problem with Maven, since our Maven tests were all strictly sequential
anyway.  But parallelized testing using Gradle requires that we do
better.  Fortunately, Java has perfectly reasonable APIs for
generating uniquely-named temporary files and directories.
2018-04-17 15:02:36 -05:00
Ben Liblit 6599d3d294 Don't use build cache (a.k.a. task output caching) under Travis CI
The performance improvement offered by the build cache is modest when
run by Travis CI.  This is probably because Travis CI does not keep
the cache on any local machine.  Instead, Travis CI uploads the build
cache across a network at the end of each run, then restores the cache
across the network at the start of the next run.  So in many cases
we're simply trading network access to original downloads for network
access to the cache image.

Furthermore, it's probably a better test to perform Travis CI testing
jobs from something closer to a clean slate.  We really want to know
whether everything builds and passes tests correctly starting from
nothing.  We don't want to risk accidentally thinking something would
work simply because we have a cached copy of what it did when it
worked previously.
2018-04-17 15:02:36 -05:00
Ben Liblit 93c8d126b8 Unpack Android SDK and install extra components as a single task
Previously we unpacked in one task, then installed two extra
components in two dependent tasks.  However, installing extra
components modifies some files in place, effectively making those
files both inputs and outputs.  That creates race conditions, and
probably interferes with task output caching.  Better, then, to treat
the unpack and extra installations all as a single task whose output
is the complete Android SDK tree with all required components
installed.
2018-04-17 15:02:36 -05:00
Ben Liblit b13e5d72b1 If tests fail, print full stack traces to aid debugging 2018-04-17 15:02:36 -05:00
Ben Liblit 9cbfff23f5 Enable both parallel builds and build output caching by default
This should give us a nice build-performance boost, both locally and
in Travis CI.  I've used parallel builds routinely for months now, and
they're working fine.  Build output caching is newer, but it also
seems to be working well and saves us tremendous time on downloads.
2018-04-17 15:02:36 -05:00