summaryrefslogtreecommitdiff
path: root/support/jedit/console/commando/scalac.xml
blob: 7fad39badafab1318e2b0a25f339e683e5ce4a26 (plain) (blame)
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
<?xml version="1.0"?>
<!DOCTYPE COMMANDO SYSTEM "commando.dtd">
<!-- Author(s): Manpreet Singh \junkblocker/ \at/ \yahoo/ \dot/ \com/ -->
<!--            Stephane Micheloud (http://scala.epfl.ch/)            -->
<COMMANDO>
    <UI>
        <CAPTION LABEL="Scala Settings">
            <!-- See http://www.rgagnon.com/javadetails/java-0150.html -->
            <DIR_ENTRY LABEL="Scala Home Path" VARNAME="home" EVAL='
            envProps = new Properties();
            osname = System.getProperty("os.name", "unknown").toLowerCase();
            if (osname.indexOf("windows 9") != -1) {
                cmd = "command.com /c set";
                isWin32 = true;
            }
            else if ( (osname.indexOf("nt") != -1) ||
                      (osname.indexOf("windows 20") != -1) ||
                      (osname.indexOf("windows xp") != -1) ) {
                cmd = "cmd.exe /c set";
                isWin32 = true;
            }
            else {
                cmd = "env";
                isWin32 = false;
            }
            p = Runtime.getRuntime().exec(cmd);
            is = new InputStreamReader(p.getInputStream());
            rd = new BufferedReader(is);
            line = null;
            while ((line = rd.readLine()) != null) {
                index = -1;
                if ((index = line.indexOf("=")) > -1) {
                    key = line.substring(0, index).trim();
                    value = line.substring(index + 1).trim();
                    envProps.setProperty(key, value);
                }
                else
                    envProps.setProperty(line, "");
            }
            is.close();

            value = envProps.getProperty("SCALA_HOME");
            if (value == null) {
                value = (isWin32) ? "c:\\\\Progra~1\\Scala" : "/usr/local/scala";
            }
            value
            '/>
        </CAPTION>
        <CAPTION LABEL="Source File(s)">
            <FILE_ENTRY LABEL="Source File(s)" VARNAME="sources" EVAL='buffer.getPath()'/>
        </CAPTION>
        <CAPTION LABEL="Paths">
            <DIR_ENTRY LABEL="Class path" VARNAME="classpath" EVAL='buffer.getDirectory()'/>
            <DIR_ENTRY LABEL="Output directory" VARNAME="output_dir"/>
        </CAPTION>
    </UI>
    <COMMANDS>
        <COMMAND SHELL="System" CONFIRM="FALSE">
            buf = new StringBuffer();
            if (home.length() > 0) buf.append(home + File.separator + "bin" + File.separator);
            buf.append("scalac");
            if (classpath.length() > 0) buf.append(" -classpath " + classpath);
            if (output_dir.length() > 0) buf.append(" -d " + output_dir);
            buf.append(" " + sources);
            buf.toString()
        </COMMAND>
    </COMMANDS>
</COMMANDO>

<!-- $Id$ -->