feat(java): Show Java module for Clojure projects (#966)
This commit is contained in:
parent
f87af93d93
commit
389e006c00
|
@ -1336,8 +1336,8 @@ disabled = false
|
||||||
The `java` module shows the currently installed version of Java.
|
The `java` module shows the currently installed version of Java.
|
||||||
The module will be shown if any of the following conditions are met:
|
The module will be shown if any of the following conditions are met:
|
||||||
|
|
||||||
- The current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt` or `.java-version` file
|
- The current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt`, `.java-version`, `.deps.edn`, `project.clj`, or `build.boot` file
|
||||||
- The current directory contains a file with the `.java`, `.class`, `.gradle` or `.jar` extension
|
- The current directory contains a file with the `.java`, `.class`, `.gradle`, `.jar`, `.clj`, or `.cljc` extension
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,21 @@ const JAVA_VERSION_PATTERN: &str = "(?P<version>[\\d\\.]+)[^\\s]*\\s(?:built|fro
|
||||||
/// Creates a module with the current Java version
|
/// Creates a module with the current Java version
|
||||||
///
|
///
|
||||||
/// Will display the Java version if any of the following criteria are met:
|
/// Will display the Java version if any of the following criteria are met:
|
||||||
/// - Current directory contains a file with a `.java`, `.class`, `.gradle` or `.jar` extension
|
/// - Current directory contains a file with a `.java`, `.class`, `.jar`, `.gradle`, `.clj`, or `.cljc` extension
|
||||||
/// - Current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt` or `.java-version` file
|
/// - Current directory contains a `pom.xml`, `build.gradle.kts`, `build.sbt`, `.java-version`, `deps.edn`, `project.clj`, or `build.boot` file
|
||||||
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||||
let is_java_project = context
|
let is_java_project = context
|
||||||
.try_begin_scan()?
|
.try_begin_scan()?
|
||||||
.set_files(&["pom.xml", "build.gradle.kts", "build.sbt", ".java-version"])
|
.set_files(&[
|
||||||
.set_extensions(&["java", "class", "jar", "gradle"])
|
"pom.xml",
|
||||||
|
"build.gradle.kts",
|
||||||
|
"build.sbt",
|
||||||
|
".java-version",
|
||||||
|
"deps.edn",
|
||||||
|
"project.clj",
|
||||||
|
"build.boot",
|
||||||
|
])
|
||||||
|
.set_extensions(&["java", "class", "jar", "gradle", "clj", "cljc"])
|
||||||
.is_match();
|
.is_match();
|
||||||
|
|
||||||
if !is_java_project {
|
if !is_java_project {
|
||||||
|
|
Loading…
Reference in New Issue