-
-
Notifications
You must be signed in to change notification settings - Fork 71
Add Kotlin DSL support for delegations #482
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
Conversation
Would it not make more sense to name them |
Yes, I thought about this too. I thought if this is for |
Makes sense to me 👍 |
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.
Just some notes about the pom.xml
files.
I don't know enough to judge the Kotlin part, but it probably works. Maybe there could be some tests added for the feature.
@willkroboth Thanks about the project version thingy though, I totally forgot that! About the structure and the file paths. Given that it works I don't think the profile thing should be added to I am also planning on doing some more testing with the modules to see how they behave when set up differently but that's nothing that I want to get too deep into now. |
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.
Just one comment on the tests.
I still think it makes sense to put
<modules>
<module>commandapi-core-kotlin</module>
</modules>
<profiles>
<profile>
<id>Platform.Bukkit</id>
<modules>
<module>commandapi-bukkit-kotlin</module>
</modules>
</profile>
<profile>
<id>Platform.Velocity</id>
<modules>
<module>commandapi-velocity-kotlin</module>
</modules>
</profile>
</profiles>
into the pom.xml
of commandapi-kotlin
. If you want all the Kotlin stuff in the same place, that would keep all the Kotlin stuff inside the kotlin
module instead of putting it in commandapi-platforms
.
If you want it to be more clear what belongs to Bukkit/Velocity, you should put commandapi-bukkit-kotlin
inside commandapi-bukkit
's pom and commandapi-velocity-kotlin
inside commandapi-velocity
's pom, like it was before this PR. You do have to do the path traversal, which I think makes this slightly worse, but the purpose of the commandapi-[platform]
modules are to store the platform-specific modules.
However, I suppose building the CommandAPI is functionally the same in any of these ways, so I'm not requesting changes for that anymore.
...api-bukkit-kotlin-test/src/test/kotlin/dev/jorel/commandapi/test/dsltests/DelegationTests.kt
Outdated
Show resolved
Hide resolved
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.
Looks good to me, to the extent that I can judge Kotlin code :P. I like the extra check that the exception message is right.
Still not sure about this: https://github.com/JorelAli/CommandAPI/pull/482/files#r1297831688, but oh well.
I'm guessing docs are on the TODO list? Oh wait, just noticed the PR description has a TODO list now, lol
…Kotlin's documentation for delegated properties
As suggested by Sparky in the CommandAPI Discord, this PR is adding support for delegations in the Kotlin DSL.
This would allow retrieving arguments like this:
Or, in the Kotlin DSL:
This PR restructures the Kotlin DSL modules which are now no longer included in the
commandapi-bukkit
andcommandapi-velocity
modules. Instead, thecommandapi-kotlin
module has been added to the root of the project which contains three modules:commandapi-core-kotlin
,commandapi-bukkit-kotlin
andcommandapi-velocity-kotlin
.This results in this structure:
commandapi-core
commandapi-kotlin
commandapi-core-kotlin
commandapi-bukkit-kotlin
commandapi-velocity-kotlin
To still be able to build all modules that belong to a specific platform, these modules have also been added to the
commandapi-platforms
pom.xml
.ToDo's:
kotlindsl.md
intro.md