Simplify how we refer to the outputs of certain tasks

This commit is contained in:
Ben Liblit 2018-04-06 16:46:35 -05:00
parent 929fdb99af
commit 5df33f85d7
7 changed files with 22 additions and 18 deletions

View File

@ -13,7 +13,7 @@ task downloadJLex(type: VerifiedDownload) {
}
task cleanDownloadJLex(type: Delete) {
delete files(downloadJLex).singleFile.parent
delete downloadJLex.dest.parent
}
compileTestJava.dependsOn downloadJLex

View File

@ -17,7 +17,7 @@ task downloadNodeJS(type: VerifiedDownload) {
}
task unpackNodeJSLib(type: Copy, dependsOn: downloadNodeJS) {
from(zipTree(files(downloadNodeJS).singleFile)) {
from(zipTree(downloadNodeJS.dest)) {
include 'nodejs-node-0a604e9/lib/*.js'
eachFile {
relativePath new RelativePath(!directory, relativePath.lastName)

View File

@ -9,7 +9,7 @@ task downloadAjaxslt(type: VerifiedDownload) {
}
task unpackAjaxslt(type: Sync, dependsOn: downloadAjaxslt) {
from(tarTree(files(downloadAjaxslt).singleFile)) {
from(tarTree(downloadAjaxslt.dest)) {
eachFile {
def newSegments = relativePath.segments[1 .. -1] as String[]
relativePath new RelativePath(!directory, newSegments)

View File

@ -25,7 +25,7 @@ javadoc {
}
dependsOn js.createPackageList
options.linksOffline js.javadoc.outputDirectory.path, files(js.createPackageList).singleFile.parent
options.linksOffline js.javadoc.outputDirectory.path, js.createPackageList.packageList.parent
}
def currentJavaHome = org.gradle.internal.jvm.Jvm.current().javaHome

View File

@ -20,7 +20,7 @@ task downloadBcel(type: VerifiedDownload) {
}
task extractBcel(type: Copy, dependsOn: downloadBcel) {
from(tarTree(files(downloadBcel).singleFile)) {
from(tarTree(downloadBcel.dest)) {
include "bcel-${downloadBcel.version}/bcel-${downloadBcel.version}.jar"
eachFile {
relativePath new RelativePath(!directory, relativePath.lastName)
@ -93,20 +93,24 @@ task downloadOcamlJava(type: VerifiedDownload) {
}
task unpackOcamlJava(type: Sync, dependsOn: downloadOcamlJava) {
from tarTree(files(downloadOcamlJava).singleFile)
from tarTree(downloadOcamlJava.dest)
into temporaryDir
}
task generateHelloHashJar(type: JavaExec, dependsOn: unpackOcamlJava) {
inputs.file 'ocaml/hello_hash.ml'
outputs.file 'hello_hash.jar'
args inputs.files.singleFile, '-o', outputs.files.singleFile
def ocamlSource = file('ocaml/hello_hash.ml')
inputs.file ocamlSource
def jarTarget = file('hello_hash.jar')
outputs.file jarTarget
outputs.cacheIf { true }
def ocamlJavaHome = new File(files(unpackOcamlJava).singleFile, downloadOcamlJava.basename)
classpath new File(ocamlJavaHome, 'lib/ocamljava.jar')
def ocamlJavaJar = new File("$unpackOcamlJava.destinationDir/$downloadOcamlJava.basename/lib/ocamljava.jar")
inputs.file ocamlJavaJar
classpath ocamlJavaJar
main 'ocaml.compilers.ocamljavaMain'
inputs.dir ocamlJavaHome
args ocamlSource, '-o', jarTarget
}
task cleanGenerateHelloHashJar(type: Delete) {

View File

@ -16,7 +16,7 @@ task downloadDroidBench(type: VerifiedDownload) {
}
task unpackDroidBench(type: Sync, dependsOn: downloadDroidBench) {
from(zipTree(files(downloadDroidBench).singleFile)) {
from(zipTree(downloadDroidBench.dest)) {
eachFile {
relativePath new RelativePath(!directory, relativePath.segments[1..-1] as String[])
}
@ -49,7 +49,7 @@ task downloadAndroidSdk(type: VerifiedDownload) {
}
task installAndroidSdk(type: Sync, dependsOn: downloadAndroidSdk) {
from zipTree(files(downloadAndroidSdk).singleFile)
from zipTree(downloadAndroidSdk.dest)
into temporaryDir
def buildToolsVersion = '26.0.2'
@ -95,7 +95,7 @@ compileTestJava.dependsOn copyDxJar
afterEclipseBuildshipImport.dependsOn copyDxJar
task copyAndroidJar(type: Sync, dependsOn: installAndroidSdk) {
from "${files(installAndroidSdk).singleFile}/platforms/${installAndroidSdk.components['platforms']}/android.jar"
from "${installAndroidSdk.destinationDir}/platforms/${installAndroidSdk.components['platforms']}/android.jar"
into temporaryDir
}
@ -119,14 +119,14 @@ dependencies {
testCompile(
'junit:junit:4.11',
'org.osgi:org.osgi.core:4.2.0',
files("${files(copyDxJar).singleFile}/dx.jar"),
files("${copyDxJar.destinationDir}/dx.jar"),
project(':com.ibm.wala.core'),
project(':com.ibm.wala.dalvik'),
project(':com.ibm.wala.shrike'),
project(':com.ibm.wala.util'),
project(configuration: 'testArchives', path: ':com.ibm.wala.core.tests'),
)
testRuntime files("${files(copyAndroidJar).singleFile}/android.jar")
testRuntime files("${copyAndroidJar.destinationDir}/android.jar")
}
processTestResources {

View File

@ -17,5 +17,5 @@ task createPackageList(type: CreatePackageList) {
javadoc {
dependsOn createPackageList
options.linksOffline outputDirectory.path, files(createPackageList).singleFile.parent
options.linksOffline outputDirectory.path, createPackageList.packageList.parent
}