From f0181607f920cd79b84f30f04c40674850794c6e Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Sat, 6 May 2023 05:26:12 +1000 Subject: [PATCH 1/3] Ensure IDE is built for lint CI --- app/ide-desktop/lib/types/modules.d.ts | 17 ----------------- build/cli/src/lib.rs | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/ide-desktop/lib/types/modules.d.ts b/app/ide-desktop/lib/types/modules.d.ts index 58762fe78f19..3c68a6e47708 100644 --- a/app/ide-desktop/lib/types/modules.d.ts +++ b/app/ide-desktop/lib/types/modules.d.ts @@ -2,23 +2,6 @@ * * This file MUST NOT `export {}` for the modules to be visible to other files. */ -declare module '*/build.json' { - interface BuildInfo { - commit: string - version: string - engineVersion: string - name: string - } - - const BUILD_INFO: BuildInfo - export default BUILD_INFO -} - -declare module '*/ensogl-pack/linked-dist' { - // eslint-disable-next-line no-restricted-syntax - export * from '../../../../lib/rust/ensogl/pack/js/src/runner/index' -} - declare module '*/gui/config.yaml' { interface Config { windowAppScopeName: string diff --git a/build/cli/src/lib.rs b/build/cli/src/lib.rs index c6fc4f497cc7..510849cc6dea 100644 --- a/build/cli/src/lib.rs +++ b/build/cli/src/lib.rs @@ -836,6 +836,27 @@ pub async fn main_internal(config: Option) -> Result .run_ok() .await?; + let build_json_exists = ctx.repo_root.join("app/ide-desktop/build.json").exists(); + let ide_artifacts_exist = ctx.repo_root.join("dist").exists(); + if !build_json_exists || !ide_artifacts_exist { + let ide_cli = Cli::parse_from([ + "./run", + "ide", + "build", + "--skip-version-check", + "--skip-wasm-opt", + "--wasm-profile=dev", + "--backend-source", + "release", + "--backend-release", + "nightly", + ]); + if let Target::Ide(ide) = ide_cli.target { + ctx.handle_ide(ide).await? + } else { + unreachable!("This command line is hard-coded to always use the IDE target.") + } + } prettier::check(&ctx.repo_root).await?; let js_modules_root = ctx.repo_root.join("app/ide-desktop"); Npm.cmd()?.current_dir(&js_modules_root).args(["install"]).run_ok().await?; From 121d29ecdf42fec5f93e638d4f59c6bf842473ed Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Sat, 6 May 2023 06:24:48 +1000 Subject: [PATCH 2/3] Fix path to linked-dist --- build/cli/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/cli/src/lib.rs b/build/cli/src/lib.rs index 510849cc6dea..d0d6f8dfef07 100644 --- a/build/cli/src/lib.rs +++ b/build/cli/src/lib.rs @@ -837,7 +837,7 @@ pub async fn main_internal(config: Option) -> Result .await?; let build_json_exists = ctx.repo_root.join("app/ide-desktop/build.json").exists(); - let ide_artifacts_exist = ctx.repo_root.join("dist").exists(); + let ide_artifacts_exist = ctx.repo_root.join("target/ensogl-pack/linked-dist").exists(); if !build_json_exists || !ide_artifacts_exist { let ide_cli = Cli::parse_from([ "./run", From c7bd4d13d2634feee5f7af47836434525f1316e8 Mon Sep 17 00:00:00 2001 From: somebody1234 Date: Tue, 9 May 2023 01:08:29 +1000 Subject: [PATCH 3/3] Use `ensogl_pack` functions instead of parsing a new command-line --- Cargo.lock | 1 + app/ide-desktop/lib/types/modules.d.ts | 13 ++++++++++++ build/cli/Cargo.toml | 1 + build/cli/src/lib.rs | 29 +++++++------------------- lib/rust/ensogl/pack/src/lib.rs | 2 +- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad4c0a5a1be2..67b787c8d401 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1937,6 +1937,7 @@ dependencies = [ "enso-build", "enso-build-base", "enso-formatter", + "ensogl-pack", "futures", "futures-util", "glob", diff --git a/app/ide-desktop/lib/types/modules.d.ts b/app/ide-desktop/lib/types/modules.d.ts index 3c68a6e47708..aaaefe4b9de1 100644 --- a/app/ide-desktop/lib/types/modules.d.ts +++ b/app/ide-desktop/lib/types/modules.d.ts @@ -2,6 +2,19 @@ * * This file MUST NOT `export {}` for the modules to be visible to other files. */ +// Required because this is a build artifact and so would not otherwise work on a clean repository. +declare module '*/build.json' { + interface BuildInfo { + commit: string + version: string + engineVersion: string + name: string + } + + const BUILD_INFO: BuildInfo + export default BUILD_INFO +} + declare module '*/gui/config.yaml' { interface Config { windowAppScopeName: string diff --git a/build/cli/Cargo.toml b/build/cli/Cargo.toml index 8e0c4025ed34..27e4167e3062 100644 --- a/build/cli/Cargo.toml +++ b/build/cli/Cargo.toml @@ -13,6 +13,7 @@ derivative = { workspace = true } enso-build-base = { path = "../base" } enso-build = { path = "../build" } enso-formatter = { path = "../enso-formatter" } +ensogl-pack = { path = "../../lib/rust/ensogl/pack" } futures = { workspace = true } futures-util = "0.3.17" glob = "0.3.0" diff --git a/build/cli/src/lib.rs b/build/cli/src/lib.rs index d0d6f8dfef07..4e7e04b4bc07 100644 --- a/build/cli/src/lib.rs +++ b/build/cli/src/lib.rs @@ -836,27 +836,14 @@ pub async fn main_internal(config: Option) -> Result .run_ok() .await?; - let build_json_exists = ctx.repo_root.join("app/ide-desktop/build.json").exists(); - let ide_artifacts_exist = ctx.repo_root.join("target/ensogl-pack/linked-dist").exists(); - if !build_json_exists || !ide_artifacts_exist { - let ide_cli = Cli::parse_from([ - "./run", - "ide", - "build", - "--skip-version-check", - "--skip-wasm-opt", - "--wasm-profile=dev", - "--backend-source", - "release", - "--backend-release", - "nightly", - ]); - if let Target::Ide(ide) = ide_cli.target { - ctx.handle_ide(ide).await? - } else { - unreachable!("This command line is hard-coded to always use the IDE target.") - } - } + // Copied from `build` in `lib/rust/ensogl/pack/src/lib.rs`. + let paths = ensogl_pack::Paths::new().await?; + ensogl_pack::compile_this_crate_ts_sources(&paths).await?; + ide_ci::fs::remove_symlink_dir_if_exists(&paths.target.ensogl_pack.linked_dist)?; + ide_ci::fs::symlink_auto( + &paths.target.ensogl_pack.dist, + &paths.target.ensogl_pack.linked_dist, + )?; prettier::check(&ctx.repo_root).await?; let js_modules_root = ctx.repo_root.join("app/ide-desktop"); Npm.cmd()?.current_dir(&js_modules_root).args(["install"]).run_ok().await?; diff --git a/lib/rust/ensogl/pack/src/lib.rs b/lib/rust/ensogl/pack/src/lib.rs index 5c11558b56af..d7fd1320e211 100644 --- a/lib/rust/ensogl/pack/src/lib.rs +++ b/lib/rust/ensogl/pack/src/lib.rs @@ -353,7 +353,7 @@ fn check_if_ts_needs_rebuild(paths: &Paths) -> Result { } /// Compile TypeScript sources of this crate in case they were not compiled yet. -async fn compile_this_crate_ts_sources(paths: &Paths) -> Result<()> { +pub async fn compile_this_crate_ts_sources(paths: &Paths) -> Result<()> { println!("compile_this_crate_ts_sources"); if check_if_ts_needs_rebuild(paths)? { info!("EnsoGL Pack TypeScript sources changed, recompiling.");