Skip to content

Chore: Centralize generated content#34

Closed
kduy969 wants to merge 6 commits into
monkey666-cr:mainfrom
kduy969:duy.bui/centralize-generated-contents
Closed

Chore: Centralize generated content#34
kduy969 wants to merge 6 commits into
monkey666-cr:mainfrom
kduy969:duy.bui/centralize-generated-contents

Conversation

@kduy969

@kduy969 kduy969 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Introduces config.json at the repo root as the SSOT for internal path constants (.bazel-jdt/, .bazelproject, projects/, aspects/), replacing all hardcoded strings across the stack:

  • Rust: internal_config module reads via include_str! at compile time
  • Java: Maven copies root config.json into the JAR at build time; InternalConfig loads it from classpath
  • TypeScript: esbuild inlines the JSON import at bundle time

Generated files location changes:

  • .bazelproject → .bazel-jdt/.bazelproject
  • .bazel-projects/ → .bazel-jdt/projects/
  • .bazel-jdt/aspects/ — unchanged, already in place

Also create .gitignore inside .bazel-jdt folder to ensure all generated files are ignored

.map(|name| name == ".bazelproject")
.map(|name| name == crate::internal_config::config_file())
.unwrap_or(false)
&& is_in_bazel_jdt_dir(path)

@kduy969 kduy969 Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_bazelproject_file should check both the name and the location

@kduy969 kduy969 marked this pull request as draft June 3, 2026 07:27
@kduy969 kduy969 force-pushed the duy.bui/centralize-generated-contents branch from 96a1b88 to 3429a1d Compare June 3, 2026 07:55
@kduy969 kduy969 marked this pull request as ready for review June 3, 2026 08:08
@kduy969 kduy969 force-pushed the duy.bui/centralize-generated-contents branch from 7deb1da to 425c371 Compare June 3, 2026 08:21
@runchen0919

Copy link
Copy Markdown
Contributor

Hi, @kduy969 It is recommended that when generating the .bazel-jdt directory, the .gitignore file is generated in the directory by default and ignores all file contents in this directory.

@runchen0919

runchen0919 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

After loading examples/simple-java-project, Java Unit Explorer did not find any targets. Below is my .bazeproject file configuration.

# Generated by Bazel JDT Bridge
directories:
  app
  greeter
  tests

derive_targets_from_directories:
  True

test_sources:
  tests/**

bazel_binary: bazelisk

java_language_level: 21

@kduy969

kduy969 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Hi, @kduy969 It is recommended that when generating the .bazel-jdt directory, the .gitignore file is generated in the directory by default and ignores all file contents in this directory.

ok, let me put this behavior back

@zhirui1994

zhirui1994 commented Jun 3, 2026

Copy link
Copy Markdown

I got the same issue as @kduy969, the Unit Test Codelens and Test explorer disappeared:

Screenshot 2026-06-04 at 00 26 38

@zhirui1994

Copy link
Copy Markdown

How about we continue use folder .eclipse as the Centralize generated folder?

@runchen0919

Copy link
Copy Markdown
Contributor

How about we continue use folder .eclipse as the Centralize generated folder?

@zhirui1994 Actually, I didn't want to share a directory with previous plugins, which necessitated adding logic to clear the previous directory.

@zhirui1994

Copy link
Copy Markdown

How about we continue use folder .eclipse as the Centralize generated folder?

@zhirui1994 Actually, I didn't want to share a directory with previous plugins, which necessitated adding logic to clear the previous directory.

Got it, makes sense.

@runchen0919

Copy link
Copy Markdown
Contributor

@kduy969 I think the logic for ensureProjectGitignore should be modified to create a .gitignore file in the .bazel-jdt directory with the following content: *

@runchen0919 runchen0919 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kduy969 kduy969 closed this Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants