From 65826828ba20c0883d0973ce6ab8ed4721126a7b Mon Sep 17 00:00:00 2001 From: Martin Blazik Date: Mon, 10 Jan 2022 15:36:16 +0100 Subject: [PATCH] Tuning gws script Work correctly with modules --- bin/gws | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/bin/gws b/bin/gws index 0a167b7..e333111 100755 --- a/bin/gws +++ b/bin/gws @@ -16,43 +16,44 @@ StrIter = Iterable[str] GwCommand = 'gw' DEBUG = False +actions = ( + 'clean', + 'build', + 'compileTestKotlin', + # todo only if there no -x prefix + 'test', + 'componentTest', + 'shadowJar' +) + shortcuts = { 'c': ['clean'], 'b': ['build'], 't': ['test'], 'bt': ['compileTestKotlin'], 'ct': ['componentTest'], + 'tct': ['test', 'componentTest'], 'cb': ['clean', 'build'], 'cbx': ['clean', 'build', '-x', 'test'], 'cbt': ['clean', 'build', 'compileTestKotlin', '-x', 'test'], - 'ctt': ['cleanComponentTest'], 'cct': ['cleanComponentTest'], 'rt': ['cleanTest', 'test'], 'rct': ['cleanComponentTest', 'componentTest'], 'nd': ['-x', 'detekt'], '-nd': ['-x', 'detekt'], 'xt': ['-x', 'test'], + '-nt': ['-x', 'test'], 'br': ['bootRun'], 'rb': ['bootRun'], 'jar': ['shadowJar'], - '-nt': ['-x', 'test'], '-nc': ['--no-build-cache'], '-rr': ['--rerun-tasks'], - '-wl': ['--write-locks'], '-rt': ['--rerun-tasks'], + '-wl': ['--write-locks'], '-ef': ['-Penvironment=free'], '-el': ['-Penvironment=licensed'], '-lic': ['-Penvironment=licensed'] -} -actions = [ - 'clean', - 'build', - 'compileTestKotlin', - 'test', - 'componentTest', - 'shadowJar' -] - +} help_text = """\ Support functionality for gw application @@ -111,12 +112,12 @@ def split_on_condition(lst: Sequence, condtion): def pair_module_with_action(args: Args) -> List[str]: - modules, no_module = split_on_condition(args, is_module) + modules, rest_args = split_on_condition(args, is_module) log("modules", modules) - log("args", no_module) + log("args", rest_args) if modules: _args = [] - for arg in no_module: + for arg in rest_args: if arg in actions: for module in modules: _args.append(module + ':' + arg)