blob: 72e0922103e9be26bdfd0f12ba993b5d336f5e1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using clojure.lang;
using System.Collections;
using System.Diagnostics;
namespace BootstrapCompile
{
static class Compile
{
const string PATH_PROP = "clojure.compile.path";
const string REFLECTION_WARNING_PROP = "clojure.compile.warn-on-reflection";
static void Main(string[] args)
{
TextWriter outTW = (TextWriter)RT.OUT.deref();
TextWriter errTW = (TextWriter)RT.ERR.deref();
string path = Environment.GetEnvironmentVariable(PATH_PROP);
// TODO: get rid of this when we have the full build process set up
path = path ?? ".";
if ( path == null )
{
errTW.WriteLine("ERROR: Must set system property {0}",PATH_PROP);
errTW.WriteLine("to the location for the compiled .class files.");
errTW.WriteLine("This directory must also be on your {0}.",RT.CLOJURE_LOAD_PATH);
Environment.Exit(1);
}
string warnVal = Environment.GetEnvironmentVariable(REFLECTION_WARNING_PROP);
bool warnOnReflection = warnVal == null ? false : warnVal.Equals(true);
try
{
Var.pushThreadBindings(RT.map(
Compiler.COMPILE_PATH,path,
RT.WARN_ON_REFLECTION,warnOnReflection
));
Stopwatch sw = new Stopwatch();
foreach ( string lib in args )
{
sw.Reset();
sw.Start();
outTW.Write("Compiling {0} to {1}",lib,path);
outTW.Flush();
Compiler.COMPILE.invoke(Symbol.intern(lib));
sw.Stop();
outTW.WriteLine(" -- {0} milliseconds.", sw.ElapsedMilliseconds);
}
}
finally
{
Var.popThreadBindings();
try {
outTW.Flush();
outTW.Close();
}
catch ( IOException e)
{
errTW.WriteLine(e.StackTrace);
}
}
}
}
}
|