-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert the project to gradle kotlin dsl #51
base: master
Are you sure you want to change the base?
Changes from all commits
db2e630
ac5ca83
b5aad38
300918a
7c76560
9c76eaa
b215cfa
33cba59
31be765
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,4 +114,6 @@ run/ | |
/example-plugin/build/ | ||
/api/build/ | ||
|
||
|
||
# Gradle | ||
**/build/** | ||
**/.gradle/** |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension | ||
|
||
plugins { | ||
id("org.jetbrains.kotlin.jvm") version "1.9.22" | ||
id("com.github.johnrengelman.shadow") version "8.1.1" | ||
id("maven-publish") | ||
} | ||
|
||
group = "org.holoeasy" | ||
version = "3.1.1" | ||
|
||
apply(from = "$rootDir/gradle/publish.gradle") | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
subprojects { | ||
apply(plugin = "kotlin") | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compileOnly("org.jetbrains:annotations:24.0.1") | ||
} | ||
|
||
configure<JavaPluginExtension> { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
sourceSets { | ||
getByName("main").java.srcDirs("src/main/java") | ||
getByName("test").java.srcDirs("src/test/java") | ||
} | ||
} | ||
|
||
configure<KotlinJvmProjectExtension> { | ||
sourceSets { | ||
getByName("main").kotlin.srcDirs("src/main/kotlin") | ||
getByName("test").kotlin.srcDirs("src/test/kotlin") | ||
} | ||
|
||
compilerOptions { | ||
jvmTarget = JvmTarget.JVM_1_8 | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":core")) | ||
} | ||
|
||
tasks { | ||
withType<ShadowJar> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tasks.shadowJar { |
||
archiveClassifier.set("") | ||
relocate("kotlin.", "org.holoeasy.kotlin.") | ||
relocate("org.intellij.lang.annotations", "org.holoeasy.annotations") | ||
relocate("org.jetbrains.annotations", "org.holoeasy.annotations") | ||
} | ||
|
||
named("build") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tasks.build { |
||
dependsOn("shadowJar") | ||
} | ||
|
||
named("publishToMavenLocal") { | ||
dependsOn("jar", "shadowJar") | ||
} | ||
|
||
named("publishShadowPublicationToMavenLocal") { | ||
dependsOn("jar", "shadowJar") | ||
} | ||
|
||
named("publish") { | ||
dependsOn("shadowJar") | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,31 @@ | ||||||||||||||||
plugins { | ||||||||||||||||
id("org.jetbrains.kotlin.jvm") version "1.9.22" | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
group = "org.holoeasy" | ||||||||||||||||
version = "3.1.1" | ||||||||||||||||
Comment on lines
+5
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The submodule does not need to repeat this content as it will automatically retrieve the parent project's |
||||||||||||||||
|
||||||||||||||||
repositories { | ||||||||||||||||
mavenCentral() | ||||||||||||||||
maven(url = uri("https://repo.dmulloy2.net/repository/public/")) | ||||||||||||||||
maven(url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")) | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
dependencies { | ||||||||||||||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.22") | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The dependency already exists by default |
||||||||||||||||
compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT") | ||||||||||||||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0") | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
java { | ||||||||||||||||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||||||||||||||||
targetCompatibility = JavaVersion.VERSION_1_8 | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
tasks.jar { | ||||||||||||||||
manifest { | ||||||||||||||||
attributes( | ||||||||||||||||
"Main-Class" to "MainKt" | ||||||||||||||||
) | ||||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
Comment on lines
+25
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I don't think it's necessary to set the main class? |
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,24 @@ | ||||||
plugins { | ||||||
id("java") | ||||||
} | ||||||
|
||||||
repositories { | ||||||
mavenCentral() | ||||||
maven(url = uri("https://repo.dmulloy2.net/repository/public/")) | ||||||
maven(url = uri("https://jitpack.io")) | ||||||
maven(url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")) | ||||||
} | ||||||
|
||||||
|
||||||
group = "org.holoeasy" | ||||||
version = "1.0-SNAPSHOT" | ||||||
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
java { | ||||||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||||||
targetCompatibility = JavaVersion.VERSION_1_8 | ||||||
} | ||||||
|
||||||
dependencies { | ||||||
compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT") | ||||||
compileOnly("com.github.GeorgeV220:Hologram-Lib:33cba59492") | ||||||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.