Java Code Examples for org.apache.tools.ant.ProjectHelper#getProjectHelper()
The following examples show how to use
org.apache.tools.ant.ProjectHelper#getProjectHelper() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AntBuilder.java From groovy with Apache License 2.0 | 6 votes |
/** * @return Factory method to create new Project instances */ protected static Project createProject() { final Project project = new Project(); final ProjectHelper helper = ProjectHelper.getProjectHelper(); project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper); helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty final BuildLogger logger = new NoBannerLogger(); logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO); logger.setOutputPrintStream(System.out); logger.setErrorPrintStream(System.err); project.addBuildListener(logger); project.init(); project.getBaseDir(); return project; }
Example 2
Source File: ShuffleModel.java From Shuffle-Move with GNU General Public License v3.0 | 6 votes |
/** * Constructs the Project and returns it. * * @return The Project * @throws Exception * If anything goes wrong. */ private Project getErrorProject() throws Exception { Path buildFilePath = Paths.get(BUILD_REPORT_FILE); LOG.finer("Build file path set to " + String.valueOf(buildFilePath)); Project p = new Project(); p.setSystemProperties(); p.setUserProperty("ant.file", buildFilePath.toAbsolutePath().toString()); LOG.finer("Project ant.file property set."); p.init(); LOG.finer("Project.init() called."); ProjectHelper helper = ProjectHelper.getProjectHelper(); LOG.finer("ProjectHelper created."); p.addReference("ant.projectHelper", helper); LOG.finer("Project ant.projectHelper reference set."); p.addReference("user.dir", System.getProperty("user.dir")); LOG.finer("Project user.dir reference set."); helper.parse(p, buildFilePath.toAbsolutePath().toFile()); LOG.finer("PrjectHelper.parse() called."); errorProject = p; p.addBuildListener(getBuildListener()); LOG.finer("BuildListener added."); return errorProject; }
Example 3
Source File: AntHarnessTest.java From ExpectIt with Apache License 2.0 | 6 votes |
private static Project newProject() throws IOException { setupBuildFile(); Project project = new Project(); project.setUserProperty("ant.file", buildFile.getAbsolutePath()); project.init(); DefaultLogger listener = new DefaultLogger(); listener.setErrorPrintStream(System.err); listener.setOutputPrintStream(System.out); listener.setMessageOutputLevel(Project.MSG_INFO); ProjectHelper helper = ProjectHelper.getProjectHelper(); project.addReference("ant.projectHelper", helper); project.setProperty("ftp.port", String.valueOf(ftpPort)); project.setProperty("ssh.port", String.valueOf(sshPort)); helper.parse(project, buildFile); project.addBuildListener(listener); return project; }
Example 4
Source File: AntUtil.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * @return Factory method to create new Project instances */ public static Project createProject() { final Project project = new Project(); final ProjectHelper helper = ProjectHelper.getProjectHelper(); project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper); helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty project.addBuildListener(new AntLoggingAdapter()); project.init(); project.getBaseDir(); return project; }
Example 5
Source File: AntUtil.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * @return Factory method to create new Project instances */ public static Project createProject() { final Project project = new Project(); final ProjectHelper helper = ProjectHelper.getProjectHelper(); project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper); helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty project.addBuildListener(new AntLoggingAdapter()); project.init(); project.getBaseDir(); return project; }
Example 6
Source File: AntUtil.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
/** * @return Factory method to create new Project instances */ public static Project createProject() { final Project project = new Project(); final ProjectHelper helper = ProjectHelper.getProjectHelper(); project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper); helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty project.addBuildListener(new AntLoggingAdapter()); project.init(); project.getBaseDir(); return project; }
Example 7
Source File: AntUtil.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
/** * @return Factory method to create new Project instances */ public static Project createProject() { final Project project = new Project(); final ProjectHelper helper = ProjectHelper.getProjectHelper(); project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper); helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty project.addBuildListener(new AntLoggingAdapter()); project.init(); project.getBaseDir(); return project; }
Example 8
Source File: AntRunner.java From spoofax with Apache License 2.0 | 5 votes |
public AntRunner(IResourceService resourceService, FileObject antFile, FileObject baseDir, Map<String, String> properties, @SuppressWarnings("unused") @Nullable URL[] classpaths, @Nullable BuildListener listener) { this.antProject = new Project(); final File localAntFile = resourceService.localFile(antFile); final File localBaseDir = resourceService.localPath(baseDir); // TODO: use classpaths antProject.setProperty(MagicNames.ANT_FILE, localAntFile.getPath()); antProject.setBaseDir(localBaseDir); antProject.init(); if(listener != null) { antProject.addBuildListener(listener); } final PropertyHelper propHelper = PropertyHelper.getPropertyHelper(antProject); antProject.addReference(MagicNames.REFID_PROPERTY_HELPER, propHelper); for(Entry<String, String> property : properties.entrySet()) { propHelper.setUserProperty(property.getKey(), property.getValue()); } final ProjectHelper projectHelper = ProjectHelper.getProjectHelper(); antProject.addReference(MagicNames.REFID_PROJECT_HELPER, projectHelper); projectHelper.parse(antProject, localAntFile); }
Example 9
Source File: Main.java From scava with Eclipse Public License 2.0 | 4 votes |
public static void main(String[] args) { Vector<Target> targets = new Vector<Target>(); Target m2mTarget = new Target(); m2mTarget.setName(M2M); Target m2tTarget = new Target(); m2tTarget.setName(M2T); Target setupTarget = new Target(); setupTarget.setName(SETUP); File buildFile = new File(BUILD_XML); Project p = new Project(); p.setUserProperty(ANT_FILE, buildFile.getAbsolutePath()); p.init(); ProjectHelper helper = ProjectHelper.getProjectHelper(); p.addReference(ANT_PROJECT_HELPER, helper); helper.parse(p, buildFile); Scanner scanner = new Scanner(System.in); while (true){ System.out.println("Which transformation would you like to start? (M2M / M2T) : "); String target = scanner.next(); if (target.equals(M2M)){ System.out.println("Select the OpenAPI JSON schema to transform."); try { TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setCurrentDirectory(new File(SCHEMAS_DIR)); chooser.showOpenDialog(null); File selectedFile = chooser.getSelectedFile(); if (selectedFile.isFile() && selectedFile.getName().endsWith(".json")){ System.out.println(selectedFile.getName()); targets.add(m2mTarget); break; } else { chooser = null; System.out.println("Something went wrong"); } //p.executeSortedTargets(targets); } else if (target.equals(M2M)){ //p.executeTarget(p.getDefaultTarget()); break; } else { System.out.println("Invalid"); } } scanner.close(); }
Example 10
Source File: CCGBankConvert.java From openccg with GNU Lesser General Public License v2.1 | 4 votes |
public static void main(String[] args) { File baseDir = new File(System.getProperty("user.dir")); File buildFile = new File(baseDir, "build.xml"); Project project = new Project(); project.init(); project.setBaseDir(baseDir); ProjectHelper helper = ProjectHelper.getProjectHelper(); project.setProjectReference(helper); helper.parse(project, buildFile); DefaultLogger logger = new DefaultLogger(); logger.setErrorPrintStream(System.err); logger.setOutputPrintStream(System.out); project.addBuildListener(logger); project.executeTarget("convert-base"); }