Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.77 KB

README.md

File metadata and controls

50 lines (39 loc) · 1.77 KB

Jess

Jess is a tool that enables a targeted compilation of Java programs. By doing so, it provides the abillity to compile specific areas of interest of a program without the need to invoke build scripts, even when only part of its code base is available.

Installation

To install Jess you just have to invoke mvn install.

Usage

Jess can be programmaticaly invoked from a Java application in the following way:

  1. Create a Jess configuration
boolean exitOnCompilationFail = false;
boolean exitOnParsingFail = false;
boolean looseSignatureMatching = true; // if true one only needs to specify parameter types, not names
boolean keepAsteriskImports = true;
boolean failOnAmbiguity = false;
boolean disableStubbing = false;

JessConfiguration config = new JessConfiguration(exitOnCompilationFail, exitOnParsingFail, 
    looseSignatureMatching, keepAsteriskImports, failOnAmbiguity, disableStubbing);
  1. Point to Java project for compilation via Jess
String projectPath = "path/to/project";
Set<String> packages = PackageFinder.findPackageRoots(projectPath);
Set<String> jars = Collections.emptyList(); // can specify additional JAR-files here
  1. Create a Jess instance and point to target file
Jess jess = new Jess(config, packages, jars);
  1. Specify targets for compilation
String targetFile = "org/example/Target.java";
List<String> targetMethods = Collections.singletonList("method(String, String, boolean)")";
List<String> targetClinit = Collections.emptyList(); // static fields/initializers
List<String> targetInit = Collections.emptyList(); // non-static fields/initializers
  1. Start targeted compilation
jess.preSlice(targetClass, targetMethods, targetClinit, targetInit);
int compilationResult = jess.parse(targetClass);