diff options
| author | ruki <[email protected]> | 2023-02-08 00:58:44 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-02-08 00:58:44 +0800 |
| commit | 9d8d0b6b038d831be197dea90271ae4bd1b7ea55 (patch) | |
| tree | a5fe5da4a4c2f2b432d6d9f148274183ec1f0410 | |
| parent | 1d61e87f3c869a7e33884fa0edc01c4110ddb72d (diff) | |
remove unused target args for config action
| -rw-r--r-- | xmake/actions/build/main.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/config/configheader.lua | 25 | ||||
| -rw-r--r-- | xmake/actions/config/main.lua | 34 | ||||
| -rw-r--r-- | xmake/actions/config/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/uninstall/main.lua | 2 |
5 files changed, 15 insertions, 52 deletions
diff --git a/xmake/actions/build/main.lua b/xmake/actions/build/main.lua index 8c5ede701..27b2419da 100644 --- a/xmake/actions/build/main.lua +++ b/xmake/actions/build/main.lua @@ -40,7 +40,7 @@ function _do_try_build(configfile, tool, trybuild, trybuild_detected, targetname if configfile and tool and (trybuild or utils.confirm({default = true, description = "${bright}" .. path.filename(configfile) .. "${clear} found, try building it or you can run `${bright}xmake f --trybuild=${clear}` to set buildsystem"})) then if not trybuild then - task.run("config", {target = targetname, trybuild = trybuild_detected}) + task.run("config", {trybuild = trybuild_detected}) end tool.build() return true @@ -136,7 +136,7 @@ function main() else targetname = option.get("target") end - task.run("config", {target = targetname}, {disable_dump = true}) + task.run("config", {}, {disable_dump = true}) -- enter project directory local oldir = os.cd(project.directory()) diff --git a/xmake/actions/config/configheader.lua b/xmake/actions/config/configheader.lua index f57e3efaf..995bf7a1b 100644 --- a/xmake/actions/config/configheader.lua +++ b/xmake/actions/config/configheader.lua @@ -76,36 +76,19 @@ function _make_for_target(target) _g.configfiles[configheader] = file end --- make the configure file for the given target and dependents -function _make_for_target_with_deps(targetname) - local target = project.target(targetname) - if target then - _make_for_target(target) - for _, dep in ipairs(target:get("deps")) do - _make_for_target_with_deps(dep) - end - end -end - -- the main entry function function main() - -- the target name - local targetname = option.get("target") - -- enter project directory local oldir = os.cd(project.directory()) -- make configure for the given target name _g.configfiles = {} _g.configpathes = {} - if targetname then - _make_for_target_with_deps(targetname) - else - -- make configure for all targets - for _, target in pairs(project.targets()) do - _make_for_target(target) - end + + -- make configure for all targets + for _, target in pairs(project.targets()) do + _make_for_target(target) end -- close and update files diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index fc14297e5..110c50c62 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -111,15 +111,9 @@ function _check_target(target) end -- check targets -function _check_targets(targetname) +function _check_targets() assert(not project.is_loaded(), "project and targets may have been loaded early!") - if not targetname then - for _, target in pairs(project.targets()) do - _check_target(target) - end - else - local target = project.target(targetname) - assert(target, "unknown target: %s", targetname) + for _, target in pairs(project.targets()) do _check_target(target) end end @@ -180,20 +174,11 @@ function _config_target(target) end -- config targets -function _config_targets(targetname) - if not targetname then - for _, target in ipairs(project.ordertargets()) do - if target:is_enabled() then - _config_target(target) - end - end - else - local target = project.target(targetname) - assert(target, "unknown target: %s", targetname) - for _, dep in ipairs(target:orderdeps()) do - _config_target(dep) +function _config_targets() + for _, target in ipairs(project.ordertargets()) do + if target:is_enabled() then + _config_target(target) end - _config_target(target) end end @@ -332,9 +317,6 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) options_changed = menuconf_show() end - -- the target name - local targetname = option.get("target") - -- load the project configuration -- -- priority: option > option_cache > global > option_default > config_check > project_check > config_cache @@ -473,7 +455,7 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) -- check target and ensure to load all targets, @note we must load targets after installing required packages, -- otherwise has_package() will be invalid. - _check_targets(targetname) + _check_targets() -- update the config files generate_configfiles({force = recheck}) @@ -490,7 +472,7 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) _load_package_rules_for_targets() -- config targets - _config_targets(targetname) + _config_targets() end -- dump config diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua index 50c22206e..861c0531d 100644 --- a/xmake/actions/config/xmake.lua +++ b/xmake/actions/config/xmake.lua @@ -227,8 +227,6 @@ task("config") " - xmake f --trybuild=autoconf --tryconfigs='--enable-shared=no'"}, {'o', "buildir", "kv", "build" , "Set build directory."}, {}, - {nil, "target", "v" , nil , "Configure for the given target." - , values = _target_values}, {category = "Project Configuration"}, _project_menu_options}} diff --git a/xmake/actions/uninstall/main.lua b/xmake/actions/uninstall/main.lua index 3132a3456..8dc0664e6 100644 --- a/xmake/actions/uninstall/main.lua +++ b/xmake/actions/uninstall/main.lua @@ -31,7 +31,7 @@ function main() -- config it first local targetname = option.get("target") - task.run("config", {target = targetname, require = "n", verbose = false}) + task.run("config", {require = "n", verbose = false}) -- attempt to uninstall directly try |
