Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,6 @@ run/
/example-plugin/build/
/api/build/


# Gradle
**/build/**
**/.gradle/**
80 changes: 80 additions & 0 deletions build.gradle.kts
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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id("org.jetbrains.kotlin.jvm") version "1.9.22"
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> {

Choose a reason for hiding this comment

The 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") {

Choose a reason for hiding this comment

The 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")
}

}
31 changes: 31 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
id("org.jetbrains.kotlin.jvm") version "1.9.22"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id("org.jetbrains.kotlin.jvm") version "1.9.22"
kotlin("jvm") version "1.9.22"

}

group = "org.holoeasy"
version = "3.1.1"
Comment on lines +5 to +6

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
group = "org.holoeasy"
version = "3.1.1"

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")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.22")

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tasks.jar {
manifest {
attributes(
"Main-Class" to "MainKt"
)
}
}

I don't think it's necessary to set the main class?

148 changes: 0 additions & 148 deletions core/pom.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.holoeasy.hologram.Hologram;
import org.holoeasy.line.ILine;
import org.holoeasy.line.ITextLine;
import org.holoeasy.pool.IHologramPool;
import org.holoeasy.reactive.MutableState;
import org.jetbrains.annotations.NotNull;

Expand Down
1 change: 0 additions & 1 deletion core/src/main/kotlin/org/holoeasy/builder/Service.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import org.holoeasy.builder.interfaces.HologramConfigGroup
import org.holoeasy.hologram.TextBlockStandardLoader
import org.holoeasy.line.*
import org.holoeasy.reactive.MutableState
import kotlin.math.min

object Service {

Expand Down
24 changes: 24 additions & 0 deletions example/build.gradle.kts
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
group = "org.holoeasy"
version = "1.0-SNAPSHOT"


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")
}
47 changes: 0 additions & 47 deletions example/pom.xml

This file was deleted.

Loading