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

contains_file() broken on bazel 0.3.0+ #130

Closed
hochhaus opened this issue Sep 9, 2016 · 0 comments
Closed

contains_file() broken on bazel 0.3.0+ #130

hochhaus opened this issue Sep 9, 2016 · 0 comments

Comments

@hochhaus
Copy link
Contributor

hochhaus commented Sep 9, 2016

I noticed that the automatically populated --defines from closure_js_binary() are not being passed to the compiler after I upgraded my bazel version.

Please note that is_using_closure_library should be True in the following example.

ahochhaus@ahochhaus-pc:~/rules_closure$ git rev-parse HEAD
1eb589b4453bdb5b319f651bd614b05b753d0cd0
ahochhaus@ahochhaus-pc:~/rules_closure$ git diff
diff --git a/closure/compiler/closure_js_binary.bzl b/closure/compiler/closure_js_binary.bzl
index 41c7d48..86e54f1 100755
--- a/closure/compiler/closure_js_binary.bzl
+++ b/closure/compiler/closure_js_binary.bzl
@@ -43,6 +43,7 @@ def _impl(ctx):
   srcs, externs, tdata = collect_transitive_js_srcs(ctx)
   if not srcs:
     fail("There are no source files in the transitive closure")
+  print("is_using_closure_library: %s" % is_using_closure_library(srcs))
   _validate_css_graph(ctx)
   language_in = determine_js_language(ctx, normalize=True)
   language_out = ctx.attr.language
ahochhaus@ahochhaus-pc:~/rules_closure$ bazel build //closure/templates/test:greeter_test
WARNING: /home/ahochhaus/rules_closure/closure/compiler/closure_js_binary.bzl:46:3: is_using_closure_library: False.
INFO: Found 1 target...
Target //closure/templates/test:greeter_test up-to-date:
  bazel-bin/closure/templates/test/greeter_test
INFO: Elapsed time: 0.130s, Critical Path: 0.00s
ahochhaus@ahochhaus-pc:~/rules_closure$ bazel version
Build label: 0.3.1
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Jul 29 09:09:52 2016 (1469783392)
Build timestamp: 1469783392
Build timestamp as int: 1469783392

However contains_file() functions correctly on bazel 0.2.3. Please note that is_using_closure_library is True (as expected) in the example below.

ahochhaus@ahochhaus-pc:~/rules_closure$ bazel version
Build label: 0.2.3
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue May 17 14:21:13 2016 (1463494873)
Build timestamp: 1463494873
Build timestamp as int: 1463494873
ahochhaus@ahochhaus-pc:~/rules_closure$ bazel build //closure/templates/test:greeter_test
WARNING: /home/ahochhaus/rules_closure/closure/compiler/closure_js_binary.bzl:46:3: is_using_closure_library: True.
INFO: Found 1 target...
Target //closure/templates/test:greeter_test up-to-date:
  bazel-bin/closure/templates/test/greeter_test
INFO: Elapsed time: 66.174s, Critical Path: 35.26s

I believe the underlying cause is that File#short_path changed in bazel 0.3.0. bazelbuild/bazel#1462

That API change also caused a bug in rules_go. bazelbuild/rules_go#35

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

1 participant