Removed useless watching build mode
This commit is contained in:
@@ -70,18 +70,6 @@ def task_build_scripts() -> int:
|
|||||||
from .script_build import build_all_scripts
|
from .script_build import build_all_scripts
|
||||||
return build_all_scripts()
|
return build_all_scripts()
|
||||||
|
|
||||||
@task(
|
|
||||||
"watchScripts",
|
|
||||||
locks=["script", "cleanup", "push"],
|
|
||||||
description="Recompiles changed scripts instantly using tsc, interruption will end watching."
|
|
||||||
)
|
|
||||||
def task_watch_scripts() -> int:
|
|
||||||
if not GLOBALS.MAKE_CONFIG.supports_scripts:
|
|
||||||
failure("You cannot have scripts to watch because your project does not support them.")
|
|
||||||
return 1
|
|
||||||
from .script_build import build_all_scripts
|
|
||||||
return build_all_scripts(watch=True)
|
|
||||||
|
|
||||||
@task(
|
@task(
|
||||||
"updateIncludes",
|
"updateIncludes",
|
||||||
description="Overrides the contents of 'tsconfig.json' based on script files."
|
description="Overrides the contents of 'tsconfig.json' based on script files."
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from .utils import (RuntimeCodeError, copy_file, ensure_not_whitespace,
|
|||||||
walk_all_files)
|
walk_all_files)
|
||||||
|
|
||||||
|
|
||||||
def build_all_scripts(watch: bool = False) -> int:
|
def build_all_scripts() -> int:
|
||||||
GLOBALS.PROJECT_STRUCTURE.cleanup_target("scripts")
|
GLOBALS.PROJECT_STRUCTURE.cleanup_target("scripts")
|
||||||
GLOBALS.PROJECT_STRUCTURE.cleanup_target("libraries")
|
GLOBALS.PROJECT_STRUCTURE.cleanup_target("libraries")
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ def build_all_scripts(watch: bool = False) -> int:
|
|||||||
if not isdir(join(get_config_directory(), "declarations")):
|
if not isdir(join(get_config_directory(), "declarations")):
|
||||||
attention("Not found 'declarations', in most cases build will be failed, please install it via tasks.")
|
attention("Not found 'declarations', in most cases build will be failed, please install it via tasks.")
|
||||||
|
|
||||||
return build_composite_project() if not watch else watch_composite_project()
|
return build_composite_project()
|
||||||
|
|
||||||
def rebuild_build_target(source: MakeScriptData, target_path: str) -> str:
|
def rebuild_build_target(source: MakeScriptData, target_path: str) -> str:
|
||||||
declare: MutableMapping[str, Any] = {
|
declare: MutableMapping[str, Any] = {
|
||||||
@@ -218,30 +218,3 @@ def build_composite_project() -> int:
|
|||||||
copy_build_targets(computed_composite, computed_includes)
|
copy_build_targets(computed_composite, computed_includes)
|
||||||
GLOBALS.PROJECT_STRUCTURE.generate_config()
|
GLOBALS.PROJECT_STRUCTURE.generate_config()
|
||||||
return overall_result
|
return overall_result
|
||||||
|
|
||||||
def watch_composite_project() -> int:
|
|
||||||
if not request_typescript():
|
|
||||||
failure("Watching is not supported for legacy JavaScript!")
|
|
||||||
return 1
|
|
||||||
overall_result = 0
|
|
||||||
|
|
||||||
# Recomputing existing changes before watching, changes here doesn't make sence
|
|
||||||
# since it will be recomputed after watching interruption
|
|
||||||
compute_and_capture_changed_scripts()
|
|
||||||
GLOBALS.TSC_COMPOSITE.flush()
|
|
||||||
GLOBALS.TSC_COMPOSITE.watch()
|
|
||||||
GLOBALS.PROJECT_STRUCTURE.cleanup_target("scripts")
|
|
||||||
GLOBALS.PROJECT_STRUCTURE.cleanup_target("libraries")
|
|
||||||
GLOBALS.TSC_COMPOSITE.reset()
|
|
||||||
|
|
||||||
composite, computed_composite, includes, computed_includes = compute_and_capture_changed_scripts()
|
|
||||||
|
|
||||||
for included in includes:
|
|
||||||
if not GLOBALS.MAKE_CONFIG.get_value("project.useReferences", False) or included[2] == "javascript":
|
|
||||||
overall_result += included[0].build(included[1], included[2])
|
|
||||||
if overall_result != 0:
|
|
||||||
return overall_result
|
|
||||||
|
|
||||||
copy_build_targets(computed_composite, computed_includes)
|
|
||||||
GLOBALS.PROJECT_STRUCTURE.generate_config()
|
|
||||||
return overall_result
|
|
||||||
|
|||||||
@@ -270,18 +270,3 @@ class CompositeProject:
|
|||||||
*GLOBALS.MAKE_CONFIG.get_value("development.tsc", list()),
|
*GLOBALS.MAKE_CONFIG.get_value("development.tsc", list()),
|
||||||
*args
|
*args
|
||||||
], shell=platform.system() == "Windows")
|
], shell=platform.system() == "Windows")
|
||||||
|
|
||||||
def watch(self, *args: str) -> int:
|
|
||||||
from .script_setup import request_typescript
|
|
||||||
tsc = request_typescript()
|
|
||||||
if not tsc:
|
|
||||||
raise RuntimeError("A tsc is required to watch project, make sure it is present before calling this function.")
|
|
||||||
try:
|
|
||||||
return subprocess.call([
|
|
||||||
tsc,
|
|
||||||
"--watch",
|
|
||||||
*GLOBALS.MAKE_CONFIG.get_value("development.watch", list()),
|
|
||||||
*args
|
|
||||||
], cwd=dirname(self.get_tsconfig()).replace("/", os.path.sep), shell=platform.system() == "Windows")
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
return 0
|
|
||||||
|
|||||||
Reference in New Issue
Block a user