Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.github.stephanenicolas.ormgap;
 
 import java.io.File;
 import  org.gradle.api.DefaultTask;
 import  org.gradle.api.file.ConfigurableFileTree;
 import  org.gradle.api.file.FileCollection;
 import  org.gradle.api.tasks.InputFiles;
import  org.gradle.api.tasks.OutputDirectory;
import  org.gradle.api.tasks.StopExecutionException;
import  org.gradle.api.tasks.TaskAction;

Generate an ORM Lite configuration file.

Author(s):
SNI
public class CreateOrmLiteConfigTask extends DefaultTask {
    private File configFileName;
    private Object sourceDir;
    private String classpath;
    private File rawDir;
    public CreateOrmLiteConfigTask() {
    }
    @OutputDirectory
    public File getOutputDirectory() {
        File rawFolder = new File(this.getProject().getProjectDir(), "src/main/res/raw/");
        if (!rawFolder.exists()) {
            throw new StopExecutionException("Raw folder not found: " + rawFolder);
        }
        File configFile = new File(rawFolder"ormlite_config.txt");
        return configFile.getParentFile();
    }
    public void setClasspath(String classpaththrows IOException {
        this. = classpath;
    }
    @InputFiles
    public FileCollection getSources() {
        ConfigurableFileTree result = getProject().fileTree(this.);
        result.include("**/*.java");
        return result;
    }
    public void into(String configFileName) {
        this. = new File(configFileName);
    }
    public void setSources(Object relativePath) {
        this. = getProject().file(relativePath);
    }
    public void setResFolder(Object relativePath) {
        File resFolder = getProject().file(relativePath);
         = new File(resFolder"raw");
    }
    @TaskAction
    protected void exec() throws IOExceptionSQLExceptionInterruptedException {
        final CreateOrmLiteConfigAction createOrmLiteConfigAction
            = new CreateOrmLiteConfigAction(,
                                            getProject().file(),
                                            );
        createOrmLiteConfigAction.execute();
        this.setDidWork(true);
    }
New to GrepCode? Check out our FAQ X