summaryrefslogtreecommitdiff
path: root/build.gradle
blob: d6c273dac3003dbfb473bf2edbe0bd1071baf85e (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
plugins {
    id "com.peterabeles.gversion" version "1.10"
    id 'com.github.johnrengelman.shadow' version '7.1.0'
    id 'java'
}

group 'com.keuin'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
    maven {
        name 'velocity'
        url 'https://repo.velocitypowered.com/snapshots'
    }
    maven {
        name 'bungeecord-repo'
        url "https://oss.sonatype.org/content/repositories/snapshots"
    }
}

gversion {
    srcDir       = "src/main/java/"           // path is relative to the sub-project by default
    // Gradle variables can also be used
    // E.g. "${project.rootDir}/module/src/main/java"
    classPackage = "com.keuin.crosslink.util.version"
    className    = "VersionInfo"              // optional. If not specified GVersion is used
    dateFormat   = "yyyy-MM-dd'T'HH:mm:ss'Z'" // optional. This is the default
    timeZone     = "UTC+8"                    // optional. UTC is default
    debug        = false                      // optional. print out extra debug information
    language     = "java"                     // optional. Can be Java, Kotlin, YAML, or Properties. Case insensitive.
    explicitType = false                      // optional. Force types to be explicitly printed
    indent       = "    "                     // optional. Change how code is indented. 1 tab is default.
    annotate     = false                      // optional. Java only. Adds @Generated annotation
}

configurations {
    provided
    implementation.extendsFrom provided
    testImplementation.extendsFrom provided
    testImplementation.extendsFrom shadow
    project.compileJava.dependsOn(createVersionFile) // auto generate class VersionInfo when compiling
}

dependencies {
    // provided: the host program (BungeeCord or Velocity) have loaded this library, no need to shade
    // shadow: our custom dependency, should be packed into .jar
    // TODO: reduce .jar file size

    // IDEA annotations
    implementation 'org.jetbrains:annotations:23.0.0'
    // JUnit
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
    // Velocity
    provided 'com.velocitypowered:velocity-api:3.0.0-SNAPSHOT'
    annotationProcessor 'com.velocitypowered:velocity-api:3.0.0-SNAPSHOT'
    // BungeeCord
    provided 'net.md-5:bungeecord-api:1.16-R0.5-SNAPSHOT'
    // https://mvnrepository.com/artifact/net.time4j/time4j-base
    shadow 'net.time4j:time4j-base:5.9'
    // https://mvnrepository.com/artifact/com.google.inject/guice
    shadow 'com.google.inject:guice:5.1.0'
    // https://mvnrepository.com/artifact/net.kyori/adventure-api
    shadow 'net.kyori:adventure-api:4.10.1' // bungeecord does not have this, so shadow
    // https://mvnrepository.com/artifact/net.kyori/adventure-text-serializer-plain
    shadow 'net.kyori:adventure-text-serializer-plain:4.10.1'
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
    shadow 'com.fasterxml.jackson.core:jackson-core:2.13.2'
    // https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
    shadow 'com.fasterxml.jackson.core:jackson-databind:2.13.2'
    // https://mvnrepository.com/artifact/com.github.pengrad/java-telegram-bot-api
    shadow 'com.github.pengrad:java-telegram-bot-api:5.7.0'
    // https://mvnrepository.com/artifact/org.mongodb/bson
    shadow 'org.mongodb:bson:4.5.0'
}

shadowJar {
    configurations = [project.configurations.shadow]

    // mitigate log4j security problem
    exclude 'org/apache/logging/log4j/core/lookup/JndiLookup.class'
}

test {
    useJUnitPlatform()
}