org.gradle.api.AntBuilder类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(225)

本文整理了Java中org.gradle.api.AntBuilder类的一些代码示例,展示了AntBuilder类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AntBuilder类的具体详情如下:
包路径:org.gradle.api.AntBuilder
类名称:AntBuilder

AntBuilder介绍

暂无

代码示例

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-node

  1. private File _download(String url, File destinationFile)
  2. throws IOException {
  3. String protocol = url.substring(0, url.indexOf(':'));
  4. String proxyPassword = System.getProperty(protocol + ".proxyPassword");
  5. String proxyUser = System.getProperty(protocol + ".proxyUser");
  6. if (Validator.isNotNull(proxyPassword) &&
  7. Validator.isNotNull(proxyUser)) {
  8. Project project = getProject();
  9. String nonProxyHosts = System.getProperty(
  10. protocol + ".nonProxyHosts");
  11. String proxyHost = System.getProperty(protocol + ".proxyHost");
  12. String proxyPort = System.getProperty(protocol + ".proxyPort");
  13. AntBuilder antBuilder = project.getAnt();
  14. Map<String, String> args = new HashMap<>();
  15. args.put("nonproxyhosts", nonProxyHosts);
  16. args.put("proxyhost", proxyHost);
  17. args.put("proxypassword", proxyPassword);
  18. args.put("proxyport", proxyPort);
  19. args.put("proxyuser", proxyUser);
  20. antBuilder.invokeMethod("setproxy", args);
  21. }
  22. return FileUtil.get(getProject(), url, destinationFile);
  23. }

代码示例来源:origin: org.gradle/gradle-core

  1. protected Object doInvokeMethod(String methodName, Object name, Object args) {
  2. Object value = super.doInvokeMethod(methodName, name, args);
  3. // Discard the node so it can be garbage collected. Some Ant tasks cache a potentially large amount of state
  4. // in fields.
  5. try {
  6. nodeField.set(this, null);
  7. children.clear();
  8. } catch (IllegalAccessException e) {
  9. throw new RuntimeException(e);
  10. }
  11. return value;
  12. }

代码示例来源:origin: org.gradle/gradle-core

  1. @Override
  2. protected void nodeCompleted(Object parent, Object node) {
  3. ClassLoader original = Thread.currentThread().getContextClassLoader();
  4. Thread.currentThread().setContextClassLoader(Project.class.getClassLoader());
  5. try {
  6. super.nodeCompleted(parent, node);
  7. } finally {
  8. Thread.currentThread().setContextClassLoader(original);
  9. }
  10. }

代码示例来源:origin: gradle.plugin.de.otto.shopoffice/otto-classycle-plugin

  1. classycle.setMergeInnerClasses(true);
  2. classycle.setDefinitionFile(definitionFile);
  3. classycle.setProject(task.getProject().getAnt().getAntProject());
  4. for (final File classesDir : existingClassesDirs) {
  5. final FileSet fileSet = new FileSet();

代码示例来源:origin: MinecraftForge/ForgeGradle

  1. public static AntBuilder setupAnt(Task task)
  2. {
  3. AntBuilder ant = task.getAnt();
  4. LogLevel startLevel = task.getProject().getGradle().getStartParameter().getLogLevel();
  5. if (startLevel.compareTo(LogLevel.LIFECYCLE) >= 0)
  6. {
  7. GradleVersion v2_14 = GradleVersion.version("2.14");
  8. if (GradleVersion.current().compareTo(v2_14) >= 0)
  9. {
  10. ant.setLifecycleLogLevel(AntMessagePriority.ERROR);
  11. }
  12. else
  13. {
  14. try {
  15. LoggingManager.class.getMethod("setLevel", LogLevel.class).invoke(task.getLogging(), LogLevel.ERROR);
  16. } catch (Exception e) {
  17. //Couldn't find it? We are on some weird version oh well.
  18. task.getLogger().info("Could not set log level:", e);
  19. }
  20. }
  21. }
  22. return ant;
  23. }

代码示例来源:origin: gradle.plugin.pl.squirrel/classycle-gradle-plugin

  1. @Override
  2. public void execute(Task task) {
  3. if (!classDir.isDirectory()) {
  4. log.debug("Class directory doesn't exist, skipping: " + classDir);
  5. return;
  6. }
  7. reportFile.getParentFile().mkdirs();
  8. try {
  9. log.debug("Running classycle analysis on: " + classDir);
  10. DependencyCheckingTask classycle = new DependencyCheckingTask();
  11. classycle.setReportFile(reportFile);
  12. classycle.setFailOnUnwantedDependencies(true);
  13. classycle.setMergeInnerClasses(true);
  14. classycle.setDefinitionFile(definitionFile);
  15. classycle.setProject(project.getAnt().getAntProject());
  16. FileSet fileSet = new FileSet();
  17. fileSet.setDir(classDir);
  18. fileSet.setProject(classycle.getProject());
  19. classycle.add(fileSet);
  20. classycle.execute();
  21. } catch (Exception e) {
  22. throw new RuntimeException(
  23. "Classycle check failed: " + e.getMessage() + ". See report at "
  24. + clickableFileUrl(reportFile), e);
  25. }
  26. }
  27. });

