public void run() { GradleVersion currentVersion = GradleVersion.current(); final StringBuilder sb = new StringBuilder(); sb.append("\n------------------------------------------------------------\nGradle "); sb.append(currentVersion.getVersion()); sb.append("\n------------------------------------------------------------\n\nBuild time: "); sb.append(currentVersion.getBuildTime()); sb.append("\nRevision: "); sb.append(currentVersion.getRevision()); sb.append("\n\nGroovy: "); sb.append(GroovySystem.getVersion()); sb.append("\nAnt: "); sb.append(Main.getAntVersion()); sb.append("\nJVM: "); sb.append(Jvm.current()); sb.append("\nOS: "); sb.append(OperatingSystem.current()); sb.append("\n"); System.out.println(sb.toString()); }
public void run() { GradleVersion currentVersion = GradleVersion.current(); final StringBuilder sb = new StringBuilder(); sb.append("\n------------------------------------------------------------\nGradle "); sb.append(currentVersion.getVersion()); sb.append("\n------------------------------------------------------------\n\nBuild time: "); sb.append(currentVersion.getBuildTime()); sb.append("\nBuild number: "); sb.append(currentVersion.getBuildNumber()); sb.append("\nRevision: "); sb.append(currentVersion.getRevision()); sb.append("\n\nGroovy: "); sb.append(GroovySystem.getVersion()); sb.append("\nAnt: "); sb.append(Main.getAntVersion()); sb.append("\nJVM: "); sb.append(Jvm.current()); sb.append("\nOS: "); sb.append(OperatingSystem.current()); sb.append("\n"); System.out.println(sb.toString()); }
public String prettyPrint() { final StringBuilder sb = new StringBuilder(); sb.append("\n------------------------------------------------------------\nGradle "); sb.append(getVersion()); sb.append("\n------------------------------------------------------------\n\nBuild time: "); sb.append(getBuildTime()); sb.append("\nBuild number: "); sb.append(buildNumber); sb.append("\nRevision: "); sb.append(commitId); sb.append("\n\nGroovy: "); sb.append(GroovySystem.getVersion()); sb.append("\nAnt: "); sb.append(Main.getAntVersion()); sb.append("\nIvy: "); sb.append(Ivy.getIvyVersion()); sb.append("\nJVM: "); sb.append(Jvm.current()); sb.append("\nOS: "); sb.append(OperatingSystem.current()); sb.append("\n"); return sb.toString(); }
static public String captureAnt( Runnable runnable ) { ByteArrayOutputStream buf = new ByteArrayOutputStream(); PrintStream print = new PrintStream( buf ); PrintStream origOut = System.out; PrintStream origErr = System.err; System.setOut( print ); System.setErr( print ); Deencapsulation.setField( Main.class, "out", print ); Deencapsulation.setField( Main.class, "err", print ); try { runnable.run(); print.close(); } finally { System.setOut( origOut ); System.setErr( origErr ); } return buf.toString(); }
public String getAntVersion() { try { return Main.getAntVersion(); } catch (BuildException be) { AntModule.err.notify(ErrorManager.INFORMATIONAL, be); return NbBundle.getMessage(BridgeImpl.class, "LBL_ant_version_unknown"); } }
protected Zip createTask() { String version = Main.getAntVersion(); Jar task; if (version != null && (version.indexOf("1.8.0") != -1 || version.indexOf("1.8.1") != -1)) { task = new PatchedJar(); } else { task = new Jar(); } task.setTaskName("jar"); task.setWhenmanifestonly((Zip.WhenEmpty) Zip.WhenEmpty.getInstance(Zip.WhenEmpty.class, "skip")); return task; }
private void runBuild(File buildFile, Vector<String> targets, int messageLevel) throws BuildException { final Project project = new Project(); project.setCoreLoader(null); Throwable error = null; try { addBuildListeners(project, messageLevel); addInputHandler(project, null); PrintStream err = System.err; PrintStream out = System.out; InputStream in = System.in; // use a system manager that prevents from System.exit() SecurityManager oldsm = null; oldsm = System.getSecurityManager(); // SecurityManager can not be installed here for backwards // compatibility reasons (PD). Needs to be loaded prior to // ant class if we are going to implement it. // System.setSecurityManager(new NoExitSecurityManager()); try { project.setDefaultInputStream(System.in); System.setIn(new DemuxInputStream(project)); System.setOut(new PrintStream(new DemuxOutputStream(project, false))); System.setErr(new PrintStream(new DemuxOutputStream(project, true))); project.fireBuildStarted(); project.init(); project.setUserProperty("ant.version", Main.getAntVersion()); project.setUserProperty("ant.file", buildFile.getAbsolutePath()); ProjectHelper.configureProject(project, buildFile); // make sure that we have a target to execute if (targets.size() == 0 && project.getDefaultTarget() != null) { targets.addElement(project.getDefaultTarget()); } project.executeTargets(targets); } finally { // put back the original security manager // The following will never eval to true. (PD) if (oldsm != null) { System.setSecurityManager(oldsm); } System.setOut(out); System.setErr(err); System.setIn(in); } } catch (RuntimeException | Error exc) { error = exc; throw exc; } finally { project.fireBuildFinished(error); } }
/** * Get the default build file name to use when launching the task. * <p> * This function may be overriden by providers of custom ProjectHelper so they can implement easily their sub * launcher. * * @return the name of the default file * @since Ant 1.8.0 */ protected String getDefaultBuildFile() { return Main.DEFAULT_BUILD_FILENAME; }
/** * Get the default build file name to use when launching the task. * <p> * This function may be overriden by providers of custom ProjectHelper so * they can implement easily their sub launcher. * </p> * * @return the name of the default file * @since Ant 1.8.0 */ protected String getDefaultBuildFile() { return Main.DEFAULT_BUILD_FILENAME; }