From 7fbe8a064cc6432a869106c6bd6bdc2dd2c3c230 Mon Sep 17 00:00:00 2001 From: jianglai Date: Wed, 21 Mar 2018 09:26:13 -0700 Subject: [PATCH] Replace PACKAGE_NAME with package_name() in bzl files. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LSC document: https://docs.google.com/document/d/19GK3_SjUZeLxiML50Hz41p6hzajKgQHW51p9M2FK3SM/edit PACKAGE_NAME was introduced in Blaze 10 years ago. Although it looks like a constant, its value depends on which BUILD file calls it. It is also magic: you can use it inside a macro; but not in top level of a .bzl file; and not inside a custom rule. In other words, it can be used exactly in the same places as glob or the native rules. For this reason, we want to replace the “constant” with a proper function to be consistent with glob and others. This change will bring more consistency. It will simplify the code in Blaze (remove support for “dynamic values”), the spec, and the documentation. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=189919019 --- java/com/google/testing/builddefs/GenTestRules.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/com/google/testing/builddefs/GenTestRules.bzl b/java/com/google/testing/builddefs/GenTestRules.bzl index d5576fe86..3e1ba7301 100644 --- a/java/com/google/testing/builddefs/GenTestRules.bzl +++ b/java/com/google/testing/builddefs/GenTestRules.bzl @@ -54,7 +54,7 @@ def GenTestRules(name, if (test in flaky_tests) or ("flaky" in tags): flaky = 1 java_class = _package_from_path( - PACKAGE_NAME + "/" + _strip_right(test, ".java")) + native.package_name() + "/" + _strip_right(test, ".java")) package = java_class[:java_class.rfind(".")] native.java_test(name = prefix + test, runtime_deps = deps,