CreateFile.groovy 508 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
    
    @TaskAction
    public void createFile() {
15
16
17
18
19
20
        getOutputFile().append(clazz.getResourceAsStream(resourceName))
    }
    
    @OutputFile
    public File getOutputFile() {
        project.file("$project.buildDir/tmp/" + resourceName)
21
22
    }
}