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

Conversation

GeorgeV220
Copy link

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

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

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

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"

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.

None yet

3 participants