sdk-java icon indicating copy to clipboard operation
sdk-java copied to clipboard

Published artifacts do not include sources for the generated code

Open robzienert opened this issue 4 years ago • 4 comments

Expected Behavior

Published artifacts should include sources and javadoc.

Actual Behavior

Only compiled class artifacts are published.

Steps to Reproduce the Problem

  1. Use java SDK as dependency in any project.

Specifications

  • Version: 1.0.4

Notes

I see that the Gradle project is using withJavadocJar() and withSourcesJar(), and a sufficient Gradle version for these to work, however no sources or javadoc are included anyway. I was going to open a PR to do this the pre-6.x way, but wanted to verify with you folks first in case you see a more correct fix.

robzienert avatar Jan 20 '21 21:01 robzienert

Interesting, maven central has all those files: https://repo1.maven.org/maven2/io/temporal/temporal-sdk/1.0.4/

Can you double check if your IDE is downloading sources/javadocs? You may need to explicitly press the button to fetch them.

vitarb avatar Jan 20 '21 22:01 vitarb

I was able to partially reproduce this issue. All the "proper" source code is present, however, the generated sources seem to be missing from the temporal-serviceclient:

~/Downloads/temporal-serviceclient-1.0.4-sources
❯ ls -lR .
total 0
drwxr-xr-x@ 3 mrybak  staff  96 Dec 23 21:35 META-INF
drwxr-xr-x@ 3 mrybak  staff  96 Dec 23 19:55 io

./META-INF:
total 8
-rw-r--r--@ 1 mrybak  staff  25 Dec 23 21:35 MANIFEST.MF

./io:
total 0
drwxr-xr-x@ 3 mrybak  staff  96 Dec 23 19:55 temporal

./io/temporal:
total 0
drwxr-xr-x@ 12 mrybak  staff  384 Dec 23 19:55 serviceclient

./io/temporal/serviceclient:
total 128
-rw-r--r--@ 1 mrybak  staff   2519 Dec 23 19:55 GrpcDeadlineInterceptor.java
-rw-r--r--@ 1 mrybak  staff   4900 Dec 23 19:55 GrpcMetricsInterceptor.java
-rw-r--r--@ 1 mrybak  staff   3695 Dec 23 19:55 GrpcTracingInterceptor.java
-rw-r--r--@ 1 mrybak  staff   1495 Dec 23 19:55 LongPollUtil.java
-rw-r--r--@ 1 mrybak  staff   2830 Dec 23 19:55 MetricsTag.java
-rw-r--r--@ 1 mrybak  staff   1415 Dec 23 19:55 MetricsType.java
-rw-r--r--@ 1 mrybak  staff   2404 Dec 23 19:55 Version.java
-rw-r--r--@ 1 mrybak  staff   2390 Dec 23 19:55 WorkflowServiceStubs.java
-rw-r--r--@ 1 mrybak  staff  10979 Dec 23 19:55 WorkflowServiceStubsImpl.java
-rw-r--r--@ 1 mrybak  staff  12903 Dec 23 19:55 WorkflowServiceStubsOptions.java

GreyTeardrop avatar Jan 20 '21 22:01 GreyTeardrop

You are right, I don't see sources for the generated code. Let me update task description to be more precise.

vitarb avatar Jan 20 '21 22:01 vitarb

There seem to be a couple gradle plugin issues here, I was able to make generated source publishing work by adding sourceSets.main.java.srcDirs = ["$buildDir/generated/main/java","src/main/java"], but it breaks license check and I couldn't exclude that directory in the license plugin. I think the root cause is a bug in the license checker reported here and here. On the other hand we have a similar configuration as metioned here but for some reason doesn't work (another gradle bug?...).

To summarize our options are:

  1. Figure out why license plugin exclude is not working. In which case we can add generated sources to the main sourceSet and they will be published automatically.
  2. Debug sourceJar task and find out why it doesn't publish additional files that we've specified.

vitarb avatar Jan 20 '21 23:01 vitarb