Skip to content

Commit f8274d6

Browse files
authored
Change SemanticdbInfo.plugin_jar from string to File (#1530)
* SemanticdbInfo.plugin_jar from string to File * fix semanticdb example test
1 parent 1ddfd88 commit f8274d6

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

examples/semanticdb/aspect.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def semanticdb_info_aspect_impl(target, ctx):
88
output_struct = struct(
99
target_label = str(target.label),
1010
semanticdb_target_root = target[SemanticdbInfo].target_root,
11-
semanticdb_pluginjar = target[SemanticdbInfo].plugin_jar,
11+
semanticdb_pluginjar = "" if target[SemanticdbInfo].plugin_jar.path == None else target[SemanticdbInfo].plugin_jar.path,
1212
)
1313

1414
json_output_file = ctx.actions.declare_file("%s_semanticdb_info.json" % target.label.name)

scala/private/phases/phase_semanticdb.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def phase_semanticdb(ctx, p):
2020
scalacopts = []
2121
semanticdb_deps = []
2222
output_files = []
23-
plugin_jar_path = ""
23+
plugin_jar = None
2424

2525
target_output_path = paths.dirname(ctx.outputs.jar.path)
2626

@@ -45,7 +45,7 @@ def phase_semanticdb(ctx, p):
4545
if len(semanticdb_deps) != 1:
4646
fail("more than one semanticdb plugin jar was specified in scala_toolchain. Expect a single semanticdb plugin jar")
4747

48-
plugin_jar_path = semanticdb_deps[0][JavaInfo].java_outputs[0].class_jar.path
48+
plugin_jar = semanticdb_deps[0][JavaInfo].java_outputs[0].class_jar
4949

5050
scalacopts += [
5151
#note: Xplugin parameter handled in scalacworker,
@@ -65,7 +65,7 @@ def phase_semanticdb(ctx, p):
6565
semanticdb_enabled = True,
6666
target_root = None if toolchain.semanticdb_bundle_in_jar else semanticdb_target_root,
6767
is_bundled_in_jar = toolchain.semanticdb_bundle_in_jar,
68-
plugin_jar = plugin_jar_path,
68+
plugin_jar = plugin_jar,
6969
)
7070

7171
return struct(

scala/semanticdb_provider.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ SemanticdbInfo = provider(
33
"semanticdb_enabled": "boolean",
44
"target_root": "directory containing the semanticdb files (relative to execroot).",
55
"is_bundled_in_jar": "boolean: whether the semanticdb files are bundled inside the jar",
6-
"plugin_jar": "path to semanticdb plugin jar (relative to execroot)",
6+
"plugin_jar": "semanticdb plugin jar file",
77
},
88
)

test/semanticdb/rules.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def semanticdb_vars_script_impl(ctx):
1212
"%TARGETROOT%": "" if semanticdb_info.target_root == None else semanticdb_info.target_root,
1313
"%ENABLED%": "1" if semanticdb_info.semanticdb_enabled else "0",
1414
"%ISBUNDLED%": "1" if semanticdb_info.is_bundled_in_jar else "0",
15-
"%PLUGINPATH%": semanticdb_info.plugin_jar,
15+
"%PLUGINPATH%": "" if semanticdb_info.plugin_jar == None else semanticdb_info.plugin_jar.path,
1616
},
1717
)
1818
return [

0 commit comments

Comments
 (0)