/** * Explodes the plugin into a directory, if necessary. */ private static void explode(File archive, File destDir) throws IOException { destDir.mkdirs(); // timestamp check File explodeTime = new File(destDir,".timestamp2"); if(explodeTime.exists() && explodeTime.lastModified()==archive.lastModified()) return; // no need to expand // delete the contents so that old files won't interfere with new files Util.deleteRecursive(destDir); try { Project prj = new Project(); unzipExceptClasses(archive, destDir, prj); createClassJarFromWebInfClasses(archive, destDir, prj); } catch (BuildException x) { throw new IOException("Failed to expand " + archive,x); } try { new FilePath(explodeTime).touch(archive.lastModified()); } catch (InterruptedException e) { throw new AssertionError(e); // impossible } }
iapf.touch(System.currentTimeMillis()); iapf.chmod(0640); iapf.write(randomUUID + System.lineSeparator(), "UTF-8");
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { for (FilePath f : build.getWorkspace().list()) { f.touch(System.currentTimeMillis()); } return true; } }
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { for (FilePath f : build.getWorkspace().list()) { f.touch(System.currentTimeMillis()); } return true; } }
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { for (FilePath f : build.getWorkspace().list()) { f.touch(System.currentTimeMillis()); } return true; } }
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { for (FilePath f : build.getWorkspace().list()) { f.touch(System.currentTimeMillis()); } return true; } }
@Override public void convert(File inputFile, File outFile, Map<String, Object> params) throws ConversionException { try { FileUtils.copyFile(inputFile, outFile); new FilePath(outFile).touch(System.currentTimeMillis()); } catch (IOException ioe) { throw new ConversionException(ioe); } catch (InterruptedException ie) { throw new ConversionException(ie); } }
@Override public void checkout(Run<?, ?> build, Launcher launcher, FilePath remoteDir, TaskListener listener, File changeLogFile, SCMRevisionState baseline) throws IOException, InterruptedException { new FilePath(changeLogFile).touch(0); build.addAction(new ChangelogAction(entries, changeLogFile.getName())); entries = new ArrayList<EntryImpl>(); }
/** * Explodes the plugin into a directory, if necessary. */ private static void explode(File archive, File destDir) throws IOException { destDir.mkdirs(); // timestamp check File explodeTime = new File(destDir,".timestamp2"); if(explodeTime.exists() && explodeTime.lastModified()==archive.lastModified()) return; // no need to expand // delete the contents so that old files won't interfere with new files Util.deleteRecursive(destDir); try { Project prj = new Project(); unzipExceptClasses(archive, destDir, prj); createClassJarFromWebInfClasses(archive, destDir, prj); } catch (BuildException x) { throw new IOException("Failed to expand " + archive,x); } try { new FilePath(explodeTime).touch(archive.lastModified()); } catch (InterruptedException e) { throw new AssertionError(e); // impossible } }
/** * Explodes the plugin into a directory, if necessary. */ private static void explode(File archive, File destDir) throws IOException { if(!destDir.exists()) destDir.mkdirs(); // timestamp check File explodeTime = new File(destDir,".timestamp"); if(explodeTime.exists() && explodeTime.lastModified()==archive.lastModified()) return; // no need to expand // delete the contents so that old files won't interfere with new files Util.deleteContentsRecursive(destDir); try { Expand e = new Expand(); e.setProject(new Project()); e.setTaskType("unzip"); e.setSrc(archive); e.setDest(destDir); e.execute(); } catch (BuildException x) { throw new IOException2("Failed to expand " + archive,x); } try { new FilePath(explodeTime).touch(archive.lastModified()); } catch (InterruptedException e) { throw new AssertionError(e); // impossible } }
/** * Explodes the plugin into a directory, if necessary. */ private static void explode(File archive, File destDir) throws IOException { if (!destDir.exists()) { destDir.mkdirs(); } // timestamp check File explodeTime = new File(destDir, ".timestamp"); if (explodeTime.exists() && explodeTime.lastModified() == archive.lastModified()) { return; // no need to expand } // delete the contents so that old files won't interfere with new files Util.deleteContentsRecursive(destDir); try { Expand e = new Expand(); e.setProject(new Project()); e.setTaskType("unzip"); e.setSrc(archive); e.setDest(destDir); e.execute(); } catch (BuildException x) { throw new IOException2("Failed to expand " + archive, x); } try { new FilePath(explodeTime).touch(archive.lastModified()); } catch (InterruptedException e) { throw new AssertionError(e); // impossible } }
@Override protected FileWrapper run() throws Exception { FilePath file = ws.child(step.getFile()); long timestamp = step.getTimestamp() != null ? step.getTimestamp() : System.currentTimeMillis(); file.getParent().mkdirs(); file.touch(timestamp); return new FileWrapper(file); } }
private ConanClient getConanClient() throws Exception { ConanClient conanClient = step.getClient(); FilePath conanHomeDirectory; if (StringUtils.isEmpty(conanClient.getUserPath())) { conanHomeDirectory = env.containsKey(Utils.CONAN_USER_HOME) ? new FilePath(new File(env.get(Utils.CONAN_USER_HOME))) : createConanTempHome(); } else { conanHomeDirectory = new FilePath(launcher.getChannel(), conanClient.getUserPath()); if (!conanHomeDirectory.exists()) { conanHomeDirectory.mkdirs(); } } conanClient.setUserPath(conanHomeDirectory.getRemote()); conanHomeDirectory.child(ConanClient.CONAN_LOG_FILE).touch(Calendar.getInstance().getTimeInMillis()); return conanClient; }
@Override protected FileWrapper run() throws Exception { FilePath ws = getContext().get(FilePath.class); assert ws != null; FilePath file = ws.child(step.getFile()); long timestamp = step.getTimestamp() != null ? step.getTimestamp() : System.currentTimeMillis(); file.getParent().mkdirs(); file.touch(timestamp); return new FileWrapper(file); } }
private void addFiles(String... paths) throws Exception { SvnClientManager svnm = SubversionSCM.createClientManager((AbstractProject) null); for (String path : paths) { FilePath newFile = workingcopy.child(path); newFile.touch(System.currentTimeMillis()); svnm.getWCClient().doAdd(new File(newFile.getRemote()), false, false, false, SVNDepth.INFINITY, false, false); } }
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { System.out.println("in perform..."); // First touch all the files, so they will be recently modified for (FilePath f : build.getWorkspace().list()) { f.touch(System.currentTimeMillis()); } System.out.println("...touched everything"); hudson.tasks.junit.TestResult result = (new JUnitParser()).parseResult(testResultLocation, build, null, build.getWorkspace(), launcher, listener); System.out.println("back from parse"); assertNotNull("we should have a non-null result", result); assertTrue("result should be a TestResult", result instanceof hudson.tasks.junit.TestResult); System.out.println("We passed some assertions in the JUnitParserTestBuilder"); theResult = result; return result != null; } }
public void touchAndCommit(FilePath repo, String... names) throws Exception { for (String name : names) { FilePath toTouch = repo.child(name); if (!toTouch.exists()) { toTouch.getParent().mkdirs(); toTouch.touch(0); hg(repo, "add", name); } else { toTouch.write(toTouch.readToString() + "extra line\n", "UTF-8"); } } hg(repo, "commit", "--message", "added " + Arrays.toString(names)); }
/** * Manufactures commits by adding files in the given names. */ private void createCommit(SubversionSCM scm, String... paths) throws Exception { FreeStyleProject forCommit = r.createFreeStyleProject(); forCommit.setScm(scm); forCommit.setAssignedLabel(r.jenkins.getSelfLabel()); FreeStyleBuild b = r.assertBuildStatusSuccess(forCommit.scheduleBuild2(0).get()); SvnClientManager svnm = SubversionSCM.createClientManager((AbstractProject)null); List<File> added = new ArrayList<>(); for (String path : paths) { FilePath newFile = b.getWorkspace().child(path); added.add(new File(newFile.getRemote())); if (!newFile.exists()) { newFile.touch(System.currentTimeMillis()); svnm.getWCClient().doAdd(new File(newFile.getRemote()),false,false,false, SVNDepth.INFINITY, false,false); } else newFile.write("random content","UTF-8"); } SVNCommitClient cc = svnm.getCommitClient(); cc.doCommit(added.toArray(new File[added.size()]),false,"added",null,null,false,false,SVNDepth.EMPTY); }