-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathInstallProject.java
More file actions
67 lines (55 loc) · 1.62 KB
/
Copy pathInstallProject.java
File metadata and controls
67 lines (55 loc) · 1.62 KB
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
package javaforce.utils;
import java.util.*;
import javaforce.*;
/** Install Project files.
*
* @author pquiring
*/
public class InstallProject implements ShellProcessListener {
private BuildTools tools;
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage:InstallProject build.xml");
System.exit(1);
}
try {
new InstallProject().run(args[0]);
} catch (Exception e) {
JFLog.log(e);
}
}
public void run(String buildfile) throws Exception {
tools = new BuildTools();
if (!tools.loadXML(buildfile)) throw new Exception("error loading " + buildfile);
String app = tools.getProperty("app");
String apptype = tools.getProperty("apptype");
//cp ${app}.bin /usr/bin/${app}
JFLog.log("Installing executable:" + app + ".bin to /usr/bin");
JF.copyFile(app + ".bin", "/usr/bin/" + app);
BuildTools.chmod_x("/usr/bin/" + app);
ShellProcess sp = new ShellProcess();
sp.addListener(this);
//ant -file buildfile install
ArrayList<String> cmd = new ArrayList<String>();
if (JF.isWindows()) {
cmd.add("ant.bat");
} else {
cmd.add("ant");
}
cmd.add("-file");
cmd.add(buildfile);
cmd.add("install");
JFLog.log("Executing ant -file " + buildfile + " install");
sp.run(cmd.toArray(JF.StringArrayType), true);
doSubProjects();
}
public void shellProcessOutput(String str) {
System.out.print(str);
}
private void doSubProjects() {
String[] subs = tools.getSubProjects();
for(String project : subs) {
main(new String[] {project + ".xml"});
}
}
}