当前位置: 首页>>代码示例>>Java>>正文


Java ProjectHelper.configureProject方法代码示例

本文整理汇总了Java中org.apache.tools.ant.ProjectHelper.configureProject方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectHelper.configureProject方法的具体用法?Java ProjectHelper.configureProject怎么用?Java ProjectHelper.configureProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tools.ant.ProjectHelper的用法示例。


在下文中一共展示了ProjectHelper.configureProject方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
public void init(String _buildFile, String _baseDir) throws Exception {
    project = new Project();
    project.init();
    DefaultLogger consoleLogger = new DefaultLogger();
    consoleLogger.setErrorPrintStream(System.err);
    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
    project.addBuildListener(consoleLogger);
    if (_baseDir == null)
        _baseDir = new String(".");
    project.setBasedir(_baseDir);
    if (_buildFile == null)
        _buildFile = new String(projectBasePath + File.separator
                + "build.xml");
    ProjectHelper.configureProject(project, new File(_buildFile));
}
 
开发者ID:HongQiQu,项目名称:AndroidAntMakePackage,代码行数:17,代码来源:AntMakeAPK.java

示例2: importBuild

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
public void importBuild(Object antBuildFile, Transformer<? extends String, ? super String> taskNamer) {
    File file = gradleProject.file(antBuildFile);
    final File baseDir = file.getParentFile();

    Set<String> existingAntTargets = new HashSet<String>(getAntProject().getTargets().keySet());
    File oldBaseDir = getAntProject().getBaseDir();
    getAntProject().setBaseDir(baseDir);
    try {
        getAntProject().setUserProperty(MagicNames.ANT_FILE, file.getAbsolutePath());
        ProjectHelper.configureProject(getAntProject(), file);
    } catch (Exception e) {
        throw new GradleException("Could not import Ant build file '" + String.valueOf(file) + "'.", e);
    } finally {
        getAntProject().setBaseDir(oldBaseDir);
    }

    // Chuck away the implicit target. It has already been executed
    getAntProject().getTargets().remove("");

    // Add an adapter for each newly added target
    Set<String> newAntTargets = new HashSet<String>(getAntProject().getTargets().keySet());
    newAntTargets.removeAll(existingAntTargets);
    for (String name : newAntTargets) {
        final Target target = getAntProject().getTargets().get(name);
        String taskName = taskNamer.transform(target.getName());
        final AntTarget task = gradleProject.getTasks().create(taskName, AntTarget.class);
        configureTask(target, task, baseDir, taskNamer);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:30,代码来源:DefaultAntBuilder.java

示例3: setUp

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    project = new Project();
    project.init();
    final File antFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/exec/exec-with-redirector.xml");
    project.setUserProperty("ant.file", antFile.getAbsolutePath());
    final File outputDir = this.createTmpDir();
    project.setUserProperty("output", outputDir.toString());
    ProjectHelper.configureProject(project, antFile);
    project.executeTarget("setUp");
}
 
开发者ID:apache,项目名称:ant,代码行数:12,代码来源:ExecStreamRedirectorTest.java

示例4: MonitoredBuild

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
public MonitoredBuild(File buildFile, String target) {
    myBuildFile = buildFile;
    this.target = target;
    project = new Project();
    project = new Project();
    project.init();
    project.setUserProperty("ant.file", myBuildFile.getAbsolutePath());
    ProjectHelper.configureProject(project, myBuildFile);
}
 
开发者ID:apache,项目名称:ant,代码行数:10,代码来源:ExecTaskTest.java

示例5: shouldHandleModuleIvyFile

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
@Test
public void shouldHandleModuleIvyFile() throws URISyntaxException, IOException {
    File f = new File(this.getClass().getResource("../../simpleproject.ivy").toURI());
    Project p = new Project();
    // disable project ivy instance
    p.setNewProperty(EasyAntMagicNames.PROJECT_IVY_INSTANCE, EasyAntMagicNames.EASYANT_IVY_INSTANCE);
    p.setNewProperty(EasyAntMagicNames.IGNORE_USER_IVYSETTINGS, "true");
    p.setNewProperty(EasyAntMagicNames.GLOBAL_EASYANT_IVYSETTINGS,
            this.getClass().getResource("/repositories/easyant-ivysettings-test.xml").toString());
    p.setProperty("ivy.cache.dir", folder.newFolder("build-cache").getAbsolutePath());
    ProjectHelper.configureProject(p, f);
    assertThat(p.getTargets().get("complexplugin:mytarget"), is(notNullValue()));
    assertThat(p.getProperty("myproperty"), is("foobar"));

}
 
开发者ID:apache,项目名称:ant-easyant-core,代码行数:16,代码来源:ModuleIvyProjectHelperTest.java

示例6: configureProject

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
/**
 * Sets up to run the named project
 *
 * @param filename
 *        name of project file to run
 * @param logLevel
 *        Log level
 * @throws BuildException
 *         on error
 */
public void configureProject (final String filename, final int logLevel) throws BuildException
{
  logBuffer = new StringBuffer ();
  fullLogBuffer = new StringBuffer ();
  project = new Project ();
  project.init ();
  final File antFile = new File (System.getProperty ("root"), filename);
  project.setProperty ("ant.processid", ProcessUtil.getProcessId ("<Process>"));
  project.setProperty ("ant.threadname", Thread.currentThread ().getName ());
  project.setUserProperty ("ant.file", antFile.getAbsolutePath ());
  project.addBuildListener (new AntTestListener (logLevel));
  ProjectHelper.configureProject (project, antFile);
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:24,代码来源:MyBuildFileRule.java

示例7: antBuild

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
/**
 * 核心方法,ant打包关键步骤
 */
private void antBuild() {
    CustomPrintStream out = new CustomPrintStream(new ByteArrayOutputStream(), mLogTextArea);
    
    DefaultLogger consoleLogger = new DefaultLogger() {
        @Override
        public void buildFinished(BuildEvent event) {
            super.buildFinished(event);
            antBuildFinished();
        }
    };
    consoleLogger.setErrorPrintStream(out);
    consoleLogger.setOutputPrintStream(out);
    consoleLogger.setMessageOutputLevel(2);
    
    Project project = new Project();
    project.setProperty("java.home", mJdkPathField.getText());
    project.addBuildListener(consoleLogger);

    try {
        project.fireBuildStarted();
        project.init();
        
        File buildFile = new File(mProjectPathField.getText() + File.separator + BUILD_XML_NAME);
        ProjectHelper.configureProject(project, buildFile);
        project.executeTarget(project.getDefaultTarget());
        project.fireBuildFinished(null);
    } catch (BuildException e) {
        project.fireBuildFinished(e);
    }

    mLogTextArea.append(out.toString());
}
 
开发者ID:MarkMjw,项目名称:AndroidPackager,代码行数:36,代码来源:MainFrame.java

示例8: runAntTarget

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
public void runAntTarget(File buildFile, String target) throws BuildException
{
  DefaultLogger logger = new DefaultLogger();
  logger.setOutputPrintStream(System.out);
  logger.setErrorPrintStream(System.err);
  logger.setMessageOutputLevel(Project.MSG_INFO);
  
  Project p = new Project();
  p.addBuildListener(logger);
  p.init();
  ProjectHelper.configureProject(p, buildFile);
  p.executeTarget(target);
  
  System.out.flush();
}
 
开发者ID:ecologylab,项目名称:BigSemanticsWrapperRepository,代码行数:16,代码来源:AntRunner.java

示例9: importBuild

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
public void importBuild(Object antBuildFile) {
    File file = gradleProject.file(antBuildFile);
    final File baseDir = file.getParentFile();

    Set<String> existingAntTargets = new HashSet<String>(getAntProject().getTargets().keySet());
    File oldBaseDir = getAntProject().getBaseDir();
    getAntProject().setBaseDir(baseDir);
    try {
        getAntProject().setUserProperty(MagicNames.ANT_FILE, file.getAbsolutePath());
        ProjectHelper.configureProject(getAntProject(), file);
    } catch (Exception e) {
        throw new GradleException("Could not import Ant build file '" + String.valueOf(file) + "'.", e);
    } finally {
        getAntProject().setBaseDir(oldBaseDir);
    }

    // Chuck away the implicit target. It has already been executed
    getAntProject().getTargets().remove("");

    // Add an adapter for each newly added target
    Set<String> newAntTargets = new HashSet<String>(getAntProject().getTargets().keySet());
    newAntTargets.removeAll(existingAntTargets);
    for (String name : newAntTargets) {
        Target target = getAntProject().getTargets().get(name);
        AntTarget task = gradleProject.getTasks().create(target.getName(), AntTarget.class);
        task.setTarget(target);
        task.setBaseDir(baseDir);
        addDependencyOrdering(target.getDependencies());
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:31,代码来源:DefaultAntBuilder.java

示例10: runBuild

import org.apache.tools.ant.ProjectHelper; //导入方法依赖的package包/类
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);
        }
    }
 
开发者ID:apache,项目名称:ant-ivy,代码行数:63,代码来源:AntCallTriggerTest.java


注:本文中的org.apache.tools.ant.ProjectHelper.configureProject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。