Commit 77053aa3 authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl

in project files for modules in a directory write the directory once, instead...

in project files for modules in a directory write the directory once, instead of per module (to reduce problems caused by version control systems)
parent 688fd7d4
Pipeline #20351 passed with stage
in 3 minutes and 45 seconds
...@@ -16,7 +16,7 @@ CodeGenOptionsTable :: OptionsTable CodeGenOptions ...@@ -16,7 +16,7 @@ CodeGenOptionsTable :: OptionsTable CodeGenOptions
LinkOptionsTable :: OptionsTable LinkOptions LinkOptionsTable :: OptionsTable LinkOptions
ApplicationOptionsTable :: OptionsTable ApplicationOptions ApplicationOptionsTable :: OptionsTable ApplicationOptions
ProjectFileVersion :== "1.4" ProjectFileVersion :== "1.5"
:: ProjectGlobalOptions = :: ProjectGlobalOptions =
{ pg_codegen :: CodeGenOptions { pg_codegen :: CodeGenOptions
......
...@@ -2,13 +2,13 @@ implementation module PmFiles ...@@ -2,13 +2,13 @@ implementation module PmFiles
// File I/O routines for the project. // File I/O routines for the project.
import StdArray, StdFunc, StdInt, StdChar, StdBool, StdStrictLists import StdArray, StdFunc, StdInt, StdChar, StdBool, StdStrictLists, StdOverloadedList
import UtilNewlinesFile, UtilOptions, UtilStrictLists import UtilNewlinesFile, UtilOptions
import PmProject import PmProject
import UtilDate import UtilDate
from PmPath import convert_path_separators,convert_exec_path_separators_and_extension from PmPath import convert_path_separators,convert_exec_path_separators_and_extension
ProjectFileVersion :== "1.4" ProjectFileVersion :== "1.5"
:: ProjectGlobalOptions = :: ProjectGlobalOptions =
{ pg_codegen :: CodeGenOptions { pg_codegen :: CodeGenOptions
...@@ -38,12 +38,12 @@ ProjectFileVersion :== "1.4" ...@@ -38,12 +38,12 @@ ProjectFileVersion :== "1.4"
EmptyDynamicInfo :: ProjectDynamicInfo EmptyDynamicInfo :: ProjectDynamicInfo
EmptyDynamicInfo = EmptyDynamicInfo =
{ dyn_syms = Nil { dyn_syms = [!!]
, dyn_mods = Nil , dyn_mods = [!!]
, dyn_objs = Nil , dyn_objs = [!!]
, dyn_slibs = Nil , dyn_slibs = [!!]
, dyn_dlibs = Nil , dyn_dlibs = [!!]
, dyn_paths = Nil , dyn_paths = [!!]
} }
:: UndefSymbol = :: UndefSymbol =
...@@ -74,7 +74,6 @@ code_gen_option = GroupedOption "CodeGen" CodeGenOptionsTable (\a->a.pg_codeg ...@@ -74,7 +74,6 @@ code_gen_option = GroupedOption "CodeGen" CodeGenOptionsTable (\a->a.pg_codeg
application_option = GroupedOption "Application" ApplicationOptionsTable (\a->a.pg_application) (\v a->{a & pg_application=v}) application_option = GroupedOption "Application" ApplicationOptionsTable (\a->a.pg_application) (\v a->{a & pg_application=v})
link_option = GroupedOption "Link" LinkOptionsTable (\a->a.pg_link) (\v a->{a & pg_link=v}) link_option = GroupedOption "Link" LinkOptionsTable (\a->a.pg_link) (\v a->{a & pg_link=v})
paths_option = ListOption "Paths" PathName "" (\a->a.pg_projectPaths) (\v a->{a & pg_projectPaths=v}) paths_option = ListOption "Paths" PathName "" (\a->a.pg_projectPaths) (\v a->{a & pg_projectPaths=v})
otherpaths_option = ListOption "OtherPaths" PathName "" (\a->module_paths_not_in_project a.pg_projectPaths a.pg_otherModules) (\v a->a)
static_option = GroupedOption "Static" StaticLibsInfoTable (\a->a.pg_staticLibInfo) (\v a->{a & pg_staticLibInfo=v}) static_option = GroupedOption "Static" StaticLibsInfoTable (\a->a.pg_staticLibInfo) (\v a->{a & pg_staticLibInfo=v})
precompile_option = SimpleOption "Precompile" (\a->unwrap a.pg_precompile)(\v a->{a & pg_precompile = wrap v}) precompile_option = SimpleOption "Precompile" (\a->unwrap a.pg_precompile)(\v a->{a & pg_precompile = wrap v})
postlink_option = SimpleOption "Postlink" (\a->unwrap a.pg_postlink) (\v a->{a & pg_postlink = wrap v}) postlink_option = SimpleOption "Postlink" (\a->unwrap a.pg_postlink) (\v a->{a & pg_postlink = wrap v})
...@@ -110,7 +109,6 @@ ProjectGlobalOptionsTable = ...@@ -110,7 +109,6 @@ ProjectGlobalOptionsTable =
, application_option , application_option
, link_option , link_option
, paths_option , paths_option
, otherpaths_option
, static_option , static_option
, precompile_option , precompile_option
, postlink_option , postlink_option
...@@ -218,13 +216,61 @@ ProjectTable :: OptionsTable ProjectGlobalOptions ...@@ -218,13 +216,61 @@ ProjectTable :: OptionsTable ProjectGlobalOptions
ProjectTable ProjectTable
# main_module_option = GroupedOption "MainModule" ModInfoAndNameTable (\a->a.pg_mainModuleInfo) (\v a->{a & pg_mainModuleInfo=v}) # main_module_option = GroupedOption "MainModule" ModInfoAndNameTable (\a->a.pg_mainModuleInfo) (\v a->{a & pg_mainModuleInfo=v})
# other_modules_option = ListOption "OtherModules" ModInfoAndNameEntry {info=EmptyModInfo,name=""} (\a->a.pg_otherModules) (\v a->{a & pg_otherModules=v}) # other_modules_option = ListOption "OtherModules" ModInfoAndNameEntry {info=EmptyModInfo,name=""} (\a->a.pg_otherModules) (\v a->{a & pg_otherModules=v})
= make_project_table main_module_option other_modules_option = make_project_table_for_reading main_module_option other_modules_option
project_table :: OptionsTable ProjectGlobalOptions project_table :: OptionsTable ProjectGlobalOptions
project_table project_table
# main_module_option = GroupedOption "MainModule" prj_mod_info_and_name_table (\a->a.pg_mainModuleInfo) (\v a->{a & pg_mainModuleInfo=v}) # main_module_option = GroupedOption "MainModule" prj_mod_info_and_name_table (\a->a.pg_mainModuleInfo) (\v a->{a & pg_mainModuleInfo=v})
# other_modules_option = ListOption "OtherModules" prj_mod_info_and_name_entry {info=EmptyModInfo,name=""} (\a->a.pg_otherModules) (\v a->{a & pg_otherModules=v}) = make_project_table_for_writing main_module_option
= make_project_table main_module_option other_modules_option
project_modules_option
= ListOption "ProjectModules" prj_dir_list_mods_entry ("",[!!]) get_other_modules set_other_modules
where
get_other_modules :: ProjectGlobalOptions -> [!(String,[!ModInfoAndName!])!]
get_other_modules a = group_modules_by_dir a.pg_otherModules
group_modules_by_dir :: [!ModInfoAndName!] -> [!(String,[!ModInfoAndName!])!]
group_modules_by_dir [!mod=:{info={dir}}:mods!]
# (group_mods,mods) = collect_modules_in_dir dir mods
= [!(dir,[!mod:group_mods!]):group_modules_by_dir mods!]
group_modules_by_dir [!!]
= [!!]
collect_modules_in_dir :: !String ![!ModInfoAndName!] -> (![!ModInfoAndName!],![!ModInfoAndName!])
collect_modules_in_dir dir [!mod:mods!]
| mod.info.dir==dir
# (group_mods,mods) = collect_modules_in_dir dir mods
= ([!mod:group_mods!],mods)
collect_modules_in_dir dir mods
= ([!!],mods)
set_other_modules :: [!(String,[!ModInfoAndName!])!] ProjectGlobalOptions -> ProjectGlobalOptions
set_other_modules dir_mods a = {a & pg_otherModules=dir_mods_to_mods dir_mods}
where
dir_mods_to_mods :: [!(String,[!ModInfoAndName!])!] -> [!ModInfoAndName!]
dir_mods_to_mods [!(dir,mods):l!] = [!{mod & info.dir=dir}\\mod<|-mods!]++|dir_mods_to_mods l
dir_mods_to_mods [!!] = [!!]
prj_dir_list_mods_entry :: OptionsTableEntry (String,[!ModInfoAndName!])
prj_dir_list_mods_entry
= GroupedOption "DirModules" {prj_group_dir_name_entry,prj_list_mod_info_and_name_entry} id const
prj_group_dir_name_entry :: OptionsTableEntry (String,[!ModInfoAndName!])
prj_group_dir_name_entry
= SimpleWithStringConversionsOption convert_path_separators convert_path_to_project_file_path "Dir"
(\(dir,_)->dir) (\dir (_,mods)->(dir,mods))
prj_list_mod_info_and_name_entry :: OptionsTableEntry (String,[!ModInfoAndName!])
prj_list_mod_info_and_name_entry
= ListOption "Modules" prj_mod_info_and_name_entry {info=EmptyModInfo,name=""}
(\(_,mods)->mods) (\mods (dir,_)->(dir,mods))
prj_mod_info_and_name_entry :: OptionsTableEntry ModInfoAndName
prj_mod_info_and_name_entry = GroupedOption "Module" prj_mod_info_and_name_without_dir_table id const
prj_mod_info_and_name_without_dir_table :: OptionsTable ModInfoAndName
prj_mod_info_and_name_without_dir_table
= { name_option, compiler_option, needed_obj_files_option, needed_libraries_option }
edit_options_table :: OptionsTable ProjectGlobalOptions edit_options_table :: OptionsTable ProjectGlobalOptions
edit_options_table edit_options_table
...@@ -232,12 +278,22 @@ edit_options_table ...@@ -232,12 +278,22 @@ edit_options_table
# other_modules_option = ListOption "OtherModules" prp_mod_info_and_name_entry {info=EmptyModInfo,name=""} (\a->a.pg_otherModules) (\v a->{a & pg_otherModules=v}) # other_modules_option = ListOption "OtherModules" prp_mod_info_and_name_entry {info=EmptyModInfo,name=""} (\a->a.pg_otherModules) (\v a->{a & pg_otherModules=v})
= { main_module_option, other_modules_option } = { main_module_option, other_modules_option }
make_project_table :: !(OptionsTableEntry ProjectGlobalOptions) !(OptionsTableEntry ProjectGlobalOptions) -> OptionsTable ProjectGlobalOptions make_project_table_for_reading :: !(OptionsTableEntry ProjectGlobalOptions) !(OptionsTableEntry ProjectGlobalOptions) -> OptionsTable ProjectGlobalOptions
make_project_table main_module_option other_modules_option make_project_table_for_reading main_module_option other_modules_option
= // +++ order is important here
{ GroupedOption "Global" ProjectGlobalOptionsTable id const
, main_module_option
, project_modules_option
, other_modules_option // old projects have OtherModules instead of ProjectModules
, GroupedOption "Dynamic" DynamicInfoTable (\a->a.pg_dynamic) (\v a->{a & pg_dynamic=v})
}
make_project_table_for_writing :: !(OptionsTableEntry ProjectGlobalOptions) -> OptionsTable ProjectGlobalOptions
make_project_table_for_writing main_module_option
= // +++ order is important here = // +++ order is important here
{ GroupedOption "Global" ProjectGlobalOptionsTable id const { GroupedOption "Global" ProjectGlobalOptionsTable id const
, main_module_option , main_module_option
, other_modules_option , project_modules_option
, GroupedOption "Dynamic" DynamicInfoTable (\a->a.pg_dynamic) (\v a->{a & pg_dynamic=v}) , GroupedOption "Dynamic" DynamicInfoTable (\a->a.pg_dynamic) (\v a->{a & pg_dynamic=v})
} }
...@@ -253,7 +309,7 @@ EmptyModInfo ...@@ -253,7 +309,7 @@ EmptyModInfo
= { dir = EmptyPathname, = { dir = EmptyPathname,
compilerOptions = DefaultCompilerOptions, compilerOptions = DefaultCompilerOptions,
mod_edit_options = mod_edit_options, mod_edit_options = mod_edit_options,
abcLinkInfo = {linkObjFileNames = Nil, linkLibraryNames = Nil} } abcLinkInfo = {linkObjFileNames = [!!], linkLibraryNames = [!!]} }
where where
DefaultEditOptions :: EditOptions; DefaultEditOptions :: EditOptions;
DefaultEditOptions = DefaultEditOptions =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment