CreateFile.groovy 491 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package de.zmt.gradle.task;

import org.gradle.api.*;
import org.gradle.api.tasks.*;

/**
  * Simple task that creates a file loaded from resource.
  */
public class CreateFile extends DefaultTask {
    def resourceName
    def clazz = CreateFile.class

    @OutputDirectory
    def outputDir = project.file("$project.buildDir/tmp/")
    
    @TaskAction
    public void createFile() {
        outputDir.toPath().resolve(resourceName).append(clazz.getResourceAsStream(resourceName))
    }
}