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

Problem with GString in DescriptorSetOptions.path and Gradle Kotlin DSL #359

Closed
IvBre opened this issue Nov 18, 2019 · 5 comments
Closed

Comments

@IvBre
Copy link

IvBre commented Nov 18, 2019

Hello,
Maybe I'm missing something obvious, but when trying to set DescriptorSetOptions.path to the needed path string, the compiler is complaining about a type mismatch:

GString! required,
String provided

For example:

generateProtoTasks {
        all().forEach {
            it.generateDescriptorSet = true
            it.descriptorSetOptions.includeImports = true
            it.descriptorSetOptions.includeSourceInfo = true
            it.descriptorSetOptions.path = "${buildDir}/resources/main/META-INF/proto/descriptor_set.desc"
            ...
        }
}

since it.descriptorSetOptions.path is of type GString, by just doing above will not work, but instead I need to add it like:

it.descriptorSetOptions.path = GStringImpl(emptyArray(), arrayOf("${buildDir}/resources/main/META-INF/proto/descriptor_set.desc"))

which seems a bit too implementation specific, and should not be the correct usage of this interface IMO.
Is there a better way of doing this or it's a drawback of using Kotlin DSL with this plugin?

Thanks in advance.

@voidzcy
Copy link
Collaborator

voidzcy commented Jan 8, 2020

Sorry for the delayed response, since I was not quite familiar with GString stuff and did not know an answer to your question.

I believe we are missing some Kotlin DSL interoperability considerations for DescriptorSetOptions.path. I can hardly find any explanations for the interoperation of passing a double-quoted string with interpolation in Kotlin DSL to Groovy online. But according to gradle/gradle#9268, using Property<String> seems to be Gradle's suggested approach.

@voidzcy
Copy link
Collaborator

voidzcy commented Apr 24, 2020

#394 seems to fix this issue in an immediate way. I would keep this issue open for investigating Property<String> vs String solutions as well as if that change introduces unforeseen issues.

@josephglanville
Copy link

Would be good to get a release with this in it as there isn't a viable workaround other than building from master.

@voidzcy
Copy link
Collaborator

voidzcy commented Jul 28, 2020

Would be good to get a release with this in it as there isn't a viable workaround other than building from master.

Sure. Would plan to make a release after #414 (and probably #423) is done.

@voidzcy
Copy link
Collaborator

voidzcy commented Dec 11, 2020

Fixed by #394 and it's working good enough.

@voidzcy voidzcy closed this as completed Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants