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

Closed
wants to merge 9 commits into from

Conversation

GeorgeV220
Copy link
Contributor

@GeorgeV220 GeorgeV220 commented Feb 3, 2024

Changes may be required.

Compile command: ./gradlew clean build shadowJar

closes (#50)

@unldenis
Copy link
Owner

unldenis commented Feb 3, 2024

But Gradle used to work, just call shadowJar. The problem is uploading it right to a repository, jitpack or mavencentral.

@GeorgeV220
Copy link
Contributor Author

But Gradle used to work, just call shadowJar. The problem is uploading it right to a repository, jitpack or mavencentral.

I'm trying to figure it out, that's why I have it as draft.

@unldenis
Copy link
Owner

unldenis commented Feb 3, 2024

Oh ok let me know!

@GeorgeV220
Copy link
Contributor Author

Hey @unldenis ,

I believe I successfully configured it for publication on JitPack. I tested it by using the latest commit build from JitPack on the example module, and it compiled successfully:

compileOnly 'com.github.GeorgeV220:Hologram-Lib:33cba59492'

If you're considering merging it, please check if it meets your own standards. Additionally, I didn't focus on making the commits look polished as they were primarily test commits. It might be a good idea to squash them for a cleaner history.

Thanks!

@GeorgeV220 GeorgeV220 marked this pull request as ready for review February 3, 2024 17:47
@unldenis
Copy link
Owner

unldenis commented Feb 3, 2024

thank you very much, but I can ask you two questions:

  • I think the part where you relocate the kotlin stdlib.(package kotlin.*) is missing
  • can you convert it to gradle kotlin ?

@GeorgeV220
Copy link
Contributor Author

  • I think the part where you relocate the kotlin stdlib.(package kotlin.*) is missing

image
in the final jar the kotlin relocated package exists.

  • can you convert it to gradle kotlin ?

I did it in groovy in order to be easier for me (I do not use kotlin at all). But I can do it.

@GeorgeV220
Copy link
Contributor Author

I've switched all Gradle scripts to use gradle.kts, but I'm a bit stuck with the gradle/publish.gradle file. Not sure how to convert the shadow JAR publication to Kotlin. Anyway, everything else seems to work just fine!!

@GeorgeV220 GeorgeV220 changed the title Convert the project to gradle groovy Convert the project to gradle kotlin dsl Feb 3, 2024
@unldenis unldenis added the help wanted Extra attention is needed label Apr 9, 2024
@GeorgeV220
Copy link
Contributor Author

Any reason why it should be gradle kotlin ? @unldenis

}

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 {
// ...
}

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 {
// ...
}

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"

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

}

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

Comment on lines +25 to +31
tasks.jar {
manifest {
attributes(
"Main-Class" to "MainKt"
)
}
}

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?

core/build.gradle.kts Show resolved Hide resolved
Comment on lines +13 to +14
group = "org.holoeasy"
version = "1.0-SNAPSHOT"

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"

@unldenis
Copy link
Owner

unldenis commented Oct 7, 2024

Any reason why it should be gradle kotlin ? @unldenis

Sorry for the late reply, but since I didn't receive the notification and, despite having also opened the PR every now and then, I never read this message.
We can keep it in gradle groovy too.
If you want to open another one or correct this one I'll merge, I just need to be sure that there are no build or jitpack problems.

@GeorgeV220
Copy link
Contributor Author

Check #68

@GeorgeV220 GeorgeV220 closed this Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants