|
1 | 1 | plugins { |
2 | | - id "java" |
3 | | - id "checkstyle" |
4 | | -} |
5 | | - |
6 | | -base { |
7 | | - java.toolchain.languageVersion = JavaLanguageVersion.of(17) |
8 | | - compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8" |
9 | | - |
10 | | - archivesName = project.maven_name ?: rootProject.maven_name |
11 | | - group = project.maven_group ?: rootProject.maven_group |
12 | | - version = project.maven_version ?: rootProject.maven_version |
13 | | -} |
14 | | - |
15 | | -configurations { |
16 | | - include |
17 | | - |
18 | | - implementation.extendsFrom include |
19 | | - api.extendsFrom include |
| 2 | + id "java-library" |
| 3 | + id "base.java" |
| 4 | + id "base.checkstyle" |
| 5 | + id "configuration.include" |
| 6 | + id "idea.exclude_run_dir" |
| 7 | + id "viaproxy.run-with-viaproxy-task" |
| 8 | + id "extra.fill_build_constants" |
| 9 | + alias libs.plugins.classTokenReplacer |
20 | 10 | } |
21 | 11 |
|
22 | 12 | repositories { |
23 | | - mavenCentral() |
24 | | - maven { |
25 | | - name = "lenni0451" |
26 | | - url = "https://maven.lenni0451.net/everything" |
27 | | - } |
28 | 13 | maven { |
29 | 14 | name = "viaversion" |
30 | 15 | url = "https://repo.viaversion.com" |
31 | 16 | } |
32 | 17 | } |
33 | 18 |
|
34 | 19 | dependencies { |
35 | | - compileOnly "com.google.code.findbugs:jsr305:3.0.2" |
36 | | - compileOnly "org.jetbrains:annotations:26.0.2" |
37 | | - compileOnly(annotationProcessor("org.projectlombok:lombok:1.18.38")) |
38 | | - compileOnly "net.raphimc:ViaProxy:3.4.5-SNAPSHOT" |
39 | | - include "net.lenni0451.commons:gson:1.7.1" |
| 20 | + compileOnly libs.viaproxy |
| 21 | + include libs.commonsGson |
| 22 | + |
| 23 | + compileOnly libs.findbugs |
| 24 | + compileOnly libs.jetbrainsAnnotations |
| 25 | + compileOnly libs.lombok |
| 26 | + annotationProcessor libs.lombok |
40 | 27 | } |
41 | 28 |
|
42 | 29 | processResources { |
| 30 | + var projectMavenVersion = project.maven_version |
| 31 | + |
| 32 | + //Config file: "version: ${version}" |
43 | 33 | inputs.properties( |
44 | | - "version": project.maven_version |
| 34 | + "version": projectMavenVersion |
45 | 35 | ) |
46 | 36 |
|
47 | 37 | filesMatching("viaproxy.yml") { |
48 | 38 | expand( |
49 | | - "version": project.maven_version |
| 39 | + "version": projectMavenVersion |
50 | 40 | ) |
51 | 41 | } |
52 | 42 | } |
53 | | - |
54 | | -jar { |
55 | | - dependsOn configurations.include |
56 | | - from { |
57 | | - duplicatesStrategy = DuplicatesStrategy.EXCLUDE |
58 | | - configurations.include.collect { |
59 | | - zipTree(it) |
60 | | - } |
61 | | - } { |
62 | | - exclude "META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA" |
63 | | - } |
64 | | -} |
65 | | - |
66 | | -checkstyle { |
67 | | - toolVersion = "10.16.0" //Latest version for Java 8: 9.3 |
68 | | - configFile = rootProject.file("config/checkstyle/checkstyle.xml") |
69 | | -} |
70 | | -build.dependsOn(check) |
71 | | - |
72 | | -tasks.register("runViaProxy", JavaExec) { |
73 | | - dependsOn tasks.jar |
74 | | - |
75 | | - mainClass = "net.raphimc.viaproxy.ViaProxy" |
76 | | - classpath = sourceSets.main.compileClasspath |
77 | | - workingDir = file("run") |
78 | | - jvmArgs = ["-DskipUpdateCheck"] |
79 | | - args = ["config", "viaproxy.yml"] |
80 | | - |
81 | | - doFirst { |
82 | | - def pluginsDir = file("$workingDir/plugins") |
83 | | - pluginsDir.mkdirs() |
84 | | - file("$pluginsDir/${project.name}.jar").bytes = tasks.jar.archiveFile.get().asFile.bytes |
85 | | - } |
86 | | - |
87 | | - doLast { |
88 | | - file("$workingDir/plugins/${project.name}.jar").delete() |
89 | | - file("$workingDir/logs").deleteDir() |
90 | | - } |
91 | | -} |
0 commit comments