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

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

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

AntBuilder介绍

暂无

代码示例

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

private File _download(String url, File destinationFile)
  throws IOException {
  String protocol = url.substring(0, url.indexOf(':'));
  String proxyPassword = System.getProperty(protocol + ".proxyPassword");
  String proxyUser = System.getProperty(protocol + ".proxyUser");
  if (Validator.isNotNull(proxyPassword) &&
    Validator.isNotNull(proxyUser)) {
    Project project = getProject();
    String nonProxyHosts = System.getProperty(
      protocol + ".nonProxyHosts");
    String proxyHost = System.getProperty(protocol + ".proxyHost");
    String proxyPort = System.getProperty(protocol + ".proxyPort");
    AntBuilder antBuilder = project.getAnt();
    Map<String, String> args = new HashMap<>();
    args.put("nonproxyhosts", nonProxyHosts);
    args.put("proxyhost", proxyHost);
    args.put("proxypassword", proxyPassword);
    args.put("proxyport", proxyPort);
    args.put("proxyuser", proxyUser);
    antBuilder.invokeMethod("setproxy", args);
  }
  return FileUtil.get(getProject(), url, destinationFile);
}

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

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

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

@Override
protected void nodeCompleted(Object parent, Object node) {
  ClassLoader original = Thread.currentThread().getContextClassLoader();
  Thread.currentThread().setContextClassLoader(Project.class.getClassLoader());
  try {
    super.nodeCompleted(parent, node);
  } finally {
    Thread.currentThread().setContextClassLoader(original);
  }
}

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

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

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

public static AntBuilder setupAnt(Task task)
{
  AntBuilder ant = task.getAnt();
  LogLevel startLevel = task.getProject().getGradle().getStartParameter().getLogLevel();
  if (startLevel.compareTo(LogLevel.LIFECYCLE) >= 0)
  {
    GradleVersion v2_14 = GradleVersion.version("2.14");
    if (GradleVersion.current().compareTo(v2_14) >= 0)
    {
      ant.setLifecycleLogLevel(AntMessagePriority.ERROR);
    }
    else
    {
      try {
        LoggingManager.class.getMethod("setLevel", LogLevel.class).invoke(task.getLogging(), LogLevel.ERROR);
      } catch (Exception e) {
        //Couldn't find it? We are on some weird version oh well.
        task.getLogger().info("Could not set log level:", e);
      }
    }
  }
  return ant;
}

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

@Override
  public void execute(Task task) {
    if (!classDir.isDirectory()) {
      log.debug("Class directory doesn't exist, skipping: " + classDir);
      return;
    }
    reportFile.getParentFile().mkdirs();
    try {
      log.debug("Running classycle analysis on: " + classDir);
      DependencyCheckingTask classycle = new DependencyCheckingTask();
      classycle.setReportFile(reportFile);
      classycle.setFailOnUnwantedDependencies(true);
      classycle.setMergeInnerClasses(true);
      classycle.setDefinitionFile(definitionFile);
      classycle.setProject(project.getAnt().getAntProject());
      FileSet fileSet = new FileSet();
      fileSet.setDir(classDir);
      fileSet.setProject(classycle.getProject());
      classycle.add(fileSet);
      classycle.execute();
    } catch (Exception e) {
      throw new RuntimeException(
          "Classycle check failed: " + e.getMessage() + ". See report at "
              + clickableFileUrl(reportFile), e);
    }
  }
});

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

private File _download(String url, File destinationFile)
  throws IOException {
  String protocol = url.substring(0, url.indexOf(':'));
  String proxyPassword = System.getProperty(protocol + ".proxyPassword");
  String proxyUser = System.getProperty(protocol + ".proxyUser");
  if (Validator.isNotNull(proxyPassword) &&
    Validator.isNotNull(proxyUser)) {
    Project project = getProject();
    String nonProxyHosts = System.getProperty(
      protocol + ".nonProxyHosts");
    String proxyHost = System.getProperty(protocol + ".proxyHost");
    String proxyPort = System.getProperty(protocol + ".proxyPort");
    AntBuilder antBuilder = project.getAnt();
    Map<String, String> args = new HashMap<>();
    args.put("nonproxyhosts", nonProxyHosts);
    args.put("proxyhost", proxyHost);
    args.put("proxypassword", proxyPassword);
    args.put("proxyport", proxyPort);
    args.put("proxyuser", proxyUser);
    antBuilder.invokeMethod("setproxy", args);
  }
  return FileUtil.get(getProject(), url, destinationFile);
}

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

public String getBuildNumber() throws IOException
  {
    if (this.buildNumber == null)
    {
      AntBuilder ant = getProject().getAnt();

      File buildNumberFile = new File(this.getTemporaryDir(), "build.number");  
      BuildNumber buildNumber = (BuildNumber)ant.invokeMethod("buildnumber");
      buildNumber.setFile(buildNumberFile);
      buildNumber.execute();
      
      Properties props = new Properties();
      props.load(Files.newReader(buildNumberFile, Charsets.ISO_8859_1));
      this.buildNumber = props.getProperty("build.number");
    }
    
    return this.buildNumber;
  }
}

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

@TaskAction
public void doTask() throws IOException
{
  final Map<String, Entry<byte[], Long>> ignoredStuff = Maps.newHashMap();
  File input = getInputFile();
  File toSign = new File(getTemporaryDir(), input.getName() + ".unsigned.tmp");
  File signed = new File(getTemporaryDir(), input.getName() + ".signed.tmp");
  File output = getOutputFile();
  // load in input jar, and create temp jar
  processInputJar(input, toSign, ignoredStuff);
  // SIGN!
  Map<String, Object> map = Maps.newHashMap();
  map.put("alias", getAlias());
  map.put("storePass", getStorePass());
  map.put("jar", toSign.getAbsolutePath());
  map.put("signedJar", signed.getAbsolutePath());
  if (!Strings.isNullOrEmpty(getKeyPass()))
    map.put("keypass", getKeyPass());
  if (!Strings.isNullOrEmpty(getKeyStore()))
    map.put("keyStore", getKeyStore());
  getProject().getAnt().invokeMethod("signjar", map);
  // write out
  writeOutputJar(signed, output, ignoredStuff);
}

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

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

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

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

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

args.put("publicId", publicId);
antBuilder.invokeMethod("dtd", args);
args.put("namespace", namespace);
antBuilder.invokeMethod("schema", args);

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

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

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

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

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

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

相关文章