Skip to content

Commit

Permalink
feat(presets): java bazelrc options (#947)
Browse files Browse the repository at this point in the history
* feat(presets): java bazelrc options

* chore: improved comments
  • Loading branch information
alexeagle authored Oct 4, 2024
1 parent f479afd commit 1b4d9a7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .aspect/bazelrc/java.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Aspect recommended Bazel flags when using rules_java and rules_jvm_external

# Pin java versions to desired language level
# See https://bazel.build/docs/bazel-and-java#java-versions
# and https://en.wikipedia.org/wiki/Java_version_history

# What version of Java are the source files in this repo?
# See https://bazel.build/docs/user-manual#java-language-version
common --java_language_version=17

# The Java language version used to build tools that are executed during a build
# See https://bazel.build/docs/user-manual#tool-java-language-version
common --tool_java_language_version=17

# The version of JVM to use to execute the code and run the tests.
# NB: The default value is local_jdk which is non-hermetic.
# See https://bazel.build/docs/user-manual#java-runtime-version
common --java_runtime_version=remotejdk_17

# The version of JVM used to execute tools that are needed during a build.
# See https://bazel.build/docs/user-manual#tool-java-runtime-version
common --tool_java_runtime_version=remotejdk_17

# Repository rules, such as rules_jvm_external: put Bazel's JDK on the path.
# Avoids non-hermeticity from dependency on a JAVA_HOME pointing at a system JDK
# see https://github.com/bazelbuild/rules_jvm_external/issues/445
common --repo_env=JAVA_HOME=../bazel_tools/jdk
2 changes: 1 addition & 1 deletion docs/bazelrc_presets.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/bazelrc_presets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ALL_PRESETS = [
"convenience",
"correctness",
"debug",
"java",
"javascript",
"performance",
]
Expand Down

0 comments on commit 1b4d9a7

Please sign in to comment.