Skip to content

Commit 7b1c511

Browse files
author
nor
committed
update code
1 parent 3eefb7d commit 7b1c511

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

Diff for: src/projects/mesonproject.vala

+15-24
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ class Vls.MesonProject : Project {
2727
private string build_dir;
2828
private bool configured_once;
2929
private bool requires_general_build;
30-
private string[] special_args = {};
31-
private string[] special_comp = {};
32-
private string[] special_envp = {};
30+
private string[] meson_setup_args = {};
31+
private string[] meson_compile_args = {};
3332

3433
/**
3534
* Substitute special arguments like `@INPUT@` and `@OUTPUT@` as they
@@ -295,14 +294,14 @@ class Vls.MesonProject : Project {
295294
debug ("%sconfiguring build dir %s ...", configured_once ? "re" : "", build_dir);
296295
if (configured_once)
297296
spawn_args += "--reconfigure";
298-
foreach(var item in special_comp) {
297+
foreach(var item in meson_setup_args) {
299298
warning("meson setup arg %s", item);
300299
spawn_args += item;
301300
}
302301
Process.spawn_sync (
303302
build_dir,
304303
spawn_args,
305-
special_envp,
304+
null,
306305
SpawnFlags.SEARCH_PATH,
307306
null,
308307
out proc_stdout,
@@ -768,15 +767,15 @@ class Vls.MesonProject : Project {
768767
if (requires_general_build) {
769768
int proc_status;
770769
string proc_stdout, proc_stderr;
771-
string[] spwan_args = {"meson", "compile"};
772-
foreach(var item in special_comp) {
770+
string[] spawn_args = {"meson", "compile"};
771+
foreach(var item in meson_compile_args) {
773772
warning("meson compile arg %s", item);
774-
spwan_args += item;
773+
spawn_args += item;
775774
}
776775

777776
Process.spawn_sync (build_dir,
778-
spwan_args,
779-
special_envp,
777+
spawn_args,
778+
null,
780779
SpawnFlags.SEARCH_PATH,
781780
null,
782781
out proc_stdout,
@@ -795,17 +794,8 @@ class Vls.MesonProject : Project {
795794

796795
public MesonProject (string root_path, FileCache file_cache, Cancellable? cancellable = null) throws Error {
797796
base (root_path, file_cache);
798-
// read system envionment;
799-
string[] system_env_key = Environment.list_variables();
800-
if (system_env_key != null) {
801-
foreach(var item in system_env_key) {
802-
var sys_env = item+"="+Environment.get_variable(item);
803-
debug("system env is %s", sys_env);
804-
special_envp += sys_env;
805-
}
806-
}
807797
// get config from settings.json
808-
var check_path = root_path + "/.vscode/settings.json";
798+
var check_path = Path.build_filename(root_path, "/.vscode/settings.json");
809799
warning("meson check option at %s", check_path);
810800
var settings_json = File.new_for_path(check_path);
811801
if (settings_json.query_exists()) {
@@ -817,17 +807,18 @@ class Vls.MesonProject : Project {
817807
var ret_options = root_object.get_array_member("mesonbuild.configureOptions");
818808
foreach(var option in ret_options.get_elements()) {
819809
var opt = option.get_string();
820-
special_args += opt;
810+
meson_setup_args += opt;
821811
}
822812
var compile_options = root_object.get_array_member("mesonbuild.compileOptions");
823813
foreach(var option in compile_options.get_elements()) {
824814
var opt = option.get_string();
825-
special_comp += opt;
815+
meson_compile_args += opt;
826816
}
827817
// maybe can reuse mesonbuild buildDir
828-
// this.build_dir = root_object.get_string_member_with_default("mesonbuild.buildFolder", root_path +"/builddir");
818+
this.build_dir = root_object.get_string_member_with_default("mesonbuild.buildFolder", root_path +"/builddir");
819+
}else{
820+
this.build_dir = DirUtils.make_tmp (@"vls-meson-$(str_hash (root_path))-XXXXXX");
829821
}
830-
this.build_dir = DirUtils.make_tmp (@"vls-meson-$(str_hash (root_path))-XXXXXX");
831822
reconfigure_if_stale (cancellable);
832823
}
833824

0 commit comments

Comments
 (0)