|
7 | 7 | import liquidjava.processor.RefinementProcessor; |
8 | 8 | import spoon.Launcher; |
9 | 9 | import spoon.processing.ProcessingManager; |
10 | | -import spoon.reflect.declaration.CtPackage; |
11 | 10 | import spoon.reflect.factory.Factory; |
12 | 11 | import spoon.support.QueueProcessingManager; |
13 | 12 |
|
14 | 13 | public class CommandLineLauncher { |
15 | 14 | public static void main(String[] args) { |
16 | | - String allPath = "./liquidjava-example/src/main/java/test/currentlyTesting"; |
17 | | - |
18 | 15 | // String allPath = "C://Regen/test-projects/src/Main.java"; |
19 | 16 | // In eclipse only needed this:"../liquidjava-example/src/main/java/" |
20 | 17 | // In VSCode needs: |
21 | 18 | // "../liquidjava/liquidjava-umbrella/liquidjava-example/src/main/java/liquidjava/test/project"; |
22 | | - List<String> files = args.length == 0 ? Arrays.asList(allPath) : Arrays.asList(args); |
| 19 | + |
| 20 | + if (args.length == 0) { |
| 21 | + System.out.println("No input files or directories provided"); |
| 22 | + System.out.println("\nUsage: ./liquidjava <...paths>"); |
| 23 | + System.out.println(" <...paths>: Paths to files or directories to be verified by LiquidJava"); |
| 24 | + System.out.println("\nExample: ./liquidjava liquidjava-example/src/main/java/test/currentlyTesting liquidjava-example/src/main/java/testingInProgress/Account.java"); |
| 25 | + return; |
| 26 | + } |
| 27 | + List<String> files = Arrays.asList(args); |
23 | 28 | ErrorEmitter ee = launch(files.toArray(new String[0])); |
24 | 29 | System.out.println(ee.foundError() ? (ee.getFullMessage()) : ("Correct! Passed Verification.")); |
25 | 30 | } |
26 | 31 |
|
| 32 | + /** |
| 33 | + * Launch the LiquidJava verifier on the given file (for testing purposes) |
| 34 | + * @param file Path to the file to be verified |
| 35 | + * @return ErrorEmitter containing any errors found during verification |
| 36 | + */ |
27 | 37 | public static ErrorEmitter launchTest(String file) { |
28 | 38 | ErrorEmitter ee = launch(file); |
29 | 39 | return ee; |
30 | 40 | } |
31 | 41 |
|
| 42 | + /** |
| 43 | + * Launch the LiquidJava verifier on the given files |
| 44 | + * @param files Array of file paths to be verified |
| 45 | + * @return ErrorEmitter containing any errors found during verification |
| 46 | + */ |
32 | 47 | public static ErrorEmitter launch(String... files) { |
33 | | - System.out.println("Running LiquidJava on: " + Arrays.toString(files)); |
| 48 | + System.out.println("Running LiquidJava on: " + Arrays.toString(files).replaceAll("[\\[\\]]", "")); |
34 | 49 | Launcher launcher = new Launcher(); |
35 | 50 | for (String file : files) { |
36 | 51 | launcher.addInputResource(file); |
|
0 commit comments