Commit Graph

5875 Commits

Author SHA1 Message Date
Ben Liblit 8edfd285d7 Turn off a Gradle warning about Gradle 5.0 incompatibility
The issue here is a planned change to how "publishing" blocks work.
Per
<https://docs.gradle.org/4.9/userguide/publishing_maven.html#publishing_maven:deferred_configuration>,
the right way to prepare for this change is to enable it and check for
unexpected changes in what gets published to a local repository.  I
have done this, and find no unexpected changes.

So we are actually ready for Gradle 5.0; the warning is a false
positive for us.  Leaving the future change enabled means we won't
keep seeing this warning.  It also means that any further changes to
our use of "publishing" will be tested under that future change, which
is a good way to avoid surprises later.
2018-07-22 02:42:54 +02:00
Leo Li d15f49bd90 Add install_name when build libcast on macos. (#332)
Gradle won't pass absolute path when build libcast. We need to set install_name manually otherwise `dyld` would not able to find libcast at runtime.

This is only needed on macos since `ld` will look up all runtime search path automatically.
2018-07-22 02:42:19 +02:00
Ben Liblit bc3ea1a777 Fix a spelling error in a comment 2018-07-20 08:44:23 +02:00
Ben Liblit 2b2483abd6 Avoid dereferencing null if no C/C++ compiler is present
Fixes #328, which requested better diagnostic messages in the case of
a missing C/C++ compiler toolchain.  Gradle actually has perfectly
good, informative messages in that case.  Unfortunately, we were
killing the build by dereferencing null before Gradle had a chance to
explain.  Now we bail out of some setup work early to avoid the null
dereference, thereby letting Gradle explain things properly.
2018-07-20 08:44:23 +02:00
Ben Liblit 10d3adf324 Retry download task if the destination file is missing
Under some circumstances, Gradle seems to decide that the destination
file being absent is the download task's expected outcome.  It caches
this state, and refuses to retry the download in the future since it
thinks the task is up-to-date.  We can correct this by telling Gradle
that the task should not be considered up-to-date if the file is
missing, as recommended by
<https://discuss.gradle.org/t/task-up-to-date-but-outputfile-not-created/17568/2>.
2018-07-20 08:44:23 +02:00
Ben Liblit 0510c914bb Update Gradle wrapper to release 4.9
Gradle 4.9 has no new features of particular interest to us.  It's
good to stay up-to-date, though.
2018-07-20 08:44:23 +02:00
Ben Liblit 72e9ba31f8 Use more complete Gradle package for better IDE support
In particular, using the "all" package (which includes source) allows
IntelliJ IDEA to provide autocompletion and other nice features that
are unavailable when using the "bin" package.
2018-07-20 08:44:23 +02:00
Ben Liblit c242f6126c Publish all generated Java bytecode jar archives
Previously we were only publishing source archives.  This fixes
wala/WALA#326 if I got everything right on the first try.  More likely
is that we will need a few rounds of revision before it's all doing
what it should.  For example, we may need to customize aspects of the
Gradle-generated "*.pom" files as described at
<https://docs.gradle.org/current/userguide/publishing_maven.html#sec:identity_values_in_the_generated_pom>
and
<https://docs.gradle.org/current/userguide/publishing_maven.html#sec:modifying_the_generated_pom>.
2018-07-19 22:23:14 +02:00
Manu Sridharan 2b1d82d1bb Expand missing super test 2018-07-19 18:17:59 +02:00
Manu Sridharan a78af3f67e
Add API to add an InputStream for a jar to an AnalysisScope (#330)
This is useful, e.g., if you have the bytes of a jar file in memory and want to load it into an `AnalysisScope`.
2018-07-19 17:01:51 +02:00
Manu Sridharan aeb17dfca4
Allow for classes with missing superclasses in class hierarchy (#329)
Fixes #322 

We add an option `createPhantomSuperclasses` to `ClassHierarchy`.  When set, if a superclass is missing, we create a new `PhantomClass` in its place and allow the subclass to be added.

To use, you can create the `ClassHierarchy` with the new `ClassHierarchyFactory.makeWithPhantom` methods.
2018-07-19 16:10:35 +02:00
Julian Dolby 5edf49254c ore meta data 2018-07-19 14:02:04 +02:00
Julian Dolby fc261b6ee7 mata data 2018-07-19 13:51:06 +02:00
Julian Dolby 6e6b29339c latest dexlib 2018-07-19 12:45:17 +02:00
Julian Dolby 1bbca5a222 Merge branch 'master' of github.com:wala/WALA 2018-07-15 12:41:25 +02:00
Julian Dolby c5f812d784 fix script for python 3 2018-07-15 12:41:18 +02:00
Ben Liblit 1ac4ca9475 Tweaks and instructions for WALA as an IntelliJ IDEA project
We already had some IntelliJ IDEA project metadata files in ".idea".
I've revisited and updated those now that I have more experience with
Gradle + IntelliJ IDEA + Git.  I think this now represents a better
set of decisions regarding what does and does not belong in version
control.

This commit also extends "README-Gradle.md" with clear instructions on
how to bringup WALA as a top-level IntelliJ IDEA project.  The
instructions are of a similar flavor to the Eclipse instructions that
were already present, though the details vary.  Most notably, with
IntelliJ IDEA you should *open* WALA as an existing project,
not *import* it as a new Gradle project derived from "build.gradle".
This is exactly the reverse of what one should and shouldn't do for
WALA in Eclipse.
2018-07-12 14:52:13 -07:00
Julian Dolby ed59197ae3
Merge pull request #325 from liblit/miscellaneous-ide-updates
Miscellaneous IDE updates
2018-07-12 12:57:40 -04:00
Ben Liblit 858148e91b 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.
2018-07-11 16:13:05 -05:00
Ben Liblit 3d9e4d23d8 Add helper task for extra setup after opening in IntelliJ IDEA
This task serves a similar role to the "afterEclipseBuildshipImport"
task used with Eclipse.  It should only be necessary to build this
task once:  in a freshly checked-out tree, just after opening it for
the first time in IntelliJ IDEA.

Ideally this extra setup task would be triggered automatically using
the "Tasks Activation" feature of IntelliJ IDEA's Gradle support.
Unfortunately, "Tasks Activation" settings are recorded in
".idea/workspace.xml", which is used for non-revision-tracked personal
settings.
2018-07-11 15:13:39 -05:00
Ben Liblit 7c2189849f Add a stub JDT preferences file, originally created by Buildship 2018-07-11 15:11:44 -05:00
Julian Dolby dc47e1da98 add default methods to instruction visitors
relax dump api
2018-07-10 21:53:48 -04:00
Julian Dolby ef89dc5345 a little tolerance for sloppy models 2018-07-04 15:46:06 -04:00
Julian Dolby bc0309b5ba Merge branch 'master' of github.com:wala/WALA 2018-06-27 14:58:10 -04:00
Julian Dolby fe1247f2ce switch to rhino 1.7.10 2018-06-27 14:57:35 -04:00
Ben Liblit 6be7a1a8a2 Have Travis CI periodically try to build each subproject separately
If Gradle dependencies are set up correctly, then it should be
possible to build any subproject starting with a pristine tree.
These take too long to use for every commit, pull request, etc.  But
running an extensive test like this periodically (e.g., weekly) seems
reasonable.
2018-06-26 09:19:02 -07:00
Ben Liblit 36320a078c Upgrade Gradle wrapper to release 4.8.1
No significant changes in this release that affect us, but it's good
to stay up-to-date.
2018-06-26 08:31:59 -07:00
Julian Dolby 0752bf321c Merge branch 'master' of github.com:wala/WALA 2018-06-22 21:49:06 -04:00
Julian Dolby 37eea27f4a more support for out-of-order lexical declarations 2018-06-22 19:49:49 -04:00
Julian Dolby 4de0ed876d remove overly conservative assertion 2018-06-22 07:26:38 -04:00
Julian Dolby af639ec654
Merge pull request #319 from liblit/minor-tidying-up
Minor tidying up
2018-06-10 22:01:03 -04:00
Ben Liblit bc86a27e85 Remove a subproject ".gitignore" whose patterns no longer apply
Perhaps files once existed here that matched the given exclusion
patterns, but there are certainly no such files here now.
2018-06-09 18:46:11 -05:00
Ben Liblit 2fcd079fe2 Anchor many ignore patterns that only apply at the topmost level 2018-06-09 18:46:11 -05:00
Ben Liblit ddeb2bd8ab Ignore a Visual Studio Code settings file
The settings I am seeing in here so far seem like per-developer
preferences, not shared per-project configuration information.
2018-06-09 18:46:11 -05:00
Ben Liblit c4f127f371 Subproject "com.ibm.wala.cast.js.test.data" contains no Java code 2018-06-09 18:46:11 -05:00
Julian Dolby b1b09684bd
Merge pull request #317 from liblit/future-java-compatibility-fixes
Future Java compatibility fixes
2018-06-06 12:52:51 -04:00
Ben Liblit 5336a08af2 Avoid using deprecated boxing constructors
Boxing a primitive using the constructor ("new Integer(4)") always
creates a distinct new boxed instance.  That's rarely what you need,
and in fact all of those constructors have been deprecated in Java 9.
Using the static "valueOf" method instead ("Integer.valueOf(4)") can
give better performance by reusing existing instances.  You no longer
get a unique boxed object, but generally that's OK.
2018-06-05 14:44:59 -05:00
Julian Dolby 9aed4e058d more tracking of sourse positions for function parameters 2018-06-05 15:00:31 -04:00
Ben Liblit 32e105a3c0 Skip a specific test if offline; this test requires network access 2018-06-04 12:29:57 -05:00
Ben Liblit 5cf8b7efe3 Stop using deprecated "javah" to generate JNI headers
"javah" was deprecated in Java 9, and has been removed entirely in
Java 10.  The right way to generate headers now is by using the "-h"
flag to "javac".  When "javac" is run in this way, it still generates
bytecode too.  So ideally, we'd run "javac" just once to generate
bytecode and headers simultaneously.  Fortunately, the Gradle JNI
plugin at <https://github.com/wpilibsuite/gradle-jni> help us do this
cleanly.  Nice!
2018-06-04 12:29:57 -05:00
Ben Liblit 85651608e9 Don't use interpolated strings unless actually needed 2018-06-04 12:28:42 -05:00
Ben Liblit 6679262707 Refactor linker logic, and add "smoke_main" to automated tests
Previously we were compiling and linking "smoke_main", but not
actually running it as part of automated testing.  I simply overlooked
this in the process of recreating the Maven build logic in Gradle.
Now we run "smoke_main" when testing, which turns out to be a pretty
good test of our management of both Java search paths as well as
linker / shared library search paths.
2018-06-04 12:28:42 -05:00
Ben Liblit fbac524a02 Find JVM shared library better across versions and operating systems
We now use "-rpath" on both Linux and macOS.  This linker flag sets
the ELF RPATH on Linux, and the "@rpath" attribute on macOS, but
effectively it's doing the same thing, and that same thing is exactly
what we want.  I think.

On Linux, we also now look for the JVM shared library in three
different places.  The library has moved between Java 8 and 9, and
even on Java 9 it goes in a different place on Fedora 28 versus Ubuntu
16.04.
2018-06-04 12:28:42 -05:00
Ben Liblit 24151e7422 Don't specify Java version; defaults to whatever JVM is being used 2018-06-04 12:28:42 -05:00
Ben Liblit c7344e611a Remove TODO comment about producing native components for test only
According to
<https://docs.gradle.org/current/userguide/native_software.html>,
"When you assemble dependents of a component, the component and all of
its dependents are compiled and linked, including any test suite
binaries."  So it's intentional that the "assemble" task causes
creation of the smoke_main executable and xlator_test shared library.
Nothing TODO here; the current behavior is as designed.
2018-06-04 12:28:42 -05:00
Ben Liblit 2067d6c37a Open up some more vertical white space 2018-06-04 12:28:42 -05:00
Ben Liblit 989ef3ec43 Help Java 9 with some tricky generics type inference
The existing code worked fine under Java 8, but Java 9 fails to
resolve type constraints unless it has more explicit information about
at least one of the arguments to anyOf.  Weird.
2018-06-04 12:28:42 -05:00
Julian Dolby d2852beebf
Merge pull request #312 from liblit/gradle-load-plugins-modernization
Load Gradle plugins using “plugins” closure rather than “apply plugin”
2018-06-04 12:22:33 -04:00
Julian Dolby d1840f0531 make slicer handle multiple languages, using the Language to build mod and ref visitors 2018-06-01 13:56:08 -04:00
Julian Dolby 196f7cb153 fix for nasty bug in decoding dup2_x2 2018-05-31 19:32:02 -04:00