@@ -14,11 +14,7 @@ def _opa_check_test_impl(ctx):
14
14
if ctx .files .schema_files :
15
15
files .extend (ctx .files .schema_files )
16
16
17
- runfiles = ctx .runfiles (
18
- files = files ,
19
- )
20
-
21
- args = []
17
+ args = ["set -xe\n " ]
22
18
23
19
args .append (toolchain .opa .short_path )
24
20
args .append ("check" )
@@ -29,19 +25,27 @@ def _opa_check_test_impl(ctx):
29
25
args .append ("-s" )
30
26
args .append ("%s/" % (ctx .file .schema_dir .short_path ))
31
27
elif ctx .files .schema_files :
32
- for f in ctx .files .schema_files :
33
- args .append ("-s" )
34
- args .append (f .short_path )
28
+ args .insert (1 , "schema_dir=`mktemp -d`\n " )
29
+ args .insert (2 , "cp %s $schema_dir\n " % (" " .join ([f .short_path for f in ctx .files .schema_files ])))
30
+ args .append ("-s" )
31
+ args .append ("$schema_dir" )
35
32
36
33
if ctx .file .capabilities :
37
34
args .append ("--capabilities" )
38
35
args .append (ctx .file .capabilities .short_path )
39
36
37
+ if ctx .attr .strict :
38
+ args .append ("--strict" )
39
+
40
40
ctx .actions .write (
41
41
output = tester_file ,
42
42
content = " " .join (args ),
43
43
)
44
44
45
+ runfiles = ctx .runfiles (
46
+ files = files ,
47
+ )
48
+
45
49
return [
46
50
DefaultInfo (
47
51
executable = tester_file ,
@@ -71,6 +75,9 @@ _opa_check_test = rule(
71
75
providers = [ProtoInfo ],
72
76
doc = "Protobuf definition to generate json schemas" ,
73
77
),
78
+ "strict" : attr .bool (
79
+ doc = "enable compiler strict mode" ,
80
+ ),
74
81
"capabilities" : attr .label (
75
82
doc = "set capabilities.json file path" ,
76
83
allow_single_file = True ,
0 commit comments