如何在自定义gradle任务中定义输入或输出?

时间:2018-06-28 14:31:30

标签: gradle groovy build.gradle

我有下面的自定义gradle任务,我不确定如何添加或定义输入或输出。

task parseZip(type: Copy) {
  group = "Scan"
  description = "Send the zip dependency into components for scan."
  from zipTree(configurations.install.singleFile)
  into "${buildDir}/work"
  includeEmptyDirs = false
  eachFile { rd->
    // all the main dist files as separate artifacts
    if (rd.sourcePath.startsWith("trz") && rd.sourcePath.endsWith(".trz")) {
      rd.setRelativePath new RelativePath(true, "trz", rd.name)
    } else if (rd.sourcePath.startsWith("components")) {
      rd.setRelativePath new RelativePath(true, "components", rd.name)
    } else if (rd.sourcePath.startsWith("install") &&
      (rd.sourcePath.contains("cleanfile") || rd.sourcePath.contains("convert"))){
      rd.setRelativePath new RelativePath(true, "clean-convert", rd.name)
    } else {
      rd.setRelativePath new RelativePath(true, "pics", rd.sourcePath)
    }
  }
}

0 个答案:

没有答案