diff --git a/gazelle/common/git/BUILD.bazel b/gazelle/common/git/BUILD.bazel index cee94d70b..857d15c6a 100644 --- a/gazelle/common/git/BUILD.bazel +++ b/gazelle/common/git/BUILD.bazel @@ -6,8 +6,10 @@ go_library( importpath = "aspect.build/cli/gazelle/common/git", visibility = ["//visibility:public"], deps = [ + "//gazelle/common", "//pkg/logger", "@bazel_gazelle//config:go_default_library", + "@bazel_gazelle//rule:go_default_library", "@com_github_go_git_go_git_v5//plumbing/format/gitignore", ], ) diff --git a/gazelle/common/git/gitignore.go b/gazelle/common/git/gitignore.go index ed2e4e34d..eec2f1ddb 100644 --- a/gazelle/common/git/gitignore.go +++ b/gazelle/common/git/gitignore.go @@ -7,11 +7,15 @@ import ( "path" "strings" + common "aspect.build/cli/gazelle/common" BazelLog "aspect.build/cli/pkg/logger" "github.com/bazelbuild/bazel-gazelle/config" + "github.com/bazelbuild/bazel-gazelle/rule" gitignore "github.com/go-git/go-git/v5/plumbing/format/gitignore" ) +// TODO: remove and align with gazelle after https://github.com/aspect-build/aspect-cli/issues/755 + // Must align with patched bazel-gazelle const ASPECT_GITIGNORE = "__aspect:gitignore" @@ -25,7 +29,7 @@ const enabledExt = Directive_GitIgnore const lastConfiguredExt = "gitignore:dir" const ignorePatternsExt = "gitignore:patterns" -func CollectIgnoreFiles(c *config.Config, rel string) { +func collectIgnoreFiles(c *config.Config, rel string) { // Only parse once per directory. if lastCollected, hasCollected := c.Exts[lastConfiguredExt]; hasCollected && lastCollected == rel { return @@ -44,12 +48,33 @@ func CollectIgnoreFiles(c *config.Config, rel string) { } } -func EnableGitignore(c *config.Config, enabled bool) { - c.Exts[enabledExt] = enabled - if enabled { - c.Exts[ASPECT_GITIGNORE] = createMatcherFunc(c) - } else { - c.Exts[ASPECT_GITIGNORE] = nil +func ReadGitConfig(c *config.Config, rel string, f *rule.File) { + // Enable .gitignore support by default in Aspect gazelle languages. + // TODO: default to false and encourage use of .bazelignore instead + if rel == "" { + _, exists := c.Exts[enabledExt] + if !exists { + c.Exts[enabledExt] = true + } + } + + // Collect ignore files within this config directory. + collectIgnoreFiles(c, rel) + + // Collect config from directives within this BUILD. + if f != nil { + for _, d := range f.Directives { + switch d.Key { + case Directive_GitIgnore: + enabled := common.ReadEnabled(d) + c.Exts[enabledExt] = enabled + if enabled { + c.Exts[ASPECT_GITIGNORE] = createMatcherFunc(c) + } else { + c.Exts[ASPECT_GITIGNORE] = nil + } + } + } } } diff --git a/gazelle/common/walk.go b/gazelle/common/walk.go index ae1d83305..98205633e 100644 --- a/gazelle/common/walk.go +++ b/gazelle/common/walk.go @@ -1,8 +1,13 @@ package gazelle import ( + "log" + "strings" + BazelLog "aspect.build/cli/pkg/logger" + "github.com/bazelbuild/bazel-gazelle/config" "github.com/bazelbuild/bazel-gazelle/language" + "github.com/bazelbuild/bazel-gazelle/rule" ) type GazelleWalkFunc func(path string) error @@ -10,8 +15,30 @@ type GazelleWalkFunc func(path string) error // Must align with patched bazel-gazelle const ASPECT_WALKSUBDIR = "__aspect:walksubdir" -// Walk the directory of the language.GenerateArgs, optionally recursing into -// subdirectories unlike the files provided in GenerateArgs.RegularFiles. +// Read any configuration regarding walk options. +func ReadWalkConfig(c *config.Config, rel string, f *rule.File) bool { + if f == nil { + v, ok := c.Exts[ASPECT_WALKSUBDIR] + return !ok || !v.(bool) + } + + for _, d := range f.Directives { + switch d.Key { + case Directive_GenerationMode: + switch GenerationModeType(strings.TrimSpace(d.Value)) { + case GenerationModeCreate: + c.Exts[ASPECT_WALKSUBDIR] = false + case GenerationModeUpdate: + c.Exts[ASPECT_WALKSUBDIR] = true + default: + log.Fatalf("invalid value for directive %q: %s", Directive_GenerationMode, d.Value) + } + } + } + return true +} + +// Walk the directory being generated, respecting any walk generation config. func GazelleWalkDir(args language.GenerateArgs, walkFunc GazelleWalkFunc) error { BazelLog.Tracef("GazelleWalkDir: %s", args.Rel) diff --git a/gazelle/js/config.go b/gazelle/js/config.go index 74bc7af56..2d557f9d2 100644 --- a/gazelle/js/config.go +++ b/gazelle/js/config.go @@ -7,7 +7,6 @@ import ( "path" "strings" - common "aspect.build/cli/gazelle/common" "github.com/bazelbuild/bazel-gazelle/label" "github.com/bmatcuk/doublestar/v4" "github.com/emirpasic/gods/maps/linkedhashmap" @@ -158,7 +157,6 @@ type JsGazelleConfig struct { parent *JsGazelleConfig generationEnabled bool - generationMode common.GenerationModeType packageTargetKind PackageTargetKind @@ -191,7 +189,6 @@ func newRootConfig() *JsGazelleConfig { protoGenerationEnabled: true, tsconfigGenerationEnabled: false, packageGenerationEnabled: NpmPackageReferencedMode, - generationMode: common.GenerationModeCreate, packageTargetKind: PackageTargetKind_Package, pnpmLockPath: "pnpm-lock.yaml", ignoreDependencies: make([]string, 0), @@ -384,18 +381,6 @@ func (c *JsGazelleConfig) ValidateImportStatements() ValidationMode { return c.validateImportStatements } -// SetGenerationMode sets whether coarse-grained targets should be -// generated or not. -func (c *JsGazelleConfig) SetGenerationMode(generationMode common.GenerationModeType) { - c.generationMode = generationMode -} - -// GenerationMode returns whether coarse-grained targets should be -// generated or not. -func (c *JsGazelleConfig) GenerationMode() common.GenerationModeType { - return c.generationMode -} - // SetLibraryNamingConvention sets the ts_project target naming convention. func (c *JsGazelleConfig) SetLibraryNamingConvention(libraryNamingConvention string) { c.targetNamingOverrides[DefaultLibraryName] = libraryNamingConvention diff --git a/gazelle/js/configure.go b/gazelle/js/configure.go index ec29e3a77..30adda66c 100644 --- a/gazelle/js/configure.go +++ b/gazelle/js/configure.go @@ -25,9 +25,6 @@ var _ config.Configurer = (*typeScriptLang)(nil) // starts. RegisterFlags may set an initial values in Config.Exts. When flags // are set, they should modify these values. func (ts *typeScriptLang) RegisterFlags(fs *flag.FlagSet, cmd string, c *config.Config) { - // Enable .gitignore support by default - // TODO: change to false and encourage .bazelignore - git.EnableGitignore(c, true) } // CheckFlags validates the configuration after command line flags are parsed. @@ -59,15 +56,13 @@ func (ts *typeScriptLang) KnownDirectives() []string { Directive_LibraryFiles, Directive_TestFiles, - // Common directives supported by this language - common.Directive_GenerationMode, - // TODO(deprecated): remove Directive_CustomTargetFiles, Directive_CustomTargetTestFiles, // TODO: move to common git.Directive_GitIgnore, + common.Directive_GenerationMode, } } @@ -99,11 +94,9 @@ func (ts *typeScriptLang) Configure(c *config.Config, rel string, f *rule.File) ts.readConfigurations(c, rel) } - // TODO: move to common global config.Configurer - // Enable the WALKSUBDIR gazelle patch, setting the flag depending on js the GenerationMode. - c.Exts[common.ASPECT_WALKSUBDIR] = c.Exts[LanguageName].(*JsGazelleConfig).generationMode == common.GenerationModeUpdate + common.ReadWalkConfig(c, rel, f) - git.CollectIgnoreFiles(c, rel) + git.ReadGitConfig(c, rel, f) } func (ts *typeScriptLang) readConfigurations(c *config.Config, rel string) { @@ -230,57 +223,17 @@ func (ts *typeScriptLang) readDirectives(c *config.Config, rel string, f *rule.F } config.addTargetGlob(group, groupGlob, true) - case Directive_CustomTargetFiles: - groupGlob := strings.Split(value, " ") - if len(groupGlob) != 2 { - err := fmt.Errorf("invalid value for directive %q: %s: value must be group + glob", - Directive_CustomTargetFiles, d.Value) - log.Fatal(err) - } - - fmt.Printf("DEPRECATED: %s is deprecated, use %s %s instead\n", Directive_CustomTargetFiles, Directive_LibraryFiles, groupGlob[0]) - config.addTargetGlob(groupGlob[0], groupGlob[1], false) + // TODO: remove, deprecated + case Directive_CustomTargetFiles: + fmt.Fprintf(os.Stderr, "DEPRECATED: %s is deprecated, use %s\n", Directive_CustomTargetFiles, Directive_LibraryFiles) + os.Exit(1) case Directive_CustomTargetTestFiles: - groupGlob := strings.Split(value, " ") - if len(groupGlob) != 2 { - err := fmt.Errorf("invalid value for directive %q: %s: value must be group + glob", - Directive_CustomTargetTestFiles, d.Value) - log.Fatal(err) - } - - fmt.Printf("DEPRECATED: %s is deprecated, use %s %s instead\n", Directive_CustomTargetTestFiles, Directive_TestFiles, groupGlob[0]) - - config.addTargetGlob(groupGlob[0], groupGlob[1], true) - + fmt.Fprintf(os.Stderr, "DEPRECATED: %s is deprecated, use %s\n", Directive_CustomTargetTestFiles, Directive_TestFiles) + os.Exit(1) case Directive_GenerationMode: - mode := strings.TrimSpace(d.Value) - switch mode { - case "directory": - config.SetGenerationMode(common.GenerationModeCreate) - case "none": - config.SetGenerationMode(common.GenerationModeUpdate) - default: - log.Fatalf("invalid value for directive %q: %s", Directive_GenerationMode, d.Value) - } - - fmt.Printf("DEPRECATED: %s is deprecated, use %s %s|%s\n", Directive_GenerationMode, common.Directive_GenerationMode, common.GenerationModeUpdate, common.GenerationModeCreate) - - // Inherited aspect-cli common+pro values - // TODO: move to common location - case common.Directive_GenerationMode: - mode := common.GenerationModeType(strings.TrimSpace(d.Value)) - switch mode { - case common.GenerationModeCreate: - config.SetGenerationMode(common.GenerationModeCreate) - case common.GenerationModeUpdate: - config.SetGenerationMode(common.GenerationModeUpdate) - default: - log.Fatalf("invalid value for directive %q: %s", common.Directive_GenerationMode, d.Value) - } - // TODO: move to common - case git.Directive_GitIgnore: - git.EnableGitignore(c, common.ReadEnabled(d)) + fmt.Fprintf(os.Stderr, "DEPRECATED: %s is deprecated, use %s %s|%s\n", Directive_GenerationMode, common.Directive_GenerationMode, common.GenerationModeUpdate, common.GenerationModeCreate) + os.Exit(1) } } } diff --git a/gazelle/js/generate.go b/gazelle/js/generate.go index f557a954e..ea0cddd1d 100644 --- a/gazelle/js/generate.go +++ b/gazelle/js/generate.go @@ -55,13 +55,6 @@ func (ts *typeScriptLang) GenerateRules(args language.GenerateArgs) language.Gen return language.GenerateResult{} } - // If this directory has not been declared as a bazel package only continue - // if generating new BUILD files is enabled. - if cfg.GenerationMode() == gazelle.GenerationModeUpdate && args.File == nil { - BazelLog.Tracef("GenerateRules(%s) BUILD creation disabled: %s", LanguageName, args.Rel) - return language.GenerateResult{} - } - BazelLog.Tracef("GenerateRules(%s): %s", LanguageName, args.Rel) var result language.GenerateResult diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/BUILD.in b/gazelle/js/tests/gazelle_generation_mode_legacy/BUILD.in index e69de29bb..8958b11d9 100644 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/BUILD.in +++ b/gazelle/js/tests/gazelle_generation_mode_legacy/BUILD.in @@ -0,0 +1 @@ +# gazelle:js_generation_mode directory diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/BUILD.out index e0a0128e9..8958b11d9 100644 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/BUILD.out +++ b/gazelle/js/tests/gazelle_generation_mode_legacy/BUILD.out @@ -1,6 +1 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -ts_project( - name = "gazelle_generation_mode", - srcs = ["main.ts"], -) +# gazelle:js_generation_mode directory diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/default/src/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/default/src/BUILD.out deleted file mode 100644 index b2ff0fb2d..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/default/src/BUILD.out +++ /dev/null @@ -1,6 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -ts_project( - name = "src", - srcs = ["lib1.ts"], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/default/src/lib1.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/default/src/lib1.ts deleted file mode 100644 index 5243ca04f..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/default/src/lib1.ts +++ /dev/null @@ -1 +0,0 @@ -// Directory containing only .ts diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/BUILD.in b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/BUILD.in deleted file mode 100644 index 52072608f..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/BUILD.in +++ /dev/null @@ -1,4 +0,0 @@ -# Directory enabling 'directory' mode and containing a .ts -# Same files/layout as sibling directories. - -# gazelle:js_generation_mode directory diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/BUILD.out deleted file mode 100644 index 3b6003374..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/BUILD.out +++ /dev/null @@ -1,16 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -# Directory enabling 'directory' mode and containing a .ts -# Same files/layout as sibling directories. - -# gazelle:js_generation_mode directory - -ts_project( - name = "directory", - srcs = ["lib.ts"], - deps = [ - "//directory/a", - "//directory/a/a1", - "//directory/b", - ], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/BUILD.out deleted file mode 100644 index ca7742269..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/BUILD.out +++ /dev/null @@ -1,10 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -ts_project( - name = "a", - srcs = ["lib-a.ts"], - deps = [ - "//directory/a/a1", - "//directory/a/a2", - ], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a1/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a1/BUILD.out deleted file mode 100644 index e56bf36e0..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a1/BUILD.out +++ /dev/null @@ -1,6 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -ts_project( - name = "a1", - srcs = ["lib-a1.ts"], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a1/lib-a1.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a1/lib-a1.ts deleted file mode 100644 index e6021a54a..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a1/lib-a1.ts +++ /dev/null @@ -1 +0,0 @@ -export const a_a1_lib = '123'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a2/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a2/BUILD.out deleted file mode 100644 index 764459c04..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a2/BUILD.out +++ /dev/null @@ -1,7 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -ts_project( - name = "a2", - srcs = ["lib-a2.ts"], - deps = ["//directory/a/a1"], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a2/lib-a2.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a2/lib-a2.ts deleted file mode 100644 index 67b3f6d0a..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/a2/lib-a2.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a_a1_lib } from '../a1/lib-a1'; - -export const a_a2_lib = a_a1_lib + 'v2'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/lib-a.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/lib-a.ts deleted file mode 100644 index c66c1e217..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/a/lib-a.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './a1/lib-a1'; -export * from './a2/lib-a2'; -export const a_lib = '123'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/BUILD.in b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/BUILD.in deleted file mode 100644 index 39ba8985e..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/BUILD.in +++ /dev/null @@ -1 +0,0 @@ -# gazelle:js_generation_mode none diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/BUILD.out deleted file mode 100644 index ddecd51bf..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/BUILD.out +++ /dev/null @@ -1,12 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -# gazelle:js_generation_mode none - -ts_project( - name = "b", - srcs = [ - "b1/lib-b1.ts", - "lib-b.ts", - ], - deps = ["//directory/a"], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/b1/lib-b1.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/b1/lib-b1.ts deleted file mode 100644 index bb7ea6e14..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/b1/lib-b1.ts +++ /dev/null @@ -1 +0,0 @@ -export const value = 'directory/b/b1/lib'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/lib-b.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/lib-b.ts deleted file mode 100644 index 749daceec..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/b/lib-b.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from '../a/lib-a'; -export * from './b1/lib-b1'; -export const b_lib = '456'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/lib.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/lib.ts deleted file mode 100644 index 97e3ace16..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/lib.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './a/lib-a'; -export * from './a/a1/lib-a1'; -export * from './b/lib-b'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty-sub/BUILD.in b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty-sub/BUILD.in deleted file mode 100644 index f230fbdae..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty-sub/BUILD.in +++ /dev/null @@ -1,9 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -ts_project( - name = "now-empty-sub", - srcs = ["src/a.ts"], - deps = [ - "//directory/a", - ], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty-sub/src/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty-sub/src/BUILD.out deleted file mode 100644 index 76259964f..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty-sub/src/BUILD.out +++ /dev/null @@ -1,7 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -ts_project( - name = "src", - srcs = ["a.ts"], - deps = ["//directory/a"], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty-sub/src/a.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty-sub/src/a.ts deleted file mode 100644 index 16f9668dd..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty-sub/src/a.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../a/lib-a'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty/BUILD.in b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty/BUILD.in deleted file mode 100644 index 73ad5df9b..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty/BUILD.in +++ /dev/null @@ -1,11 +0,0 @@ -# TEST - -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -ts_project( - name = "now-empty", - srcs = ["old.ts"], - deps = [ - "//directory/a", - ], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty/BUILD.out deleted file mode 100644 index 839c30c63..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/directory/now-empty/BUILD.out +++ /dev/null @@ -1 +0,0 @@ -# TEST diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/expectedExitCode.txt b/gazelle/js/tests/gazelle_generation_mode_legacy/expectedExitCode.txt new file mode 100644 index 000000000..56a6051ca --- /dev/null +++ b/gazelle/js/tests/gazelle_generation_mode_legacy/expectedExitCode.txt @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/expectedStderr.txt b/gazelle/js/tests/gazelle_generation_mode_legacy/expectedStderr.txt new file mode 100644 index 000000000..9f8737789 --- /dev/null +++ b/gazelle/js/tests/gazelle_generation_mode_legacy/expectedStderr.txt @@ -0,0 +1 @@ +DEPRECATED: js_generation_mode is deprecated, use generation_mode update|create diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/expectedStdout.txt b/gazelle/js/tests/gazelle_generation_mode_legacy/expectedStdout.txt deleted file mode 100644 index caa01b6d4..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/expectedStdout.txt +++ /dev/null @@ -1,5 +0,0 @@ -DEPRECATED: js_generation_mode is deprecated, use generation_mode update|create -DEPRECATED: js_generation_mode is deprecated, use generation_mode update|create -DEPRECATED: js_generation_mode is deprecated, use generation_mode update|create -DEPRECATED: js_generation_mode is deprecated, use generation_mode update|create -DEPRECATED: js_generation_mode is deprecated, use generation_mode update|create diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/BUILD.in b/gazelle/js/tests/gazelle_generation_mode_legacy/none/BUILD.in deleted file mode 100644 index 39ba8985e..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/BUILD.in +++ /dev/null @@ -1 +0,0 @@ -# gazelle:js_generation_mode none diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/none/BUILD.out deleted file mode 100644 index 1c4ee431c..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/BUILD.out +++ /dev/null @@ -1,13 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -# gazelle:js_generation_mode none - -ts_project( - name = "none", - srcs = [ - "a/a2/lib-a2.ts", - "a/lib-a.ts", - "lib1.ts", - ], - deps = ["//none/a/a1"], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a1/BUILD.in b/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a1/BUILD.in deleted file mode 100644 index 8958b11d9..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a1/BUILD.in +++ /dev/null @@ -1 +0,0 @@ -# gazelle:js_generation_mode directory diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a1/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a1/BUILD.out deleted file mode 100644 index 98eafe828..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a1/BUILD.out +++ /dev/null @@ -1,8 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -# gazelle:js_generation_mode directory - -ts_project( - name = "a1", - srcs = ["lib-a1.ts"], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a1/lib-a1.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a1/lib-a1.ts deleted file mode 100644 index e6021a54a..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a1/lib-a1.ts +++ /dev/null @@ -1 +0,0 @@ -export const a_a1_lib = '123'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a2/lib-a2.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a2/lib-a2.ts deleted file mode 100644 index 67b3f6d0a..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/a2/lib-a2.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { a_a1_lib } from '../a1/lib-a1'; - -export const a_a2_lib = a_a1_lib + 'v2'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/lib-a.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/lib-a.ts deleted file mode 100644 index c66c1e217..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/a/lib-a.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './a1/lib-a1'; -export * from './a2/lib-a2'; -export const a_lib = '123'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/BUILD.in b/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/BUILD.in deleted file mode 100644 index d2413b723..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/BUILD.in +++ /dev/null @@ -1,2 +0,0 @@ -# gazelle:js_generation_mode directory - diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/BUILD.out deleted file mode 100644 index efe3eb935..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/BUILD.out +++ /dev/null @@ -1,12 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -# gazelle:js_generation_mode directory - -ts_project( - name = "b", - srcs = ["lib-b.ts"], - deps = [ - "//none", - "//none/b/b1", - ], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/b1/BUILD.out b/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/b1/BUILD.out deleted file mode 100644 index 37f482ee2..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/b1/BUILD.out +++ /dev/null @@ -1,6 +0,0 @@ -load("@aspect_rules_ts//ts:defs.bzl", "ts_project") - -ts_project( - name = "b1", - srcs = ["lib-b1.ts"], -) diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/b1/lib-b1.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/b1/lib-b1.ts deleted file mode 100644 index bb7ea6e14..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/b1/lib-b1.ts +++ /dev/null @@ -1 +0,0 @@ -export const value = 'directory/b/b1/lib'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/lib-b.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/lib-b.ts deleted file mode 100644 index 749daceec..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/b/lib-b.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from '../a/lib-a'; -export * from './b1/lib-b1'; -export const b_lib = '456'; diff --git a/gazelle/js/tests/gazelle_generation_mode_legacy/none/lib1.ts b/gazelle/js/tests/gazelle_generation_mode_legacy/none/lib1.ts deleted file mode 100644 index 5243ca04f..000000000 --- a/gazelle/js/tests/gazelle_generation_mode_legacy/none/lib1.ts +++ /dev/null @@ -1 +0,0 @@ -// Directory containing only .ts diff --git a/gazelle/kotlin/configure.go b/gazelle/kotlin/configure.go index 0dffbc700..78b84cfbb 100644 --- a/gazelle/kotlin/configure.go +++ b/gazelle/kotlin/configure.go @@ -48,7 +48,7 @@ func (kt *kotlinLang) Configure(c *config.Config, rel string, f *rule.File) { } // Collect the ignore files for this package - git.CollectIgnoreFiles(c, rel) + git.ReadGitConfig(c, rel, f) if f != nil { for _, d := range f.Directives { @@ -62,10 +62,6 @@ func (kt *kotlinLang) Configure(c *config.Config, rel string, f *rule.File) { case jvm_javaconfig.JavaMavenInstallFile: cfg.SetMavenInstallFile(d.Value) - - // TODO: move to common - case git.Directive_GitIgnore: - git.EnableGitignore(c, common.ReadEnabled(d)) } } }