Subversion Repository Public Repository

litesoft

Diff Revisions 366 vs 367 for /trunk/Java/ScarPlus/src/com/esotericsoftware/scar/Project.java

Diff revisions: vs.
  @@ -124,20 +124,36 @@
124 124 {
125 125 return false;
126 126 }
127 - progress( "AppDir: " + this + " -> " + zAppDir );
128 - String distDir = mkdir( zAppDir );
127 + File zJarPath = getJarPathFile();
128 + if ( !zJarPath.isFile() )
129 + {
130 + progress( "AppDir: " + this + " BUT NO jar File produced at: " + zJarPath.getPath() );
131 + return false;
132 + }
133 + Paths zPaths = new Paths();
134 + addDependantProjectsDistPaths( zPaths );
135 + zPaths.add( classpath() );
136 + zPaths.add( FilePath.canonicalize( getJarPathFile() ) );
137 +
138 + File zAppDirFile = new File( zAppDir );
139 + if ( zAppDirFile.exists() )
140 + {
141 + if ( zAppDirFile.lastModified() >= zPaths.getGreatestLastModified() )
142 + {
143 + progress( "AppDir: " + this + " NOT Needed!" );
144 + return false;
145 + }
146 + delete( zAppDirFile );
147 + }
129 148
130 - // todo: xxxx
131 - classpath().copyTo( distDir );
132 - Paths distPaths = getDist();
133 - // dependencyDistPaths( distPaths );
134 - distPaths.copyTo( distDir );
135 - new Paths( getTargetPath(), "*.jar" ).copyTo( distDir );
149 + progress( "AppDir: " + this + " -> " + zAppDir );
150 + String distDir = mkdir( zAppDir ); // Give it a new Timestamp
151 + zPaths.copyTo( distDir );
136 152 return true;
137 153 }
138 154
139 155 /**
140 - * Produce either a 'war' directory or a '.war' file, in theary ready to deploy to a servlet/web container.
156 + * Produce either a 'war' directory or a '.war' file, in theory ready to deploy to a servlet/web container.
141 157 *
142 158 * @return true if the 'war' was created.
143 159 */
  @@ -155,73 +171,63 @@
155 171 return false;
156 172 }
157 173
174 + Paths zDistPaths = new Paths();
175 + addDependantProjectsDistPaths( zDistPaths );
176 + if ( null != getGWT() )
177 + {
178 + zDistPaths.add( new Paths( getGWTwarPath() ) );
179 + }
180 +
158 181 Paths zClassPath = new Paths();
159 182 zClassPath.add( FilePath.canonical( getGWTatDir(), GWT_SERVLET ) );
160 - zClassPath.add( FilePath.canonicalize( getJarPathFile() ) );
161 183 zClassPath.add( classpath() );
184 + zClassPath.add( FilePath.canonicalize( getJarPathFile() ) );
162 185
163 186 File zWarPathFile = getWarPathFile();
164 - if ( zWarPathFile.exists() && (zWarPathFile.lastModified() >= zClassPath.getGreatestLastModified()) )
187 + if ( zWarPathFile.exists() )
165 188 {
166 - progress( "WAR: " + this + " NOT Needed!" );
167 - return false;
189 + if ( zWarPathFile.lastModified() >= zClassPath.getGreatestLastModified() )
190 + {
191 + progress( "WAR: " + this + " NOT Needed!" );
192 + return false;
193 + }
194 + delete( zWarPathFile );
168 195 }
169 196
170 - if ( zWar.endsWith( ".war" ) )
171 - {
197 + boolean zWarIt = zWar.endsWith( ".war" );
172 198
173 - }
174 - else
199 + File zWarDir = zWarPathFile;
200 + if ( zWarIt )
175 201 {
202 + zWarDir = new File( path( "$target$/war/" ) );
203 + delete( zWarDir );
204 + }
205 +
206 + progress( "WAR: " + this + " -> " + zWarDir.getPath() );
176 207
208 + File zWarDirLibPath = new File( zWarDir, "WEB-INF/lib" );
209 + mkdir( zWarDirLibPath );
210 +
211 + zDistPaths.copyTo( zWarDir.getPath() );
212 + zClassPath.copyTo( zWarDirLibPath.getPath() );
213 +
214 + if ( zWarIt )
215 + {
216 + innerJar( "WAR", zWarPathFile.getPath(), new Paths( zWarDir.getPath() ) );
177 217 }
178 - // progress( "WAR: " + this );
179 - // todo: WAR
180 - // progress( "WAR: " + this + " -> " + zWarPath );
181 - //
182 - // String jarDir = mkdir( path( "$target$/war/" ) );
183 - //
184 - // zClasses.copyTo( jarDir );
185 - // zResources.copyTo( jarDir );
186 - //
187 - // Paths zClasspath = classpath();
188 - //
189 - // return innerJar( "WAR", jarFile, new Paths( jarDir ) );
190 218 return true;
191 219 }
192 220
193 - // private Paths dependencyDistPaths( Paths paths )
194 - // {
195 - // Paths paths = new Paths();
196 - // for ( Project zProject : mDependantProjects )
197 - // {
198 - // zProject.addDependantProjectsDistPaths( paths );
199 - // }
200 - // return classpath;
201 - // {
202 - // }
203 - //
204 - // for ( String dependency : getDependencies() )
205 - // {
206 - // Project dependencyProject = null; // todo: project( null, path( dependency ) );
207 - // String dependencyTarget = dependencyProject.getTargetPath();
208 - // if ( !Utils.fileExists( dependencyTarget ) )
209 - // {
210 - // throw new RuntimeException( "Dependency has not been built: " + dependency );
211 - // }
212 - // paths.glob( dependencyTarget + "dist", "!*/**.jar" );
213 - // paths.add( dependencyDistPaths( paths ) );
214 - // }
215 - // return paths;
216 - // }
217 -
218 221 /**
219 222 * Computes the classpath for all the dependencies of the specified project, recursively.
220 223 */
221 224 protected void addDependantProjectsDistPaths( Paths pPathsToAddTo )
222 225 {
223 - // todo: xxx addDependentProjectJar( pPathsToAddTo );
224 - // todo: xxx pPathsToAddTo.add( classpath() );
226 + for ( Project zProject : mDependantProjects )
227 + {
228 + zProject.addDependantProjectsDistPaths( pPathsToAddTo );
229 + }
230 + pPathsToAddTo.add( getDist() );
225 231 }
226 232
227 233 protected boolean GWTcompileIt()