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

search and replace is resulting in wrong code #38

Closed
nagkumar opened this issue Jun 1, 2021 · 4 comments
Closed

search and replace is resulting in wrong code #38

nagkumar opened this issue Jun 1, 2021 · 4 comments

Comments

@nagkumar
Copy link

nagkumar commented Jun 1, 2021

plugins {
    id("com.android.application")
    id("kotlin-android")
}

this being converted to

plugins {
    id("com.andro.application")
    id("kotlin-andro")
}
@bernaferrari
Copy link
Owner

Ooops

@2BAB
Copy link

2BAB commented Jun 10, 2021

Encountered the same issue, though it's not hard to fix manually after conversion.

@bernaferrari
Copy link
Owner

My life has been a hurry, I hope to be able to fix this soon. It wasn't supposed to pass the tests :(

@5peak2me
Copy link
Contributor

fun String.addParenthesisToId(): String {
    // this will only catch id "..." version ..., should skip id("...")
    // should get the id "..."
    val idExp = "(id)\\s*\"(.*?)\"".toRegex()

    return this.replace(idExp) {
        // remove the "id " before the real id
        val (id, value) = it.destructured
        """$id("$value")"""
    }
}

5peak2me added a commit to 5peak2me/GradleKotlinConverter that referenced this issue Jun 29, 2022
bernaferrari pushed a commit that referenced this issue Jun 29, 2022
* Fix [#38](#38)

* Fix [#40](#40)
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