當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。