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

sourceSet other than main won't output #64

Open
RdeWilde opened this issue Aug 13, 2019 · 5 comments
Open

sourceSet other than main won't output #64

RdeWilde opened this issue Aug 13, 2019 · 5 comments

Comments

@RdeWilde
Copy link

RdeWilde commented Aug 13, 2019

When I run gradle, it generates output files for the proto-files. These are put into $projectDir/src/$sourceSet/java/my/org/models/a.kt (or a.java). This works for the sourceSet main, but not for other sourceSets like commonMain, although I defined the task for all sourceSets. The protofiles and directories are identical between sourceSet main and commonMain (I created main just for testing).

Partial gradle build file here (https://gist.github.com/RdeWilde/ec3a5c9432004579643a47ed5fee3397)

Directory structure is:

src
+ commonMain
|    |
|    + java     // no output  :-(
|    + proto
|         |
|         + protofile1.proto
|         + protofile2.proto
|
+ main
     |
     + java    // does have output  :-)
     + proto
          |
          + protofile1.proto
          + protofile2.proto
@marcoferrer
Copy link
Owner

I’ve ran into this issue before but haven’t had time to get it resolved. The last time I dug into it there were two things that need to be resolved. The first being that the source sets in the kotlin multi platform Gradle plugin we’re not being instantiated using an object factory. This means that their instance at runtime was not ExtensionAware. The reason this matter is because of compatibility with the existing protobuf Gradle plugin. It needs the source sets it’s applied on to be extension aware.

The other issue is that the protobuf Gradle plugin needs to be updated to support this new source set type and take the kotlin multiple plugin into consideration during bootstrapping.

One work around I used was to generate the sources in a separate module and copy them over to commonMain for dev/testing.

@RdeWilde
Copy link
Author

Yes, I manually copy the files from main to commonMain now.

Sounds like it will be a little too hard for me to fix. Maybe I'll give it a try. Thanks for the info 👍

@marcoferrer
Copy link
Owner

Sorry that was a typo. I meant to say that the protobuf plugin would have to be made aware of the kotlin multiplatform plugin. I dont think the source set would need to explicitly implement ExtensionAware. Once its created by the object factory, the proxy that wraps the class will implicitly add it.

@marcoferrer
Copy link
Owner

I took some time to track down the issue I filed related to this. Linking it here for visibility KT-29156

I dont see this getting resolved anytime soon but its worth centralizing the history here at the very least.

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

2 participants