MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / compile

Method compile

ij/src/main/java/ij/plugin/Compiler.java:121–169  ·  view source on GitHub ↗
(String path)

Source from the content-addressed store, hash-verified

119 }
120
121 boolean compile(String path) {
122 IJ.showStatus("compiling "+path);
123 String classpath = getClassPath(path);
124 Vector options = new Vector();
125 if (generateDebuggingInfo)
126 options.addElement("-g");
127 validateTarget();
128 options.addElement("-source");
129 options.addElement(getTargetAsString());
130 options.addElement("-target");
131 options.addElement(getTargetAsString());
132 options.addElement("-Xlint:unchecked");
133 options.addElement("-deprecation");
134 options.addElement("-classpath");
135 options.addElement(classpath);
136
137 Vector sources = new Vector();
138 sources.add(path);
139
140 if (IJ.debugMode) {
141 StringBuilder builder = new StringBuilder();
142 builder.append("javac");
143 for (int i=0; i< options.size(); i++){
144 builder.append(" ");
145 builder.append(options.get(i));
146 }
147 for (int i=0; i< sources.size(); i++){
148 builder.append(" ");
149 builder.append(sources.get(i));
150 }
151 IJ.log(builder.toString());
152 }
153
154 boolean errors = true;
155 String s = "not compiled";
156 if (compilerTool != null) {
157 final StringWriter outputWriter = new StringWriter();
158 errors = !compilerTool.compile(sources, options, outputWriter);
159 s = outputWriter.toString();
160 } else {
161 errors = true;
162 }
163
164 if (errors)
165 showErrors(s);
166 else
167 IJ.showStatus("done");
168 return !errors;
169 }
170
171 // Returns a string containing the Java classpath,
172 // the path to the directory containing the plugin,

Callers 1

compileAndRunMethod · 0.95

Calls 13

showStatusMethod · 0.95
getClassPathMethod · 0.95
validateTargetMethod · 0.95
getTargetAsStringMethod · 0.95
logMethod · 0.95
showErrorsMethod · 0.95
addMethod · 0.65
appendMethod · 0.65
addElementMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected