aboutsummaryrefslogtreecommitdiff
path: root/build.gradle.kts
blob: a4b976ff7a1ff44eaa80f68935d1b60105ef9e5b (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import io.franzbecker.gradle.lombok.task.DelombokTask
import org.checkerframework.gradle.plugin.CheckerFrameworkExtension

plugins {
    id("java")
    id("org.checkerframework") version "0.6.13"
    id("io.franzbecker.gradle-lombok") version "5.0.0"
    `maven-publish`
    signing
}

group = "moe.nea"
version = "1.0.0"

repositories {
    mavenCentral()
}

dependencies {
    implementation("com.google.code.gson:gson:2.9.0")
    testImplementation("io.kotest:kotest-runner-junit5:5.3.1")
}

lombok {
    version = "1.18.22"
    sha256 = ""
}

java {
    withJavadocJar()
}

configure<CheckerFrameworkExtension> {

}

val delombok by tasks.registering(DelombokTask::class) {
    mainClass.set(lombok.main)
    dependsOn(tasks.compileJava)
    val outputDir by extra { layout.buildDirectory.dir("delombok").get() }
    outputs.dir(outputDir)
    sourceSets["main"].java.srcDirs.forEach {
        inputs.dir(it)
        args(it, "-d", outputDir)
    }
    doFirst {
        delete(outputDir)
    }
}

tasks.javadoc {
    dependsOn(delombok)
    val outputDir: Directory by delombok.get().extra
    source = outputDir.asFileTree
}

val sourcesJar by tasks.creating(Jar::class) {
    dependsOn(delombok)
    from(delombok)
    archiveClassifier.set("sources")
}

tasks.withType<JavaCompile>() {
    sourceCompatibility = "1.8"
    targetCompatibility = "1.8"
}

tasks.getByName<Test>("test") {
    useJUnitPlatform()
}
tasks.processResources {
    filesMatching("neurepoparser.properties") {
        expand(
            "VERSION" to version
        )
    }
}

publishing {
    publications {
        create<MavenPublication>("maven") {
            from(components["java"])
            artifact(sourcesJar) {
                classifier = "sources"
            }
            pom {
                name.set("NEU Repo Parsing")
                description.set("A library for standardized parsing of the NotEnoughUpdates item repository")
                url.set("https://github.com/NotEnoughUpdates/RepoParser")

                licenses {
                    license {
                        name.set("BSD 2-Clause")
                        url.set("https://github.com/NotEnoughUpdates/RepoParser/blob/master/LICENSE")
                    }
                }
                developers {
                    developer {
                        name.set("Linnea Gräf")
                    }
                }
                scm {
                    url.set("https://github.com/NotEnoughUpdates/RepoParser")
                }
            }
        }
    }
    repositories {
        maven("https://repo.nea.moe/releases") {
            name = "neamoeReleases"
            credentials(PasswordCredentials::class)
            authentication {
                create<BasicAuthentication>("basic")
            }
        }
    }
}