File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
src/main/kotlin/top/mcfpp/gradle Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -38,17 +38,29 @@ class MCFPPGradlePlugin: Plugin<Project> {
38
38
39
39
val config = project.extensions.create(" mcfpp" , ProjectConfig ::class .java)
40
40
41
- if (config.root == null ) config.root = project.rootDir.toPath()
42
- if (config.sourcePath == null ) config.sourcePath = Path (config.root!! .absolutePathString(), " src/main/mcfpp" )
43
- if (config.targetPath == null ) config.targetPath = project.layout.buildDirectory.get().dir(" datapack" ).asFile.toPath()
44
-
45
41
// 自定义任务来调用MCFPP
46
42
project.tasks.register(" mcfppCompile" ) {
47
43
it.group = " build"
48
44
it.description = " Compile mcfpp files"
49
45
50
46
it.dependsOn(" jar" )
51
47
48
+ if (config.root == null ) config.root = project.rootDir.toPath()
49
+
50
+ if (config.sourcePath == null ) {
51
+ config.sourcePath = Path (config.root!! .absolutePathString(), " src/main/mcfpp" )
52
+ }
53
+ else if (config.sourcePath?.isAbsolute == false ) {
54
+ config.sourcePath = config.root!! .resolve(config.sourcePath!! )
55
+ }
56
+
57
+ if (config.targetPath == null ) {
58
+ config.targetPath = project.layout.buildDirectory.get().dir(" datapack" ).asFile.toPath()
59
+ }
60
+ else if (config.targetPath?.isAbsolute == false ) {
61
+ config.targetPath = config.root!! .resolve(config.targetPath!! )
62
+ }
63
+
52
64
val jars = (project.tasks.named(" jar" ).get() as org.gradle.api.tasks.bundling.Jar ).destinationDirectory.get().files()
53
65
54
66
it.doLast {
You can’t perform that action at this time.
0 commit comments