-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake-jar
executable file
·59 lines (49 loc) · 1.35 KB
/
make-jar
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
#!/usr/bin/env qore
# -*- mode: qore; indent-tabs-mode: nil -*-
%requires qore >= 0.9.9
%requires Util
%new-style
%strict-args
%require-types
%enable-all-warnings
%exec-class MakeInc
%requires Util
%requires FsUtil
class MakeInc {
private {
const Opts = {
"output": "o,output=s",
"verbose": "v,verbose:i+",
"help": "h,help",
};
const TmpName = "jar.tmp";
}
constructor() {
GetOpt g(Opts);
hash<auto> opts = g.parse3(\ARGV);
if (opts.help || !opts.output || (ARGV.size() < 2)) {
usage();
}
TmpDir tdir("", "", ".");
chdir(tdir.path);
string args;
if (PlatformOS == "FreeBSD") {
args = opts.verbose ? "-o" : "-oq";
} else {
args = opts.verbose ? "-uo" : "-uoq";
}
map system("unzip " + args + " \"" + (absolute_path($1) ? $1 : ("../" + $1)) + "\""), ARGV;
chdir("..");
args = opts.verbose ? "cvf" : "cf";
system(sprintf("jar " + args + " %s -C %s .", opts.output, tdir.path));
}
static usage() {
printf("usage: %s -o=<arg> [options] input_jar1 input_jar2 ...
-h,--help this help text
-o,--output=ARG the output JAR name
-v,--verbose[=ARG] verbosity level
",
get_script_name());
exit(1);
}
}