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

Kotlin Templates #4

Open
Samarium150 opened this issue Feb 12, 2022 · 8 comments
Open

Kotlin Templates #4

Samarium150 opened this issue Feb 12, 2022 · 8 comments

Comments

@Samarium150
Copy link

It would be wonderful if there are templates using Kotlin, just like Adorn

@shedaniel
Copy link
Member

Kotlin templates as in templates using Kotlin or templates in Kotlin? (as gradle.kts)

@Samarium150
Copy link
Author

Kotlin templates as in templates using Kotlin or templates in Kotlin? (as gradle.kts)

Maybe both? For me, it's a little weird that source code uses kotlin, but gradle files use groovy.

@CubeSugarCheese
Copy link

CubeSugarCheese commented May 20, 2022

kts doesn't support allprojects and subprojects block (see https://stackoverflow.com/questions/60142502/gradle-kotlin-dsl-problems-with-subprojects-and-plugins).So it may hard to convert build.gradle to build.gradle.kts .

@Juuxel
Copy link
Member

Juuxel commented May 20, 2022

kts does support them just fine, it's just that the type-safe accessors for configurations, extensions and tasks aren't generated so you have to use strings and getByName etc. (See for example my build.gradle.kts where I use subprojects blocks heavily)

@Samarium150
Copy link
Author

@CubeSugarCheese As @Juuxel said, it should support now. This post is outdated.

@Juuxel
Copy link
Member

Juuxel commented May 20, 2022

Also the post is correct and up-to-date afaik, it just says you can't use type-safe accessors but the answer itself is using subprojects/allprojects.

(However, it's not exactly correct about the "import statements" etc since plugins and buildscript don't generate imports. plugins does generate extra type-safe accessors though)

@CubeSugarCheese
Copy link

Also the post is correct and up-to-date afaik, it just says you can't use type-safe accessors but the answer itself is using subprojects/allprojects.

(However, it's not exactly correct about the "import statements" etc since plugins and buildscript don't generate imports. plugins does generate extra type-safe accessors though)

well,I tried to convert groovy to kts but failed. Seeing your build.gradle.kts, I find the different is not a little which in groovy and kts. If it's possible,I want to get official kts support in next template release.

@CubeSugarCheese
Copy link

Now, I transform groovy to kts successfully. But it still have some problems.
https://github.com/CubeSugarCheese/architectury-template-kotlin-dsl
Based on 1.18.2-forge-fabric-quilt-mixin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants