1313# limitations under the License.
1414"""Macro to create android_library rules with CEL specific options applied."""
1515
16- load ("@rules_android//rules:rules.bzl" , "android_library" )
16+ load ("@rules_android//rules:rules.bzl" , "android_library" , "android_local_test" )
17+
18+ DEFAULT_JAVACOPTS = [
19+ "-XDstringConcat=inline" , # SDK forces usage of StringConcatFactory (java 9+)
20+ ]
1721
1822def cel_android_library (name , ** kwargs ):
1923 """
@@ -23,15 +27,30 @@ def cel_android_library(name, **kwargs):
2327 name: name of the android_library target
2428 **kwargs: rest of the args accepted by android_library
2529 """
26- default_javacopts = [
27- "-XDstringConcat=inline" , # SDK forces usage of StringConcatFactory (java 9+)
28- ]
2930
3031 javacopts = kwargs .get ("javacopts" , [])
31- all_javacopts = default_javacopts + javacopts
32+ all_javacopts = DEFAULT_JAVACOPTS + javacopts
3233
3334 android_library (
3435 name = name ,
3536 javacopts = all_javacopts ,
3637 ** kwargs
3738 )
39+
40+ def cel_android_local_test (name , ** kwargs ):
41+ """
42+ Generates android_local_test target with CEL specific javacopts applied
43+
44+ Args:
45+ name: name of the android_local_test target
46+ **kwargs: rest of the args accepted by android_local_test
47+ """
48+
49+ javacopts = kwargs .get ("javacopts" , [])
50+ all_javacopts = DEFAULT_JAVACOPTS + javacopts
51+
52+ android_local_test (
53+ name = name ,
54+ javacopts = all_javacopts ,
55+ ** kwargs
56+ )
0 commit comments