aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/ch/fhnw/thga/gradleplugins/FregeExtension.java
blob: ea02493bf83ce48456d93444821f8fc16cfa5a1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package ch.fhnw.thga.gradleplugins;

import java.util.List;

import javax.inject.Inject;

import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.ProjectLayout;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Property;

public abstract class FregeExtension {
    public static final String DEFAULT_DOWNLOAD_DIRECTORY = "lib";
    public static final String DEFAULT_RELATIVE_OUTPUT_DIR = "classes/main/frege";
    public static final String DEFAULT_RELATIVE_SOURCE_DIR = "src/main/frege";
    public static final List<String> DEFAULT_COMPILER_FLAGS = List.of("-O", "-make");

    public abstract Property<String> getVersion();

    public abstract Property<String> getRelease();

    public abstract Property<String> getMainModule();

    public abstract DirectoryProperty getCompilerDownloadDir();

    public abstract DirectoryProperty getMainSourceDir();

    public abstract DirectoryProperty getOutputDir();

    public abstract ListProperty<String> getCompilerFlags();

    @Inject
    public FregeExtension(ProjectLayout projectLayout) {
        getCompilerDownloadDir().convention(projectLayout.getProjectDirectory().dir(DEFAULT_DOWNLOAD_DIRECTORY));
        getMainSourceDir().convention(projectLayout.getProjectDirectory().dir(DEFAULT_RELATIVE_SOURCE_DIR));
        getOutputDir().convention(projectLayout.getBuildDirectory().dir(DEFAULT_RELATIVE_OUTPUT_DIR));
        getCompilerFlags().convention(DEFAULT_COMPILER_FLAGS);
    }
}