MCPcopy Index your code
hub / github.com/clojure/clojure / Compile

Class Compile

src/jvm/clojure/lang/Compile.java:23–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21// all be within CLASSPATH.
22
23public class Compile{
24
25private static final String PATH_PROP = "clojure.compile.path";
26private static final String REFLECTION_WARNING_PROP = "clojure.compile.warn-on-reflection";
27private static final String UNCHECKED_MATH_PROP = "clojure.compile.unchecked-math";
28
29private static final Var compile_path = RT.var("clojure.core", "*compile-path*");
30private static final Var compile = RT.var("clojure.core", "compile");
31private static final Var warn_on_reflection = RT.var("clojure.core", "*warn-on-reflection*");
32private static final Var unchecked_math = RT.var("clojure.core", "*unchecked-math*");
33
34public static void main(String[] args) throws IOException, ClassNotFoundException{
35 RT.init();
36 OutputStreamWriter out = (OutputStreamWriter) RT.OUT.deref();
37 PrintWriter err = RT.errPrintWriter();
38 String path = System.getProperty(PATH_PROP);
39 int count = args.length;
40
41 if(path == null)
42 {
43 err.println("ERROR: Must set system property " + PATH_PROP +
44 "\nto the location for compiled .class files." +
45 "\nThis directory must also be on your CLASSPATH.");
46 System.exit(1);
47 }
48
49 boolean warnOnReflection = System.getProperty(REFLECTION_WARNING_PROP, "false").equals("true");
50 String uncheckedMathProp = System.getProperty(UNCHECKED_MATH_PROP);
51 Object uncheckedMath = Boolean.FALSE;
52 if("true".equals(uncheckedMathProp))
53 uncheckedMath = Boolean.TRUE;
54 else if("warn-on-boxed".equals(uncheckedMathProp))
55 uncheckedMath = Keyword.intern("warn-on-boxed");
56
57 // force load to avoid transitive compilation during lazy load
58 RT.load("clojure/core/specs/alpha");
59
60 try
61 {
62 Var.pushThreadBindings(RT.map(compile_path, path,
63 warn_on_reflection, warnOnReflection,
64 unchecked_math, uncheckedMath));
65
66 for(String lib : args)
67 {
68 out.write("Compiling " + lib + " to " + path + "\n");
69 out.flush();
70 compile.invoke(Symbol.intern(lib));
71 }
72 }
73 finally
74 {
75 Var.popThreadBindings();
76 try
77 {
78 out.flush();
79 }
80 catch(IOException e)

Callers

nothing calls this directly

Calls 1

varMethod · 0.95

Tested by

no test coverage detected