@@ -27,9 +27,8 @@ class Vls.MesonProject : Project {
27
27
private string build_dir;
28
28
private bool configured_once;
29
29
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 = {};
33
32
34
33
/**
35
34
* Substitute special arguments like `@INPUT@` and `@OUTPUT@` as they
@@ -295,14 +294,14 @@ class Vls.MesonProject : Project {
295
294
debug (" %sconfiguring build dir %s ..." , configured_once ? " re" : " " , build_dir);
296
295
if (configured_once)
297
296
spawn_args + = " --reconfigure" ;
298
- foreach (var item in special_comp ) {
297
+ foreach (var item in meson_setup_args ) {
299
298
warning(" meson setup arg %s " , item);
300
299
spawn_args + = item;
301
300
}
302
301
Process . spawn_sync (
303
302
build_dir,
304
303
spawn_args,
305
- special_envp ,
304
+ null ,
306
305
SpawnFlags . SEARCH_PATH ,
307
306
null ,
308
307
out proc_stdout,
@@ -768,15 +767,15 @@ class Vls.MesonProject : Project {
768
767
if (requires_general_build) {
769
768
int proc_status;
770
769
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 ) {
773
772
warning(" meson compile arg %s " , item);
774
- spwan_args + = item;
773
+ spawn_args + = item;
775
774
}
776
775
777
776
Process . spawn_sync (build_dir,
778
- spwan_args ,
779
- special_envp ,
777
+ spawn_args ,
778
+ null ,
780
779
SpawnFlags . SEARCH_PATH ,
781
780
null ,
782
781
out proc_stdout,
@@ -795,17 +794,8 @@ class Vls.MesonProject : Project {
795
794
796
795
public MesonProject (string root_path , FileCache file_cache , Cancellable ? cancellable = null ) throws Error {
797
796
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
- }
807
797
// 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" ) ;
809
799
warning(" meson check option at %s " , check_path);
810
800
var settings_json = File . new_for_path(check_path);
811
801
if (settings_json. query_exists()) {
@@ -817,17 +807,18 @@ class Vls.MesonProject : Project {
817
807
var ret_options = root_object. get_array_member(" mesonbuild.configureOptions" );
818
808
foreach (var option in ret_options. get_elements()) {
819
809
var opt = option. get_string();
820
- special_args + = opt;
810
+ meson_setup_args + = opt;
821
811
}
822
812
var compile_options = root_object. get_array_member(" mesonbuild.compileOptions" );
823
813
foreach (var option in compile_options. get_elements()) {
824
814
var opt = option. get_string();
825
- special_comp + = opt;
815
+ meson_compile_args + = opt;
826
816
}
827
817
// 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" );
829
821
}
830
- this . build_dir = DirUtils . make_tmp (@" vls-meson-$(str_hash (root_path))-XXXXXX" );
831
822
reconfigure_if_stale (cancellable);
832
823
}
833
824
0 commit comments