1 | void execute() throws BuildException {↵ | | 1 | void execute() throws BuildException {↵
|
2 | Commandline commandLine = new Commandline();↵ | | 2 | Commandline commandLine = new Commandline();↵
|
3 | Project aProj = getProject();↵ | | 3 | Project aProj = getProject();↵
|
4 | int result = 0;↵ | | 4 | int result = 0;↵
|
|
5 | // Default the viewpath to basedir if it is not specified↵ | | 5 | // Default the viewpath to basedir if it is not specified↵
|
6 | if (getViewPath() == null) {↵ | | 6 | if (getViewPath() == null) {↵
|
7 | setViewPath(aProj.getBaseDir().getPath());↵ | | 7 | setViewPath(aProj.getBaseDir().getPath());↵
|
8 | }↵ | | 8 | }↵
|
|
9 | // build the command line from what we got. the format is↵ | | 9 | // build the command line from what we got. the format is↵
|
10 | // cleartool mkelem [options...] [viewpath ...]↵ | | 10 | // cleartool mkelem [options...] [viewpath ...]↵
|
11 | // as specified in the CLEARTOOL.EXE help↵ | | 11 | // as specified in the CLEARTOOL.EXE help↵
|
12 | commandLine.setExecutable(getClearToolCommand());↵ | | 12 | commandLine.setExecutable(getClearToolCommand());↵
|
13 | commandLine.createArgument().setValue(COMMAND_MKELEM);↵ | | 13 | commandLine.createArgument().setValue(COMMAND_MKDIR);↵
|
|
14 | checkOptions(commandLine);↵ | | 14 | checkOptions(commandLine);↵
|
|
15 | if (!getFailOnErr()) {↵ | | 15 | if (!getFailOnErr()) {↵
|
16 | getProject().log("Ignoring any errors that occur for: "↵ | | 16 | getProject().log("Ignoring any errors that occur for: "↵
|
17 | + getViewPathBasename(), Project.MSG_VERBOSE);↵ | | 17 | + getViewPathBasename(), Project.MSG_VERBOSE);↵
|
18 | }↵ | | 18 | }↵
|
19 | result = run(commandLine);↵ | | 19 | result = run(commandLine);↵
|
20 | if (Execute.isFailure(result) && getFailOnErr()) {↵ | | 20 | if (Execute.isFailure(result) && getFailOnErr()) {↵
|
21 | String msg = "Failed executing: " + commandLine.toString();↵ | | 21 | String msg = "Failed executing: " + commandLine.toString();↵
|
22 | throw new BuildException(msg, getLocation());↵ | | 22 | throw new BuildException(msg, getLocation());↵
|
23 | }↵ | | 23 | }↵
|
24 | }↵ | | 24 | }↵
|
|
|
25 | /**↵ | | 25 | /**↵
|
26 | * Check the command line options.↵ | | 26 | * Check the command line options.↵
|
27 | */↵ | | 27 | */↵
|
28 | private void checkOptions(Commandline cmd) {↵ | | 28 | private void checkOptions(Commandline cmd) {↵
|
29 | if (getComment() != null) {↵ | | 29 | if (getComment() != null) {↵
|
30 | // -c↵ | | 30 | // -c↵
|
31 | getCommentCommand(cmd);↵ | | 31 | getCommentCommand(cmd);↵
|
32 | } else {↵ | | 32 | } else {↵
|
33 | if (getCommentFile() != null) {↵ | | 33 | if (getCommentFile() != null) {↵
|
34 | // -cfile↵ | | 34 | // -cfile↵
|
35 | getCommentFileCommand(cmd);↵ | | 35 | getCommentFileCommand(cmd);↵
|
36 | } else {↵ | | 36 | } else {↵
|
37 | cmd.createArgument().setValue(FLAG_NOCOMMENT);↵ | | 37 | cmd.createArgument().setValue(FLAG_NOCOMMENT);↵
|
38 | }↵ | | 38 | }↵
|
39 | }↵ | | 39 | }↵
|
|
40 | if (getNoWarn()) {↵ | | 40 | if (getNoCheckout()) {↵
|
41 | // -nwarn↵ | | 41 | // -nco↵
|
42 | cmd.createArgument().setValue(FLAG_NOWARN);↵ | | 42 | cmd.createArgument().setValue(FLAG_NOCHECKOUT);↵
|
43 | | | 43 |
|