дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-18 15:46:14 +02:00
Порівняти коміти
1
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
694f833b15 |
No files matched your search
@@ -53,6 +53,8 @@ pub(crate) fn detect_with_profiles(
|
||||
&mut out,
|
||||
);
|
||||
detect_projects_matching(root, ruby_project, detect_ruby, &mut out);
|
||||
detect_projects(root, &["rebar.config"], detect_rebar, &mut out);
|
||||
detect_projects(root, &["mix.exs"], detect_mix, &mut out);
|
||||
for dir in ide_core::project_roots::discover(root, &["CMakeLists.txt"]) {
|
||||
let start = out.len();
|
||||
cmake::detect(&dir, if dir == root { profiles } else { None }, &mut out);
|
||||
@@ -1326,6 +1328,38 @@ pub(crate) fn just_recipes(src: &str) -> Vec<String> {
|
||||
|
||||
// ---------------------------------------------------------------- godot
|
||||
|
||||
// ---------------------------------------------------------------- rebar3 / mix
|
||||
|
||||
/// rebar3 (Erlang): the shell with the applications started, the EUnit tests and, with
|
||||
/// `*_SUITE.erl` suites, Common Test. A `rebar3` script in the project wins over the PATH.
|
||||
fn detect_rebar(root: &Path, out: &mut Vec<RunConfig>) {
|
||||
let rebar = wrapper(root, "rebar3", "rebar3.cmd", "rebar3");
|
||||
out.push(config("rebar3:shell", "rebar3 shell", "rebar3", &rebar, &["shell"]));
|
||||
out.push(config("rebar3:eunit", "rebar3 eunit", "rebar3", &rebar, &["eunit"]).test());
|
||||
let suites = |dir: &Path| {
|
||||
fs::read_dir(dir)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.flatten()
|
||||
.any(|e| e.file_name().to_string_lossy().ends_with("_SUITE.erl"))
|
||||
};
|
||||
let mut apps = subdirs(&root.join("apps")).into_iter().chain(subdirs(&root.join("lib")));
|
||||
if suites(&root.join("test")) || apps.any(|app| suites(&app.join("test"))) {
|
||||
out.push(config("rebar3:ct", "rebar3 ct", "rebar3", &rebar, &["ct"]).test());
|
||||
}
|
||||
}
|
||||
|
||||
/// Mix (Elixir): the application in IEx (`phx.server` for Phoenix) and its ExUnit tests.
|
||||
fn detect_mix(root: &Path, out: &mut Vec<RunConfig>) {
|
||||
let phoenix = read(&root.join("mix.exs")).is_some_and(|src| src.contains("{:phoenix,"));
|
||||
if phoenix {
|
||||
out.push(config("mix:phx.server", "iex -S mix phx.server", "mix", "iex", &["-S", "mix", "phx.server"]));
|
||||
} else {
|
||||
out.push(config("mix:iex", "iex -S mix", "mix", "iex", &["-S", "mix"]));
|
||||
}
|
||||
out.push(config("mix:test", "mix test", "mix", "mix", &["test"]).test());
|
||||
}
|
||||
|
||||
/// Godot projects (`project.godot`) at the root or one level down: "Godot Project"
|
||||
/// runs the main scene (`godot --path .`), debuggable through the editor's adapter.
|
||||
fn detect_godot(root: &Path, out: &mut Vec<RunConfig>) {
|
||||
|
||||
@@ -1173,3 +1173,36 @@ fn a_django_project_in_src_uses_the_environment_next_to_it() {
|
||||
assert!(c.iter().any(|c| c.id == "pytest"));
|
||||
assert!(!c.iter().any(|c| c.id.starts_with("pytest:")), "{:?}", c.iter().map(|c| &c.id).collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rebar3_projects() {
|
||||
let dir = project(&[("rebar.config", "{erl_opts, [debug_info]}.\n"), ("src/app.erl", "-module(app).\n")]);
|
||||
let c = detect(dir.path());
|
||||
assert_eq!(ids(&c), ["rebar3:shell", "rebar3:eunit"]);
|
||||
assert_eq!(cmdline(&c[0]), "rebar3 shell");
|
||||
assert!(c[1].is_test);
|
||||
|
||||
// Common Test suites in an umbrella app; the project's own rebar3 script.
|
||||
let dir = project(&[
|
||||
("rebar.config", ""),
|
||||
("rebar3", "#!/usr/bin/env escript\n"),
|
||||
("apps/core/test/core_SUITE.erl", "-module(core_SUITE).\n"),
|
||||
]);
|
||||
let c = detect(dir.path());
|
||||
assert_eq!(ids(&c), ["rebar3:shell", "rebar3:eunit", "rebar3:ct"]);
|
||||
if !cfg!(windows) {
|
||||
assert_eq!(cmdline(find(&c, "rebar3:ct")), "./rebar3 ct");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mix_projects() {
|
||||
let dir = project(&[("mix.exs", "defmodule App.MixProject do\n defp deps, do: []\nend\n")]);
|
||||
let c = detect(dir.path());
|
||||
assert_eq!(ids(&c), ["mix:iex", "mix:test"]);
|
||||
assert_eq!(cmdline(&c[0]), "iex -S mix");
|
||||
assert!(c[1].is_test);
|
||||
|
||||
let dir = project(&[("mix.exs", "defp deps do\n [{:phoenix, \"~> 1.7\"}]\nend\n")]);
|
||||
assert_eq!(cmdline(&detect(dir.path())[0]), "iex -S mix phx.server");
|
||||
}
|
||||
@@ -130,6 +130,11 @@ export function configIcon(config: Pick<RunConfig, "kind" | "isTest">): string {
|
||||
return "file-csharp";
|
||||
case "go":
|
||||
return "file-go";
|
||||
case "rebar3":
|
||||
case "escript":
|
||||
return "file-erlang";
|
||||
case "mix":
|
||||
return "file-elixir";
|
||||
case "node":
|
||||
return "file-js";
|
||||
case "application":
|
||||
|
||||
@@ -71,6 +71,7 @@ const ALL = env({
|
||||
"clang++": null,
|
||||
dart: null,
|
||||
elixir: null,
|
||||
escript: null,
|
||||
"scala-cli": null,
|
||||
deno: "2.1.0",
|
||||
bun: "1.1.0",
|
||||
@@ -245,6 +246,10 @@ describe("single-file producers (scratches)", () => {
|
||||
expect(run(scratch("a.swift"))).toMatchObject({ command: "/bin/swift", args: ["a.swift"] });
|
||||
expect(run(scratch("a.dart"))).toMatchObject({ command: "/bin/dart", args: ["run", "a.dart"] });
|
||||
expect(run(scratch("a.exs"))).toMatchObject({ command: "/bin/elixir", args: ["a.exs"] });
|
||||
expect(run(scratch("tool.escript"))).toMatchObject({
|
||||
command: "/bin/escript",
|
||||
args: ["tool.escript"],
|
||||
});
|
||||
expect(run(scratch("a.sc"))).toMatchObject({ command: "/bin/scala-cli", args: ["run", "a.sc"] });
|
||||
expect(run(scratch("a.kts"))).toMatchObject({ command: "/bin/kotlin", args: ["a.kts"] });
|
||||
expect(run(scratch("a.kts"), env({ kotlinc: null }))).toMatchObject({
|
||||
|
||||
@@ -220,6 +220,7 @@ export type ScriptLanguage =
|
||||
| "cpp"
|
||||
| "dart"
|
||||
| "elixir"
|
||||
| "escript"
|
||||
| "scala"
|
||||
| "shebang";
|
||||
|
||||
@@ -259,6 +260,7 @@ export function scriptLanguage(path: string, content?: string): ScriptLanguage |
|
||||
if (/\.(cpp|cc|cxx|c\+\+)$/.test(name)) return "cpp";
|
||||
if (/\.dart$/.test(name)) return "dart";
|
||||
if (/\.exs$/.test(name)) return "elixir";
|
||||
if (/\.escript$/.test(name)) return "escript";
|
||||
if (/\.(scala|sc)$/.test(name)) return "scala";
|
||||
if (!name.includes(".") && shebang(content)) return "shebang";
|
||||
return null;
|
||||
@@ -313,6 +315,8 @@ export function toolsFor(lang: ScriptLanguage, content?: string): string[] {
|
||||
return ["dart"];
|
||||
case "elixir":
|
||||
return ["elixir"];
|
||||
case "escript":
|
||||
return ["escript"];
|
||||
case "scala":
|
||||
return ["scala-cli"];
|
||||
}
|
||||
@@ -338,6 +342,7 @@ const INSTALL: Record<string, string> = {
|
||||
cpp: "Install a C++ compiler: `xcode-select --install` (clang++) or `brew install gcc`.",
|
||||
dart: "Install the Dart SDK (`brew install dart-sdk`).",
|
||||
elixir: "Install Elixir (`brew install elixir`).",
|
||||
escript: "Install Erlang/OTP (`brew install erlang`).",
|
||||
scala: "Install Scala CLI (`brew install Virtuslab/scala-cli/scala-cli`).",
|
||||
shell: "Install the shell named in the script's #! line.",
|
||||
shebang: "Install the interpreter named in the script's #! line.",
|
||||
@@ -905,6 +910,7 @@ export function produceFile(input: ContextInput, env: ToolEnv): Produced | null
|
||||
case "lua":
|
||||
case "swift":
|
||||
case "elixir":
|
||||
case "escript":
|
||||
return simple(lang, s, env, lang, () => [s.arg]);
|
||||
case "r":
|
||||
return simple(lang, s, env, "r", () => [s.arg]);
|
||||
|
||||
Reference in new issue
Заблокувати користувача