|
@@ -42,7 +42,10 @@ |
42 |
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 |
43 |
|
"Default: '$target$[-$version$]'." ); |
44 |
44 |
|
|
45 |
|
- |
public static final Parameter DIST = def( "dist", Form.PATHS, "Wildcard patterns for the file(s) to include in the distribution, outside the JAR." ); |
|
45 |
+ |
public static final Parameter DIST = def( "dist", Form.PATHS, "Wildcard patterns for the file(s) to include in the distribution, outside the JAR.", // |
|
46 |
+ |
"Default: 'war' (if there)." ); |
|
47 |
+ |
|
|
48 |
+ |
// ------------------------------- Packaging Options, these are mutually exclusive --------------------------------- |
46 |
49 |
|
|
47 |
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." ); |
48 |
51 |
|
|
|
@@ -74,6 +77,33 @@ |
74 |
77 |
|
|
75 |
78 |
|
private static final String[] GWT_JARS = {GWT_DEV, GWT_USER, GWT_SERVLET}; |
76 |
79 |
|
|
|
80 |
+ |
// -------------------------------------------------- Validation --------------------------------------------------- |
|
81 |
+ |
|
|
82 |
+ |
@SuppressWarnings({"PointlessArithmeticExpression"}) |
|
83 |
+ |
public ProjectParameters validate() |
|
84 |
+ |
{ |
|
85 |
+ |
int zHas = (1 * ((null != getAppDir()) ? 1 : 0)) + // |
|
86 |
+ |
(2 * ((null != getOneJar()) ? 1 : 0)) + // |
|
87 |
+ |
(4 * ((null != getWar()) ? 1 : 0)); |
|
88 |
+ |
switch ( zHas ) |
|
89 |
+ |
{ |
|
90 |
+ |
default: |
|
91 |
+ |
case 1: |
|
92 |
+ |
case 2: |
|
93 |
+ |
case 4: |
|
94 |
+ |
break; // Happy Cases |
|
95 |
+ |
case 3: |
|
96 |
+ |
throw new IllegalArgumentException( "May not specify both: AppDir & OneJAR" ); |
|
97 |
+ |
case 5: |
|
98 |
+ |
throw new IllegalArgumentException( "May not specify both: AppDir & WAR" ); |
|
99 |
+ |
case 6: |
|
100 |
+ |
throw new IllegalArgumentException( "May not specify both: OneJAR & WAR" ); |
|
101 |
+ |
case 7: |
|
102 |
+ |
throw new IllegalArgumentException( "May only specify one of: AppDir, OneJAR, or WAR" ); |
|
103 |
+ |
} |
|
104 |
+ |
return this; |
|
105 |
+ |
} |
|
106 |
+ |
|
77 |
107 |
|
// ------------------------------------------------ Default Support ------------------------------------------------ |
78 |
108 |
|
|
79 |
109 |
|
protected synchronized void applyDefaults() |
|
@@ -83,6 +113,7 @@ |
83 |
113 |
|
defaultSOURCE(); |
84 |
114 |
|
defaultRESOURCES(); |
85 |
115 |
|
defaultJAR(); |
|
116 |
+ |
defaultDIST(); |
86 |
117 |
|
defaultGWT(); |
87 |
118 |
|
} |
88 |
119 |
|
|
|
@@ -103,7 +134,7 @@ |
103 |
134 |
|
{ |
104 |
135 |
|
if ( pRelativeGWTlibsDir == null ) |
105 |
136 |
|
{ |
106 |
|
- |
throw new IllegalStateException( "GWT specified, but GWTat!" ); |
|
137 |
+ |
throw new IllegalStateException( "GWT specified, but NO GWTat!" ); |
107 |
138 |
|
} |
108 |
139 |
|
if ( !dirExists( pRelativeGWTlibsDir ) ) |
109 |
140 |
|
{ |
|
@@ -119,6 +150,11 @@ |
119 |
150 |
|
} |
120 |
151 |
|
} |
121 |
152 |
|
|
|
153 |
+ |
protected void defaultDIST() |
|
154 |
+ |
{ |
|
155 |
+ |
defaultSubDirOptional( DIST, "war" ); |
|
156 |
+ |
} |
|
157 |
+ |
|
122 |
158 |
|
protected void defaultJAR() |
123 |
159 |
|
{ |
124 |
160 |
|
String zJar = getJar(); |
|
@@ -141,17 +177,17 @@ |
141 |
177 |
|
defaultKey( TARGET, "build" ); |
142 |
178 |
|
} |
143 |
179 |
|
|
144 |
|
- |
private void defaultCLASSPATH() |
|
180 |
+ |
protected void defaultCLASSPATH() |
145 |
181 |
|
{ |
146 |
182 |
|
defaultSubDirOptional( CLASSPATH, "lib|**.jar" ); |
147 |
183 |
|
} |
148 |
184 |
|
|
149 |
|
- |
private void defaultRESOURCES() |
|
185 |
+ |
protected void defaultRESOURCES() |
150 |
186 |
|
{ |
151 |
187 |
|
defaultSubDirOptional( RESOURCES, "src/main/resources", "resources" ); |
152 |
188 |
|
} |
153 |
189 |
|
|
154 |
|
- |
private void defaultSOURCE() |
|
190 |
+ |
protected void defaultSOURCE() |
155 |
191 |
|
{ |
156 |
192 |
|
defaultSubDirOptional( SOURCE, "src/main/java|**.java", "src|**.java" ); |
157 |
193 |
|
} |
|
@@ -228,6 +264,21 @@ |
228 |
264 |
|
return new File( getJarPath() ); |
229 |
265 |
|
} |
230 |
266 |
|
|
|
267 |
+ |
public Paths getDist() |
|
268 |
+ |
{ |
|
269 |
+ |
return getPaths( DIST.getName() ); |
|
270 |
+ |
} |
|
271 |
+ |
|
|
272 |
+ |
public String getAppDir() |
|
273 |
+ |
{ |
|
274 |
+ |
return get( APPDIR.getName() ); |
|
275 |
+ |
} |
|
276 |
+ |
|
|
277 |
+ |
public String getAppDirPath() |
|
278 |
+ |
{ |
|
279 |
+ |
return getPath( APPDIR.getName() ); |
|
280 |
+ |
} |
|
281 |
+ |
|
231 |
282 |
|
public String getOneJar() |
232 |
283 |
|
{ |
233 |
284 |
|
return get( ONEJAR.getName() ); |
|
@@ -253,21 +304,6 @@ |
253 |
304 |
|
return new File( zJar ); |
254 |
305 |
|
} |
255 |
306 |
|
|
256 |
|
- |
public Paths getDist() |
257 |
|
- |
{ |
258 |
|
- |
return getPaths( DIST.getName() ); |
259 |
|
- |
} |
260 |
|
- |
|
261 |
|
- |
public String getAppDir() |
262 |
|
- |
{ |
263 |
|
- |
return get( APPDIR.getName() ); |
264 |
|
- |
} |
265 |
|
- |
|
266 |
|
- |
public String getAppDirPath() |
267 |
|
- |
{ |
268 |
|
- |
return getPath( APPDIR.getName() ); |
269 |
|
- |
} |
270 |
|
- |
|
271 |
307 |
|
public String getWar() |
272 |
308 |
|
{ |
273 |
309 |
|
return get( WAR.getName() ); |