|
@@ -25,13 +25,16 @@ |
25 |
25 |
|
public static final Parameter TARGET = def( "target", Form.STRING, "The directory to output build artifacts.", // |
26 |
26 |
|
"Default: The directory containing the project YAML file, plus 'build'." ); |
27 |
27 |
|
|
28 |
|
- |
public static final Parameter DEPENDENCIES = def( "dependencies", Form.STRING_LIST, "Relative or absolute path(s) to dependency project directories or YAML files." ); |
|
28 |
+ |
public static final Parameter DEPENDENCIES = |
|
29 |
+ |
def( "dependencies", Form.STRING_LIST, "Relative or absolute path(s) to dependency project directories or YAML files." ); |
29 |
30 |
|
|
30 |
|
- |
public static final Parameter COMPILECLASSPATH = def( "compileclasspath", Form.PATHS, "Wildcard patterns for the file(s) to include on the 'compile' classpath.", // |
31 |
|
- |
"Note: automatically includes the ClassPath(s)." ); |
32 |
|
- |
|
33 |
|
- |
public static final Parameter CLASSPATH = def( "classpath", Form.PATHS, "Wildcard patterns for the file(s) to include on the classpath (both, compile & runtime/deployment).", // |
34 |
|
- |
"Default: 'lib|**.jar'." ); |
|
31 |
+ |
public static final Parameter COMPILECLASSPATH = |
|
32 |
+ |
def( "compileclasspath", Form.PATHS, "Wildcard patterns for the file(s) to include on the 'compile' classpath.", // |
|
33 |
+ |
"Note: automatically includes the ClassPath(s)." ); |
|
34 |
+ |
|
|
35 |
+ |
public static final Parameter CLASSPATH = |
|
36 |
+ |
def( "classpath", Form.PATHS, "Wildcard patterns for the file(s) to include on the classpath (both, compile & runtime/deployment).", // |
|
37 |
+ |
"Default: 'lib|**.jar'." ); |
35 |
38 |
|
|
36 |
39 |
|
public static final Parameter SOURCE = def( "source", Form.PATHS, "Wildcard patterns for the Java file(s) to compile.", // |
37 |
40 |
|
"Default: 'src|**.java' or 'src/main/java|**.java'." ); |
|
@@ -39,19 +42,30 @@ |
39 |
42 |
|
public static final Parameter RESOURCES = def( "resources", Form.PATHS, "Wildcard patterns for the file(s) to include in the JAR.", // |
40 |
43 |
|
"Default: 'resources' or 'src/main/resources'." ); |
41 |
44 |
|
|
42 |
|
- |
public static final Parameter JAR = def( "jar", Form.STRING, "JAR name w/ optional path for the JAR ('.jar' added to the end if does not end with 'jar', case insensitive).", // |
43 |
|
- |
"Default: '$target$[-$version$]'." ); |
|
45 |
+ |
public static final Parameter JAR = |
|
46 |
+ |
def( "jar", Form.STRING, "JAR name w/ optional path for the JAR ('.jar' added to the end if does not end with 'jar', case insensitive).", // |
|
47 |
+ |
"Default: '$target$[-$version$]'." ); |
44 |
48 |
|
|
45 |
49 |
|
public static final Parameter DIST = def( "dist", Form.PATHS, "Wildcard patterns for the file(s) to include in the distribution, outside the JAR.", // |
46 |
50 |
|
"Default: 'war' (if there)." ); |
47 |
51 |
|
|
48 |
52 |
|
// ------------------------------- Packaging Options, these are mutually exclusive --------------------------------- |
49 |
53 |
|
|
50 |
|
- |
public static final Parameter APPDIR = def( "appdir", Form.STRING, "Directory path to bring together all files (both JARs and 'dist', for this project " + "and all dependencies, recursively) the application needs to be run from JAR files." ); |
|
54 |
+ |
public static final Parameter PHONEGAPDIR = def( "phonegapdir", Form.STRING, "Directory path to bring together all the files needed for a PgoneGap app", // |
|
55 |
+ |
"('dist', for this project and all dependencies, recursively)." ); |
51 |
56 |
|
|
52 |
|
- |
public static final Parameter ONEJAR = def( "onejar", Form.STRING, "JAR name w/ optional path for the JAR ('.jar' added to the end if does not end with 'jar', case insensitive), that all 'exploded' dependendend JARs and dist files will be JAR'd into (this should make a single JAR application)." ); |
|
57 |
+ |
public static final Parameter APPDIR = def( "appdir", Form.STRING, "Directory path to bring together all files (both JARs and 'dist', for this project", // |
|
58 |
+ |
"and all dependencies, recursively) the application needs to be run from JAR files." ); |
53 |
59 |
|
|
54 |
|
- |
public static final Parameter WAR = def( "war", Form.STRING, "Target WAR directory or WAR name (if ends w/ '.war'), produces a war directory (as specified, or a default one if a '.war' is requested) then if a '.war' is requested, packages the war directory into the specified '.war' file." ); |
|
60 |
+ |
public static final Parameter ONEJAR = |
|
61 |
+ |
def( "onejar", Form.STRING, "JAR name w/ optional path for the JAR ('.jar' added to the end if does not end with 'jar', case insensitive),", // |
|
62 |
+ |
"that all 'exploded' dependendend JARs and dist files will be JAR'd into (this should make a single JAR application)." ); |
|
63 |
+ |
|
|
64 |
+ |
public static final Parameter WAR = def( "war", Form.STRING, |
|
65 |
+ |
"Target WAR directory or WAR name (if ends w/ '.war'), produces a war directory (as specified, " + |
|
66 |
+ |
"or a default one if a '.war' is requested)", |
|
67 |
+ |
// |
|
68 |
+ |
"then if a '.war' is requested, packages the war directory into the specified '.war' file." ); |
55 |
69 |
|
|
56 |
70 |
|
// ------------------------------------------------ GWT Parameters ------------------------------------------------- |
57 |
71 |
|
|
|
@@ -62,11 +76,13 @@ |
62 |
76 |
|
public static final Parameter GWTwar = def( "GWTwar", Form.STRING, "The directory to put the GWT Compiler's output in.", // |
63 |
77 |
|
"Default: '$target$/GWTCompilerOutput'." ); |
64 |
78 |
|
|
65 |
|
- |
public static final Parameter GWTstyle = def( "GWTstyle", Form.STRING, "GWT Compiler's output 'style'. Options are: OBF, PRETTY, or DETAILED. Note: OBF == Obfuscated.", // |
66 |
|
- |
"Default: 'OBF'." ); |
67 |
|
- |
|
68 |
|
- |
public static final Parameter GWTlogging = def( "GWTlogging", Form.STRING, "Logging level for the GWT Compiler. Options are: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL.", // |
69 |
|
- |
"Default: 'INFO'." ); |
|
79 |
+ |
public static final Parameter GWTstyle = |
|
80 |
+ |
def( "GWTstyle", Form.STRING, "GWT Compiler's output 'style'. Options are: OBF, PRETTY, or DETAILED. Note: OBF == Obfuscated.", // |
|
81 |
+ |
"Default: 'OBF'." ); |
|
82 |
+ |
|
|
83 |
+ |
public static final Parameter GWTlogging = |
|
84 |
+ |
def( "GWTlogging", Form.STRING, "Logging level for the GWT Compiler. Options are: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL.", // |
|
85 |
+ |
"Default: 'INFO'." ); |
70 |
86 |
|
|
71 |
87 |
|
public static final Parameter GWTmx = def( "GWTmx", Form.STRING, "the -Xmx value for the GWT Compiler.", // |
72 |
88 |
|
"Default: '1024m'." ); |
|
@@ -83,26 +99,34 @@ |
83 |
99 |
|
|
84 |
100 |
|
public ProjectParameters validate() |
85 |
101 |
|
{ |
86 |
|
- |
int zHas = intForNotNull( 1, getAppDir() ) + // |
87 |
|
- |
intForNotNull( 2, getOneJar() ) + // |
88 |
|
- |
intForNotNull( 4, getWar() ); |
89 |
|
- |
switch ( zHas ) |
|
102 |
+ |
List<String> zPackaging = new ArrayList<String>(); |
|
103 |
+ |
check( zPackaging, "AppDir", getAppDir() ); |
|
104 |
+ |
check( zPackaging, "OneJAR", getOneJar() ); |
|
105 |
+ |
check( zPackaging, "WAR", getWar() ); |
|
106 |
+ |
check( zPackaging, "PhoneGapDir", getPhoneGapDir() ); |
|
107 |
+ |
switch ( zPackaging.size() ) |
90 |
108 |
|
{ |
91 |
|
- |
default: |
|
109 |
+ |
case 0: |
92 |
110 |
|
case 1: |
|
111 |
+ |
return this; |
93 |
112 |
|
case 2: |
94 |
|
- |
case 4: |
95 |
|
- |
break; // Happy Cases |
96 |
|
- |
case 3: |
97 |
|
- |
throw new IllegalArgumentException( "May not specify both: AppDir & OneJAR" ); |
98 |
|
- |
case 5: |
99 |
|
- |
throw new IllegalArgumentException( "May not specify both: AppDir & WAR" ); |
100 |
|
- |
case 6: |
101 |
|
- |
throw new IllegalArgumentException( "May not specify both: OneJAR & WAR" ); |
102 |
|
- |
case 7: |
103 |
|
- |
throw new IllegalArgumentException( "May only specify one of: AppDir, OneJAR, or WAR" ); |
|
113 |
+ |
throw new IllegalArgumentException( "May not specify both: " + zPackaging.get( 0 ) + " & " + zPackaging.get( 1 ) ); |
|
114 |
+ |
default: |
|
115 |
+ |
String zMsg = "May only specify one of:"; |
|
116 |
+ |
while ( zPackaging.size() > 1 ) |
|
117 |
+ |
{ |
|
118 |
+ |
zMsg += " " + zPackaging.remove( 0 ) + ","; |
|
119 |
+ |
} |
|
120 |
+ |
throw new IllegalArgumentException( zMsg + " or " + zPackaging.get( 0 ) ); |
|
121 |
+ |
} |
|
122 |
+ |
} |
|
123 |
+ |
|
|
124 |
+ |
private void check( List<String> pPackaging, String pLabel, Object pObjectToCheck ) |
|
125 |
+ |
{ |
|
126 |
+ |
if ( pObjectToCheck != null ) |
|
127 |
+ |
{ |
|
128 |
+ |
pPackaging.add( pLabel ); |
104 |
129 |
|
} |
105 |
|
- |
return this; |
106 |
130 |
|
} |
107 |
131 |
|
|
108 |
132 |
|
// ------------------------------------------------ Default Support ------------------------------------------------ |
|
@@ -281,6 +305,16 @@ |
281 |
305 |
|
return getPaths( DIST.getName() ); |
282 |
306 |
|
} |
283 |
307 |
|
|
|
308 |
+ |
public String getPhoneGapDir() |
|
309 |
+ |
{ |
|
310 |
+ |
return get( PHONEGAPDIR.getName() ); |
|
311 |
+ |
} |
|
312 |
+ |
|
|
313 |
+ |
public String getPhoneGapDirPath() |
|
314 |
+ |
{ |
|
315 |
+ |
return getPath( PHONEGAPDIR.getName() ); |
|
316 |
+ |
} |
|
317 |
+ |
|
284 |
318 |
|
public String getAppDir() |
285 |
319 |
|
{ |
286 |
320 |
|
return get( APPDIR.getName() ); |