代码示例来源:origin: com.liferay/com.liferay.gradle.plugins.node

  1. private File _download(String url, File destinationFile)
  2. throws IOException {
  3. String protocol = url.substring(0, url.indexOf(':'));
  4. String proxyPassword = System.getProperty(protocol + ".proxyPassword");
  5. String proxyUser = System.getProperty(protocol + ".proxyUser");
  6. if (Validator.isNotNull(proxyPassword) &&
  7. Validator.isNotNull(proxyUser)) {
  8. Project project = getProject();
  9. String nonProxyHosts = System.getProperty(
  10. protocol + ".nonProxyHosts");
  11. String proxyHost = System.getProperty(protocol + ".proxyHost");
  12. String proxyPort = System.getProperty(protocol + ".proxyPort");
  13. AntBuilder antBuilder = project.getAnt();
  14. Map<String, String> args = new HashMap<>();
  15. args.put("nonproxyhosts", nonProxyHosts);
  16. args.put("proxyhost", proxyHost);
  17. args.put("proxypassword", proxyPassword);
  18. args.put("proxyport", proxyPort);
  19. args.put("proxyuser", proxyUser);
  20. antBuilder.invokeMethod("setproxy", args);
  21. }
  22. return FileUtil.get(getProject(), url, destinationFile);
  23. }

代码示例来源:origin: MinecraftForge/ForgeGradle

  1. public String getBuildNumber() throws IOException
  2. {
  3. if (this.buildNumber == null)
  4. {
  5. AntBuilder ant = getProject().getAnt();
  6. File buildNumberFile = new File(this.getTemporaryDir(), "build.number");
  7. BuildNumber buildNumber = (BuildNumber)ant.invokeMethod("buildnumber");
  8. buildNumber.setFile(buildNumberFile);
  9. buildNumber.execute();
  10. Properties props = new Properties();
  11. props.load(Files.newReader(buildNumberFile, Charsets.ISO_8859_1));
  12. this.buildNumber = props.getProperty("build.number");
  13. }
  14. return this.buildNumber;
  15. }
  16. }

代码示例来源:origin: MinecraftForge/ForgeGradle

  1. @TaskAction
  2. public void doTask() throws IOException
  3. {
  4. final Map<String, Entry<byte[], Long>> ignoredStuff = Maps.newHashMap();
  5. File input = getInputFile();
  6. File toSign = new File(getTemporaryDir(), input.getName() + ".unsigned.tmp");
  7. File signed = new File(getTemporaryDir(), input.getName() + ".signed.tmp");
  8. File output = getOutputFile();
  9. // load in input jar, and create temp jar
  10. processInputJar(input, toSign, ignoredStuff);
  11. // SIGN!
  12. Map<String, Object> map = Maps.newHashMap();
  13. map.put("alias", getAlias());
  14. map.put("storePass", getStorePass());
  15. map.put("jar", toSign.getAbsolutePath());
  16. map.put("signedJar", signed.getAbsolutePath());
  17. if (!Strings.isNullOrEmpty(getKeyPass()))
  18. map.put("keypass", getKeyPass());
  19. if (!Strings.isNullOrEmpty(getKeyStore()))
  20. map.put("keyStore", getKeyStore());
  21. getProject().getAnt().invokeMethod("signjar", map);
  22. // write out
  23. writeOutputJar(signed, output, ignoredStuff);
  24. }

代码示例来源:origin: MinecraftForge/ForgeGradle

  1. getExtPath();
  2. ant.invokeMethod("javac",
  3. ImmutableMap.builder()
  4. .put("srcDir", tempSrc.getCanonicalPath())

代码示例来源:origin: MinecraftForge/ForgeGradle

  1. ant.invokeMethod("javac", ImmutableMap.builder()
  2. .put("srcDir", resourceDir.getCanonicalPath())
  3. .put("destDir", compiled.getCanonicalPath())

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-tlddoc-builder

  1. args.put("publicId", publicId);
  2. antBuilder.invokeMethod("dtd", args);
  3. args.put("namespace", namespace);
  4. antBuilder.invokeMethod("schema", args);

代码示例来源:origin: ibinti/bugvm

  1. getAnt().invokeMethod("delete", new java.util.HashMap<String, Object>() {
  2. getAnt().invokeMethod("chmod", new java.util.HashMap<String, Object>() {

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-tlddoc-builder

  1. antBuilder.invokeMethod("schemavalidate", new Object[] {args, closure});

代码示例来源:origin: gradle.plugin.mpern.sap.commerce/commerce-gradle-plugin

  1. args.put("format", "MD5SUM");
  2. args.put("fileext", ".MD5");
  3. p.getAnt().invokeMethod("checksum", args);
  4. Path resolve = zipPackage.getDestinationDir().toPath().resolve(zipPackage.getArchiveName() + ".MD5");
  5. Path target = zipPackage.getDestinationDir().toPath().resolve(zipPackage.getBaseName() + ".md5");

相关文章