Stack detection fix
This commit is contained in:
@@ -13,13 +13,14 @@
|
||||
|
||||
USER root
|
||||
|
||||
# OpenJDK 21 (current LTS) and Maven for build support.
|
||||
# OpenJDK 17 (Bookworm's default LTS) and Maven for build support.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openjdk-21-jdk-headless \
|
||||
openjdk-17-jdk-headless \
|
||||
maven \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV JAVA_HOME="/usr/lib/jvm/java-21-openjdk-amd64"
|
||||
RUN ln -s /usr/lib/jvm/java-17-openjdk-* /usr/lib/jvm/java-17-openjdk
|
||||
ENV JAVA_HOME="/usr/lib/jvm/java-17-openjdk"
|
||||
|
||||
# Eclipse JDT Language Server — canonical LSP for Java/JVM (Java, Kotlin, Groovy).
|
||||
# Pin to a specific release; update JDTLS_VERSION + JDTLS_BUILD for upgrades.
|
||||
|
||||
@@ -417,6 +417,20 @@ fn apply_project_toml_key(
|
||||
Ok(format!("Set `{key} = {toml_value}` in `project.toml`."))
|
||||
}
|
||||
|
||||
/// Return the path to `docker/stacks/` in the huskies source tree.
|
||||
///
|
||||
/// Uses `CARGO_MANIFEST_DIR` (baked in at compile time) to find the workspace
|
||||
/// root, which is correct regardless of which project directory the gateway is
|
||||
/// running from.
|
||||
pub fn stacks_dir() -> std::path::PathBuf {
|
||||
let manifest_dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
|
||||
manifest_dir
|
||||
.parent()
|
||||
.expect("CARGO_MANIFEST_DIR has no parent")
|
||||
.join("docker")
|
||||
.join("stacks")
|
||||
}
|
||||
|
||||
/// Scan `stacks_dir` for per-stack `markers` files and detect which stacks
|
||||
/// match the given project directory.
|
||||
///
|
||||
@@ -693,10 +707,9 @@ async fn handle_adopt_project(
|
||||
crate::service::gateway::io::init_wizard_state(host_path);
|
||||
|
||||
// ── Detect or validate stack ─────────────────────────────────────────────
|
||||
let stacks_dir = config_dir.join("docker").join("stacks");
|
||||
let (resolved_stack, detect_warnings) = match stack {
|
||||
Some(s) => (Some(s.to_string()), vec![]),
|
||||
None => detect_stack(host_path, &stacks_dir),
|
||||
None => detect_stack(host_path, &stacks_dir()),
|
||||
};
|
||||
let stack_image = image_for_stack(resolved_stack.as_deref());
|
||||
let image = match build_project_image(host_path, &stack_image, name).await {
|
||||
@@ -1038,10 +1051,9 @@ pub async fn handle_new_project(
|
||||
|
||||
// ── Detect or validate stack ─────────────────────────────────────────────
|
||||
|
||||
let stacks_dir = config_dir.join("docker").join("stacks");
|
||||
let (resolved_stack, detect_warnings) = match stack {
|
||||
Some(s) => (Some(s.to_string()), vec![]),
|
||||
None => detect_stack(&host_path, &stacks_dir),
|
||||
None => detect_stack(&host_path, &stacks_dir()),
|
||||
};
|
||||
let stack_image = image_for_stack(resolved_stack.as_deref());
|
||||
let image = match build_project_image(&host_path, &stack_image, name).await {
|
||||
|
||||
@@ -154,8 +154,8 @@ pub async fn handle_project_rebuild(
|
||||
}
|
||||
|
||||
// ── 3. Build new image ───────────────────────────────────────────────────
|
||||
let stacks_dir = config_dir.join("docker").join("stacks");
|
||||
let (resolved_stack, _warnings) = super::new_project::detect_stack(host_path, &stacks_dir);
|
||||
let (resolved_stack, _warnings) =
|
||||
super::new_project::detect_stack(host_path, &super::new_project::stacks_dir());
|
||||
let base_image = super::new_project::image_for_stack(resolved_stack.as_deref());
|
||||
|
||||
let image = match super::new_project::build_project_image(host_path, &base_image, name).await {
|
||||
|
||||
Reference in New Issue
Block a user