GradleKotlinConverter icon indicating copy to clipboard operation
GradleKotlinConverter copied to clipboard

`id "idea"` gets converted to `id("ea")`

Open ChristopherHaws opened this issue 1 year ago • 5 comments

When running the script, id "idea" gets converted to id("ea") in the plugin section. It looks like a regex is looking inside of quoted strings when it shouldn't be.

Thanks for the script! :)

ChristopherHaws avatar Jan 10 '23 04:01 ChristopherHaws

Uh oh, let me check my favorite maintainer.

@WhosNickDoglio do you have any idea?

bernaferrari avatar Jan 10 '23 04:01 bernaferrari

Can you share a build.gradle snippet that can reproduce the issue? I tried adding tests for it in #55 and it converts the blocks correctly.

WhosNickDoglio avatar Jan 10 '23 12:01 WhosNickDoglio

@WhosNickDoglio Here is the file I used. https://pastebin.com/XjXP9djb

There are several issues that came out of it, not just this one. Some of them took me a good minute to find. Some examples:

  • Some of my dependencies have the word api in them so the script added a ( into the dependency string (this would be fixed if you ignore looking inside strings)
  • Under repositories, it didn't convert the maven dependencies from maven { url = "https://maven.fabricmc.net/" } to maven("https://maven.fabricmc.net/")
  • Under repositories, it didn't wrap the exclusiveContent's url's in url(...). For example url = "https://cursemaven.com" should be url = url("https://cursemaven.com")
  • tasks.withType(T).configureEach { should be tasks.withType<T> {
  • Everywhere I was reading from gradle.properties didn't get converted. For example project.maven_group should become maven_group and val maven_group: String by extra should be added near the top of the file.
  • The nullability of build number was wrong. I had to change it from val buildNumber: String to val buildNumber: String?
  • My script is for a Minecraft mod which has custom configurations and those were not handled for me. For example modImplementation is similar to implementation but the script didn't do anything to it

I'm sure there are more, for example the entire loom section I had to manually convert. Anyways, this script helped me get part way there so thanks for the help and the script! :)

ChristopherHaws avatar Jan 10 '23 19:01 ChristopherHaws

Messing around with the file provided above and I can't reproduce the id("ea") issue but I can reproduce many of the others listed above 😅

I'll start working through them this week to see how feasible it is to fix them, like it's called out in the script intro this is a helper tool and not meant to be perfect so as of right now I'm unsure if I'll get to all of them but I'll certainly try. 👍

WhosNickDoglio avatar Jan 16 '23 01:01 WhosNickDoglio

Yup, no rush or anything, I got my build script converted. I just figured I would post the things I had to manually fix in case you want to try and handle them in the script. :)

When I did the conversion, I used the "clipboard" method. I don't know if that makes a difference or not for the "idea" issue.

Thanks for the script! :)

ChristopherHaws avatar Jan 16 '23 02:01 ChristopherHaws