This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open class AndroidMessage : DefaultTask() { | |
| @Input | |
| val what: Property<String> = project.objects.property() | |
| @Internal | |
| val completeValue: Provider<String> = what.map { " Android $it" } | |
| @TaskAction | |
| fun printMessage() { | |
| logger.quiet(completeValue.get()) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val extension = project.extensions.create("android", AndroidMessageExtension::class) | |
| tasks.register<AndroidMessage>("what") { | |
| what.set(extension.message) | |
| } | |
| configure<AndroidMessageExtension> { | |
| message.set("Rules!!!") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| abstract class TaskProducer : DefaultTask() { | |
| @get:OutputDirectory | |
| abstract val output : DirectoryProperty | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| abstract class TaskProducer : DefaultTask() { | |
| @get:OutputDirectory | |
| abstract val output : DirectoryProperty | |
| } | |
| abstract class TaskConsumer : DefaultTask() { | |
| @get:InputDirectory | |
| @get:PathSensitive(PathSensitivity.RELATIVE) | |
| abstract val input: DirectoryProperty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def taskProducer = tasks.register("taskProducer", TaskProducer) { | |
| output.set(new File(project.buildDir, "test.log")) | |
| } | |
| def artifact = taskProducer.flatMap { it.output } | |
| tasks.register("taskConsumer", TaskConsumer) { | |
| input.set(artifact) | |
| showFile() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class GenerateMD5 @Inject constructor( | |
| private val sourceFile: File, | |
| private val md5File: File) | |
| : Runnable { | |
| override fun run() { | |
| try { | |
| val stream = FileInputStream(sourceFile) | |
| Thread.sleep(3000) | |
| FileUtils.writeStringToFile(md5File, DigestUtils.md5Hex(stream), null as String?) | |
| } catch (e: Exception) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| abstract class CreateMD5 @Inject constructor( | |
| private val workerExecutor: WorkerExecutor | |
| ) : SourceTask() { | |
| @get:OutputDirectory | |
| abstract val destination: RegularFileProperty | |
| @TaskAction | |
| fun createHashes() { | |
| source.files.forEach { | |
| val file = File(destination.get().asFile, "$it.md5") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tasks.register("md5", CreateMD5) { | |
| destination = file("${buildDir}/md5") | |
| source file("src/main/java") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Properties | |||
|---|---|---|---|
| cpuCount | osVersion | maxWorkers | |
| javaRuntime | javaVmName | javaXmsBytes | |
| javaXmxBytes | javaMaxPermSize | totalRamAvailableBytes | |
| locale | username | publicIp | |
| gradleVersion | cacheMode | cachePushEnabled | |
| cacheUrl | cacheHit | cacheMiss | |
| cacheStore | gitBranch | gitUser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Switches | ||
|---|---|---|
| buildCache | configurationOnDemand | |
| parallel | continueOnFailure | |
| offline | rerunTasks | |
| buildScan | daemon | |
| refreshDependencies | dryRun |