Commits
244 244 | for ( String line : (List<String>) modifiedLines ) |
245 245 | { |
246 246 | bw.write( line ); |
247 247 | bw.newLine(); |
248 248 | } |
249 249 | bw.close(); |
250 250 | } |
251 251 | File tmpNms = new File( craftBukkit, "tmp-nms" ); |
252 252 | FileUtils.copyDirectory( nmsDir, tmpNms ); |
253 253 | |
254 + | // Dos2Unix the shit out of anything |
255 + | walkAndDos2Unix( craftBukkit ); |
256 + | |
254 257 | craftBukkitGit.branchDelete().setBranchNames( "patched" ).setForce( true ).call(); |
255 258 | craftBukkitGit.checkout().setCreateBranch( true ).setForce( true ).setName( "patched" ).call(); |
256 259 | craftBukkitGit.add().addFilepattern( "src/main/java/net/" ).call(); |
257 260 | craftBukkitGit.commit().setMessage( "CraftBukkit $ " + new Date() ).call(); |
258 261 | craftBukkitGit.checkout().setName( "master" ).call(); |
259 262 | |
260 263 | FileUtils.moveDirectory( tmpNms, nmsDir ); |
261 264 | |
262 265 | File spigotApi = new File( spigot, "Bukkit" ); |
263 266 | if ( !spigotApi.exists() ) |
284 287 | System.out.println( "*** Spigot patches applied!" ); |
285 288 | System.out.println( "Compiling Spigot & Spigot-API" ); |
286 289 | runProcess( mvnCmd + " clean install", spigot ); |
287 290 | } catch ( Exception ex ) |
288 291 | { |
289 292 | System.err.println( "Error compiling Spigot, are you running this jar via msysgit?" ); |
290 293 | ex.printStackTrace(); |
291 294 | } |
292 295 | } |
293 296 | |
297 + | private static void walkAndDos2Unix(File folder) |
298 + | { |
299 + | File[] files = folder.listFiles(); |
300 + | if ( files == null ) return; |
301 + | |
302 + | for (File file : files) |
303 + | { |
304 + | if ( file.getAbsolutePath().endsWith( ".java" ) ) |
305 + | { |
306 + | try |
307 + | { |
308 + | runProcess( "dos2unix " + file.getAbsolutePath() + " " + file.getAbsolutePath(), folder ); |
309 + | } catch (Exception e) |
310 + | { |
311 + | e.printStackTrace(); |
312 + | } |
313 + | } |
314 + | |
315 + | if ( file.isDirectory() ) |
316 + | { |
317 + | walkAndDos2Unix( file ); |
318 + | } |
319 + | } |
320 + | } |
321 + | |
294 322 | public static void pull(Git repo) throws Exception |
295 323 | { |
296 324 | System.out.println( "Pulling updates for " + repo.getRepository().getDirectory() ); |
297 325 | |
298 326 | repo.reset().setRef( "origin/master" ).setMode( ResetCommand.ResetType.HARD ).call(); |
299 327 | boolean result = repo.pull().call().isSuccessful(); |
300 328 | |
301 329 | if ( !result ) |
302 330 | { |
303 331 | throw new RuntimeException( "Could not pull updates!" ); |