90 " }\n" + 91 " }\n" + 92 "}"; 93 94 private static final String testClass = "class Test { }"; 95 96 void initialization(Path base) throws Exception { 97 moduleSrc = base.resolve("plugin_mods_src"); 98 Path pluginMod1 = moduleSrc.resolve("pluginMod1"); 99 100 processorCompiledModules = base.resolve("mods"); 101 102 Files.createDirectories(processorCompiledModules); 103 104 tb.writeJavaFiles( 105 pluginMod1, 106 pluginModule1, 107 plugin1); 108 109 String log = new JavacTask(tb) 110 .options("-modulesourcepath", moduleSrc.toString()) 111 .outdir(processorCompiledModules) 112 .files(findJavaFiles(moduleSrc)) 113 .run() 114 .writeAll() 115 .getOutput(Task.OutputKind.DIRECT); 116 117 if (!log.isEmpty()) { 118 throw new AssertionError("Unexpected output: " + log); 119 } 120 121 classes = base.resolve("classes"); 122 Files.createDirectories(classes); 123 } 124 125 Path processorCompiledModules; 126 Path moduleSrc; 127 Path classes; 128 129 @Test 130 public void testUseOnlyOneProcessor(Path base) throws Exception { 131 initialization(base); 132 List<String> log = new JavacTask(tb) 133 .options("-processormodulepath", processorCompiledModules.toString(), 134 "-Xplugin:simpleplugin1") 135 .outdir(classes) 136 .sources(testClass) 137 .run() 138 .writeAll() 139 .getOutputLines(Task.OutputKind.STDOUT); 140 if (!log.equals(Arrays.asList("simpleplugin1 started for event COMPILATION", 141 "simpleplugin1 finished for event COMPILATION"))) { 142 throw new AssertionError("Unexpected output: " + log); 143 } 144 } 145 } | 90 " }\n" + 91 " }\n" + 92 "}"; 93 94 private static final String testClass = "class Test { }"; 95 96 void initialization(Path base) throws Exception { 97 moduleSrc = base.resolve("plugin_mods_src"); 98 Path pluginMod1 = moduleSrc.resolve("pluginMod1"); 99 100 processorCompiledModules = base.resolve("mods"); 101 102 Files.createDirectories(processorCompiledModules); 103 104 tb.writeJavaFiles( 105 pluginMod1, 106 pluginModule1, 107 plugin1); 108 109 String log = new JavacTask(tb) 110 .options("--module-source-path", moduleSrc.toString()) 111 .outdir(processorCompiledModules) 112 .files(findJavaFiles(moduleSrc)) 113 .run() 114 .writeAll() 115 .getOutput(Task.OutputKind.DIRECT); 116 117 if (!log.isEmpty()) { 118 throw new AssertionError("Unexpected output: " + log); 119 } 120 121 classes = base.resolve("classes"); 122 Files.createDirectories(classes); 123 } 124 125 Path processorCompiledModules; 126 Path moduleSrc; 127 Path classes; 128 129 @Test 130 public void testUseOnlyOneProcessor(Path base) throws Exception { 131 initialization(base); 132 List<String> log = new JavacTask(tb) 133 .options("--processor-module-path", processorCompiledModules.toString(), 134 "-Xplugin:simpleplugin1") 135 .outdir(classes) 136 .sources(testClass) 137 .run() 138 .writeAll() 139 .getOutputLines(Task.OutputKind.STDOUT); 140 if (!log.equals(Arrays.asList("simpleplugin1 started for event COMPILATION", 141 "simpleplugin1 finished for event COMPILATION"))) { 142 throw new AssertionError("Unexpected output: " + log); 143 } 144 } 145 } |