apply plugin: 'base'

task downloadAjaxslt(type: de.undercouch.gradle.tasks.download.Download) {
	def version = '0.8.1'
	ext {
		versionedArchive = "ajaxslt-$version"
	}
	src "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ajaxslt/${versionedArchive}.tar.gz"
	dest temporaryDir
	overwrite false
}

task verifyAjaxslt(type: VerifyWithStamp, dependsOn: downloadAjaxslt) {
	src files(downloadAjaxslt)[0]
	checksum 'c995abe3310a401bb4db7f28a6409756'
}

task unpackAjaxslt(type: Sync, dependsOn: verifyAjaxslt) {
	from(tarTree(verifyAjaxslt.src)) {
		eachFile {
			def newSegments = relativePath.segments[1 .. -1] as String[]
			relativePath new RelativePath(!directory, newSegments)
		}
	}
	into 'examples-src/ajaxslt'
}

clean.dependsOn cleanUnpackAjaxslt
