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

Support outputting generated code directly into JAR/ZIP archives #480

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

voidzcy
Copy link
Collaborator

@voidzcy voidzcy commented Mar 5, 2021

For #478

Do not create the outputSubDir's leaf as a directory if its name ends with .jar or .zip. This allows output generated code directly into an archive.

See Java and Python compiler invocation.

…p to support outputting directly into an archive.
@voidzcy voidzcy merged commit cd45c9d into google:master Mar 5, 2021
ejona86 pushed a commit that referenced this pull request Nov 6, 2021
#480 allows `outputPath` to be a zip/jar file, but it's not excluded from the `SourceDirectorySet` in that case. Therefore, when the source set gets evaluated, it leads to this exception in Gradle 7.2:

```
Caused by: org.gradle.api.InvalidUserDataException: Source directory '<redacted>/build/generated-proto/main/cpp.zip' is not a directory.
	at org.gradle.api.internal.file.DefaultSourceDirectorySet.getSourceTrees(DefaultSourceDirectorySet.java:273)
	at org.gradle.api.internal.file.DefaultSourceDirectorySet.getSrcDirTrees(DefaultSourceDirectorySet.java:256)
	at org.gradle.api.internal.file.DefaultSourceDirectorySet.getSrcDirs(DefaultSourceDirectorySet.java:114)
	at jdk.internal.reflect.GeneratedMethodAccessor2253.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at com.google.protobuf.gradle.ProtobufPlugin$_addSourcesToIde_closure31.doCall(ProtobufPlugin.groovy:554)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at com.google.protobuf.gradle.ProtobufPlugin.addSourcesToIde(ProtobufPlugin.groovy:553)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at com.google.protobuf.gradle.ProtobufPlugin$_doApply_closure5.doCall(ProtobufPlugin.groovy:159)
...
```
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

Successfully merging this pull request may close these issues.

2 participants