从命令行我可以获得从 compiler.jar 重命名的函数的别名列表
帮助说:
java -jar compiler.jar --help
[...]
--create_name_map_files : If true, variable renaming and
property renaming map files will be
produced as {binary name}_vars_map.out
and {binary name}_props_map.out. Note
that this flag cannot be used in
conjunction with either variableMapOut
putFile or property_map_output_file
--create_source_map VAL : If specified, a source map file
mapping the generated source files
back to the original source file will
be output to the specified path. The
%outname% placeholder will expand to
the name of the output file that the
source map corresponds to.
[...]
那么,如何从内联 java 中获取“create_name_map_files”?我查看了 AbstractCommandLineRunner.java,但与此命令行选项相关的所有类/方法都是私有(private)的,无法从我的代码中访问。
我的代码:
CompilerOptions opt = new CompilerOptions();
// decide mode
compilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(opt);
opt.prettyPrint = false;
Compiler.setLoggingLevel(Level.OFF);
Compiler compressor = new Compiler();
compressor.disableThreads();
List<SourceFile> inputs = ...;
List<SourceFile> externs = ...;
compressor.compile(externs, inputs, opt);
最佳答案
您可以只使用选项:variable_map_output_file filename, Prop 也是如此。
请注意:标志 variable_map_output_file 和 create_name_map_files 不能同时使用。
关于java - 闭包编译器 : create_name_map_files from Java API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19875654/