meetup / rules_openapi

🍃 bazel rules for generating code from openapi specifications
MIT License
52 stars 25 forks source link

Revert "feat: Enable using gen dir in srcs of other rules" #12

Closed drigz closed 5 years ago

drigz commented 5 years ago

Reverts meetup/rules_openapi#9

This change breaks the srcjar output, resulting in an empty file. Before meetup/rules_openapi#9:

➜  git checkout 7e3e826a7f479efce458592d8639f92cb619ce73
Previous HEAD position was 1c91e94 Merge pull request #9 from mrmeku/gen_srcs
HEAD is now at 7e3e826 Merge pull request #8 from mrmeku/tree_artifact
➜  bazel build test/petstore_java && file bazel-bin/test/petstore_java_codegen.srcjar
INFO: Analysed target //test:petstore_java (2 packages loaded, 10 targets configured).
INFO: Found 1 target...
INFO: Writing explanation of rebuilds to '/tmp/explain.log'
Target //test:petstore_java up-to-date:
  bazel-bin/test/petstore_java_codegen.srcjar
INFO: Elapsed time: 1.644s, Critical Path: 1.26s
INFO: 1 process: 1 linux-sandbox.
INFO: Build completed successfully, 2 total actions
bazel-bin/test/petstore_java_codegen.srcjar: Java archive data (JAR)

And after:

➜  git checkout 1c91e94b20e8ba216110057723d07c8db277dbb8
Previous HEAD position was 7e3e826 Merge pull request #8 from mrmeku/tree_artifact
HEAD is now at 1c91e94 Merge pull request #9 from mrmeku/gen_srcs
➜  bazel build test/petstore_java && file bazel-bin/test/petstore_java_codegen.srcjar
INFO: Analysed target //test:petstore_java (2 packages loaded, 10 targets configured).
INFO: Found 1 target...
INFO: Writing explanation of rebuilds to '/tmp/explain.log'
Target //test:petstore_java up-to-date:
  bazel-bin/test/petstore_java_codegen.srcjar
  bazel-bin/test/petstore_java_gen_dir
INFO: Elapsed time: 1.520s, Critical Path: 1.17s
INFO: 1 process: 1 linux-sandbox.
INFO: Build completed successfully, 2 total actions
bazel-bin/test/petstore_java_codegen.srcjar: Zip archive data (empty)

Whether this is reverted or fixed forward, it would be good to add a regression test. This could be tested by adding a basic java_library() that builds a Java file that refers to one of the classes generated by //test/petstore_java.