[mojo] Remove root from search path and update comment I thought about changing mojom.gni, but it's kind of brittle, because the generator doesn't actually need the gen import path, so it's possible that someone might remove this and silently break indexing. Putting it in mojom_indexer in g3 also doesn't really make sense, because it should only be concerned with processing the input it's given. Having it inside package_index is not great, but it's the least bad IMO. Fixed: 277438505 Change-Id: I353ba243d7962e19355ed82725b377e13c59b011 Reviewed-on: https://chromium-review.googlesource.com/c/infra/infra/+/7477277 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Auto-Submit: Fred Shih <ffred@chromium.org> Cr-Commit-Position: refs/heads/main@{#78425}
diff --git a/go/src/infra/cmd/package_index/mojom.go b/go/src/infra/cmd/package_index/mojom.go index 95e7afe..e39e723 100644 --- a/go/src/infra/cmd/package_index/mojom.go +++ b/go/src/infra/cmd/package_index/mojom.go
@@ -163,13 +163,9 @@ } } unitProto.Argument = append(unitProto.Argument, sourceFiles...) - // TODO(crbug.com/277438505): This is a hack. The mojom kythe indexer - // does not use CWD when trying to resolve imports. Unfortunately, roll - // out for the indexer is quite slow. Temporarily hardcode a CWD import - // here. If this fixes the gen/ import issue, we should make the fix to - // the indexer and remove this flag. - unitProto.Argument = append(unitProto.Argument, "-I") - unitProto.Argument = append(unitProto.Argument, "./") + // Adds the gen dir to the import paths. Mojo only does import validation + // at parse time, and not at code generation time, so it could be missing + // this directory. unitProto.Argument = append(unitProto.Argument, "-I") unitProto.Argument = append(unitProto.Argument, "./gen") unitProto.VName = &kpb.VName{Corpus: m.corpus, Language: "mojom"}
diff --git a/go/src/infra/cmd/package_index/package_index_testdata/units.expected/runtime_feature_state.mojom.prototext b/go/src/infra/cmd/package_index/package_index_testdata/units.expected/runtime_feature_state.mojom.prototext index 1e49c49..5596210 100644 --- a/go/src/infra/cmd/package_index/package_index_testdata/units.expected/runtime_feature_state.mojom.prototext +++ b/go/src/infra/cmd/package_index/package_index_testdata/units.expected/runtime_feature_state.mojom.prototext
@@ -37,8 +37,6 @@ argument: "../../chrome/VERSION" argument: "gen/third_party/blink/public/mojom/runtime_feature_state/runtime_feature_state.mojom" argument: "-I" - argument: "./" - argument: "-I" argument: "./gen" source_file: "gen/third_party/blink/public/mojom/runtime_feature_state/runtime_feature_state.mojom" details: {
diff --git a/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test.mojom.prototext b/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test.mojom.prototext index 3786118..d545b54 100644 --- a/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test.mojom.prototext +++ b/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test.mojom.prototext
@@ -41,8 +41,6 @@ argument: "ipc_logging" argument: "../../test.mojom" argument: "-I" - argument: "./" - argument: "-I" argument: "./gen" source_file: "../../test.mojom" details {
diff --git a/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test2.mojom.prototext b/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test2.mojom.prototext index ad2e12c..08f5ef3 100644 --- a/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test2.mojom.prototext +++ b/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test2.mojom.prototext
@@ -31,8 +31,6 @@ argument: "ipc_logging" argument: "../../test2.mojom" argument: "-I" - argument: "./" - argument: "-I" argument: "./gen" source_file: "../../test2.mojom" details {
diff --git a/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test3.mojom.prototext b/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test3.mojom.prototext index dd0daaf..bac73f5 100644 --- a/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test3.mojom.prototext +++ b/go/src/infra/cmd/package_index/package_index_testdata/units.expected/test3.mojom.prototext
@@ -30,8 +30,6 @@ argument: "../../chrome/VERSION" argument: "../../test3.mojom" argument: "-I" - argument: "./" - argument: "-I" argument: "./gen" source_file: "../../test3.mojom" details {
diff --git a/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/runtime_feature_state.mojom.prototext b/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/runtime_feature_state.mojom.prototext index 7520d10..12898f1 100644 --- a/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/runtime_feature_state.mojom.prototext +++ b/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/runtime_feature_state.mojom.prototext
@@ -37,8 +37,6 @@ argument: "../../chrome/VERSION" argument: "gen/third_party/blink/public/mojom/runtime_feature_state/runtime_feature_state.mojom" argument: "-I" - argument: "./" - argument: "-I" argument: "./gen" source_file: "gen/third_party/blink/public/mojom/runtime_feature_state/runtime_feature_state.mojom" details: {
diff --git a/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test.mojom.prototext b/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test.mojom.prototext index a8c040e..007f549 100644 --- a/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test.mojom.prototext +++ b/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test.mojom.prototext
@@ -41,8 +41,6 @@ argument: "ipc_logging" argument: "../../test.mojom" argument: "-I" - argument: "./" - argument: "-I" argument: "./gen" source_file: "../../test.mojom" details {
diff --git a/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test2.mojom.prototext b/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test2.mojom.prototext index bcf7f2c..9cad260 100644 --- a/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test2.mojom.prototext +++ b/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test2.mojom.prototext
@@ -31,8 +31,6 @@ argument: "ipc_logging" argument: "../../test2.mojom" argument: "-I" - argument: "./" - argument: "-I" argument: "./gen" source_file: "../../test2.mojom" details {
diff --git a/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test3.mojom.prototext b/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test3.mojom.prototext index 2856120..41fad8d 100644 --- a/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test3.mojom.prototext +++ b/go/src/infra/cmd/package_index/package_index_testdata/units_win.expected/test3.mojom.prototext
@@ -30,8 +30,6 @@ argument: "../../chrome/VERSION" argument: "../../test3.mojom" argument: "-I" - argument: "./" - argument: "-I" argument: "./gen" source_file: "../../test3.mojom" details {