forked from SRI-CSL/do-like-javac
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge SRI Commits #22
Open
al3xliu
wants to merge
16
commits into
opprop:master
Choose a base branch
from
al3xliu:merge-commits
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
096063c
Support JDK 17 rather than JDK 16
mernst ec783a4
fix error related to zip files (#54)
kelloggm 18df446
reuses changes from python3 branch plus ... (#29)
hsanchez 65fac19
Only use ajava files produced in last iteration during WPI (#56)
kelloggm e722240
merge with updated master
kelloggm d5c9ce7
remove cruft
kelloggm a368d2f
remove all CF CI logic
kelloggm 5900dc7
Merge pull request #31 from kelloggm/merge-with-sri-csl
tim-mccarthy 269f7ba
Merge remote-tracking branch 'SRI/master' into merge-commits
al3xliu a1f0433
refine code
al3xliu 4ed0a77
remove duplicated import
al3xliu db2d25c
refine code
al3xliu 2587474
tests
al3xliu 21b559d
refine code
al3xliu 9c1160e
refine code
al3xliu 471ab13
refine code
al3xliu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
Extending DLJC | ||
================== | ||
|
||
## Supporting a new build system | ||
|
||
Create a new Python file in `do_like_javac/capture/` named after the build system you | ||
want to support. Start with this template: | ||
|
||
```python | ||
from . import generic | ||
|
||
supported_commands = [...] | ||
|
||
class MyCapture(generic.GenericCapture): | ||
def __init__(self, cmd, args): | ||
super(MyCapture, self).__init__(cmd, args) | ||
self.build_cmd = [...] | ||
|
||
def get_javac_commands(self, verbose_output): | ||
return [] | ||
|
||
get_target_jars(self, verbose_output): | ||
return [] | ||
|
||
def gen_instance(cmd, args): | ||
return MyCapture(cmd, args) | ||
``` | ||
|
||
Where supported\_commands is a list of commands that might be used to invoke the | ||
build system (e.g. "gradle", "gradlew", "ant", "maven"). | ||
|
||
For the constructor, cmd is a sys.argv style list containing the build command | ||
the user supplied at the command line. For example, if they wrote | ||
|
||
dljc -t print -- mybuildsystem -arg1 -arg2 -arg3 | ||
|
||
then cmd would contain `['mybuildsystem', '-arg1', '-arg2', '-arg3']`. You | ||
should set self.build_cmd to be a version of that command that invokes the build | ||
system with flags that give you the verbose output you'll need to parse the | ||
javac commands from. | ||
|
||
`args` is the argparse structure that dljc stores its own arguments in. You can | ||
find more details in `do_like_javac/arg.py`. | ||
|
||
Your job now is to implement `get_javac_commands` and optionally | ||
`get_target_jars`. verbose\_output contains a list of lines of output from | ||
running the build system. If your build system outputs entire javac commands | ||
on a single line, or if you can reconstitute the commands in their entirety, | ||
then there's a convenience method called `javac_parse` defined in the | ||
superclass, which expects a list of words in the command and produces the | ||
output you need. | ||
|
||
If not, the ouput format is a list of javac command dicts, which are of the | ||
form: | ||
|
||
```python | ||
{ | ||
'java_files': ['Foo.java', 'Bar.java', ...], | ||
'javac_switches': { | ||
# Switches have the - prefix removed. | ||
# Value is either the argument given to the switch, | ||
# or True for no-argument flags. | ||
'classpath': ..., | ||
... | ||
} | ||
} | ||
``` | ||
|
||
`get_target_jars` returns a list of paths to jar files output by the build. | ||
|
||
Finally, add your new module to the `capture_modules` list at the top of | ||
`do_like_javac/capture/__init__.py`. | ||
|
||
## Adding a new analysis tool | ||
|
||
Create a new Python file in `do_like_javac/tools/` named after the tool you | ||
want to add. Use this template: | ||
|
||
```python | ||
argparser = None | ||
|
||
def run(args, javac_commands, jars): | ||
print("My tool results.") | ||
``` | ||
|
||
`args` is the argparse structure created by DLJC. `argparser` is where you can | ||
plug in additional command line options you'd like to be available for your | ||
tool. You can see an example in `do_like_javac/tools/infer.py`. | ||
|
||
`javac_commands` and `jars` are the structures discussed above, consisting of | ||
the javac command used to build the project and the jar files generated (if | ||
that information is available). | ||
|
||
After augmenting `run()` to do what you want, add your tool to the `TOOLS` | ||
dictionary at the top of `do_like_javac/tools/__init__.py`, along with a | ||
`from . import mytoolname` statement. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
|
||
import os | ||
import re | ||
|
||
from . import generic | ||
|
||
supported_commands = ['mvn', 'mvnw'] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import os | ||
import copy | ||
import os | ||
|
||
from . import common | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is repeated again below. |
||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this adding an empty file? Why?