Skip to content

Commit 354f373

Browse files
committed
divide the gradle plugin into subproject
1 parent 1737bb1 commit 354f373

File tree

8 files changed

+83
-40
lines changed

8 files changed

+83
-40
lines changed

Example/build.gradle.kts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ version = "1.0-SNAPSHOT"
1212

1313
repositories {
1414
mavenCentral()
15-
maven {
16-
url = uri("../build/repo")
17-
}
15+
mavenLocal()
1816
}
1917

2018
dependencies {
2119
testImplementation("org.jetbrains.kotlin:kotlin-test")
22-
implementation("top.mcfpp:mcfpp-gradle:1.0-SNAPSHOT")
20+
implementation("top.mcfpp:mcfpp:1.0-SNAPSHOT")
2321
}
2422

2523
tasks.test {
@@ -33,5 +31,5 @@ kotlin {
3331
mcfpp {
3432
version = "1.21"
3533
description = "qwq"
36-
targetPath = Path("")
34+
targetPath = Path("./build/datapack")
3735
}

Example/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
kotlin.code.style=official
2-
systemProp.https.proxyHost=127.0.0.1
3-
systemProp.https.proxyPort=20809
2+
#systemProp.https.proxyHost=127.0.0.1
3+
#systemProp.https.proxyPort=20809
44
org.gradle.jvmargs=-Xmx2g

Example/settings.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ rootProject.name = "Example"
22

33
pluginManagement {
44
repositories {
5-
maven {
6-
url = uri("../build/repo")
7-
}
5+
mavenLocal()
86
gradlePluginPortal()
97
maven("https://jitpack.io/")
108
maven("https://libraries.minecraft.net")

build.gradle.kts

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ plugins {
1313
id("org.jetbrains.dokka") version "1.9.20"
1414
java
1515
cpp
16-
id("java-gradle-plugin")
1716
id("maven-publish")
1817
id("com.gradleup.shadow") version "8.3.5"
1918
}
@@ -57,31 +56,6 @@ tasks.shadowJar {
5756
minimize()
5857
}
5958

60-
gradlePlugin {
61-
plugins {
62-
create("mcfpp") {
63-
id = "top.mcfpp.gradle"
64-
implementationClass = "top.mcfpp.gradle.MCFPPGradlePlugin"
65-
}
66-
}
67-
}
68-
69-
publishing {
70-
publications {
71-
create<MavenPublication>("mavenJava") {
72-
from(components["java"])
73-
groupId = GROUP
74-
artifactId = "mcfpp-gradle"
75-
version = VERSION
76-
}
77-
}
78-
repositories {
79-
maven {
80-
url = Paths.get("${layout.buildDirectory.get().asFile.absolutePath}/repo").toUri()
81-
}
82-
}
83-
}
84-
8559
tasks.test {
8660
useJUnitPlatform()
8761
}
@@ -197,6 +171,20 @@ application {
197171
mainClass.set("top.mcfpp.MCFPPKt")
198172
}
199173

174+
publishing {
175+
publications {
176+
create<MavenPublication>("mavenJava") {
177+
from(components["java"])
178+
groupId = GROUP
179+
artifactId = "mcfpp"
180+
version = VERSION
181+
}
182+
}
183+
repositories {
184+
mavenLocal()
185+
}
186+
}
187+
200188
enum class OperatingSystem {
201189
WINDOWS,
202190
LINUX,

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
kotlin.code.style=official
2-
systemProp.https.proxyHost=127.0.0.1
3-
systemProp.https.proxyPort=20809
2+
#systemProp.https.proxyHost=127.0.0.1
3+
#systemProp.https.proxyPort=20809
44
org.gradle.jvmargs=-Xmx2g

mcfpp-gradle/build.gradle.kts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import java.nio.file.Paths
2+
3+
plugins {
4+
kotlin("jvm")
5+
id("java-gradle-plugin")
6+
id("maven-publish")
7+
id("com.gradleup.shadow") version "8.3.5"
8+
}
9+
10+
val GROUP = "top.mcfpp"
11+
val VERSION = "1.0-SNAPSHOT"
12+
group = GROUP
13+
version = VERSION
14+
15+
repositories {
16+
mavenCentral()
17+
maven("https://jitpack.io")
18+
maven("https://maven.aliyun.com/nexus/content/groups/public/")
19+
maven("https://libraries.minecraft.net")
20+
}
21+
22+
dependencies {
23+
testImplementation(kotlin("test"))
24+
implementation(project(":"))
25+
}
26+
27+
tasks.test {
28+
useJUnitPlatform()
29+
}
30+
kotlin {
31+
jvmToolchain(21)
32+
}
33+
34+
tasks.shadowJar {
35+
minimize()
36+
}
37+
38+
gradlePlugin {
39+
plugins {
40+
create("mcfpp-gradle") {
41+
id = "top.mcfpp.gradle"
42+
implementationClass = "top.mcfpp.gradle.MCFPPGradlePlugin"
43+
}
44+
}
45+
}
46+
47+
publishing {
48+
publications {
49+
create<MavenPublication>("mavenJava") {
50+
from(components["java"])
51+
groupId = GROUP
52+
artifactId = "mcfpp-gradle"
53+
version = VERSION
54+
}
55+
}
56+
57+
repositories {
58+
mavenLocal()
59+
}
60+
}

settings.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
rootProject.name = "MCFPP"
3-
2+
include("mcfpp-gradle")

0 commit comments

Comments
 (0)