Building scripts from build.config, frozen messages and typo fixes
This commit is contained in:
@@ -32,7 +32,9 @@ class BuildConfig(MakeDataConfig):
|
|||||||
def iterate_scripts(self) -> Iterable[MakeScriptData]:
|
def iterate_scripts(self) -> Iterable[MakeScriptData]:
|
||||||
if self.get_value("defaultConfig.buildType") == "release":
|
if self.get_value("defaultConfig.buildType") == "release":
|
||||||
# XXX: Perhaps we should do something, but scripts may no longer exist.
|
# XXX: Perhaps we should do something, but scripts may no longer exist.
|
||||||
# It is important to leave a `compile`` field to load them.
|
# It is important to leave a `compile` field to load them.
|
||||||
|
from .shell import frozen
|
||||||
|
frozen("Project is set to release mode, building scripts will be skipped.")
|
||||||
return
|
return
|
||||||
|
|
||||||
library_path = self.get_value("defaultConfig.libraryDir")
|
library_path = self.get_value("defaultConfig.libraryDir")
|
||||||
@@ -56,7 +58,7 @@ class BuildConfig(MakeDataConfig):
|
|||||||
|
|
||||||
def obtain_script_data(self, source: Config) -> MakeScriptData:
|
def obtain_script_data(self, source: Config) -> MakeScriptData:
|
||||||
relative_path = source.get_value_unsafe("path")
|
relative_path = source.get_value_unsafe("path")
|
||||||
type = source.get_value_unsafe("type")
|
type = source.get_value_unsafe("sourceType")
|
||||||
if not type in VALID_SOURCE_TYPES:
|
if not type in VALID_SOURCE_TYPES:
|
||||||
raise ValueError(f"Script {relative_path!r} has invalid type, it should be one of: {', '.join(VALID_SOURCE_TYPES)}!")
|
raise ValueError(f"Script {relative_path!r} has invalid type, it should be one of: {', '.join(VALID_SOURCE_TYPES)}!")
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ def get_language_directories(compile_type: str, language_config: Config, propert
|
|||||||
if not any(directories):
|
if not any(directories):
|
||||||
# Obtain directories from deprecated `compile` property.
|
# Obtain directories from deprecated `compile` property.
|
||||||
directories = list(filter(
|
directories = list(filter(
|
||||||
lambda source: isinstance(source, Config) and compile_type == source.get_value("type"),
|
lambda source: isinstance(source, Config) and compile_type == source.get_value("type", lambda: source.get_value("sourceType")),
|
||||||
make_config.obtain_list("compile")
|
make_config.obtain_list("compile")
|
||||||
))
|
))
|
||||||
configurables = dict()
|
configurables = dict()
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ def build_resources() -> int:
|
|||||||
GLOBALS.MOD_STRUCTURE.cleanup_build_target("gui")
|
GLOBALS.MOD_STRUCTURE.cleanup_build_target("gui")
|
||||||
GLOBALS.MOD_STRUCTURE.cleanup_build_target("minecraft_resource_pack")
|
GLOBALS.MOD_STRUCTURE.cleanup_build_target("minecraft_resource_pack")
|
||||||
GLOBALS.MOD_STRUCTURE.cleanup_build_target("minecraft_behavior_pack")
|
GLOBALS.MOD_STRUCTURE.cleanup_build_target("minecraft_behavior_pack")
|
||||||
overall_result = 0
|
|
||||||
|
|
||||||
|
overall_result = 0
|
||||||
for resource in GLOBALS.MAKE_CONFIG.iterate_resources():
|
for resource in GLOBALS.MAKE_CONFIG.iterate_resources():
|
||||||
resource_files = expand_paths(GLOBALS.MAKE_CONFIG.get_relative_path(resource.relative_path))
|
resource_files = expand_paths(GLOBALS.MAKE_CONFIG.get_relative_path(resource.relative_path))
|
||||||
if len(resource_files) == 0:
|
if len(resource_files) == 0:
|
||||||
@@ -91,7 +91,6 @@ def build_pack_graphics() -> int:
|
|||||||
|
|
||||||
def build_additional_resources() -> int:
|
def build_additional_resources() -> int:
|
||||||
overall_result = 0
|
overall_result = 0
|
||||||
|
|
||||||
for asset in GLOBALS.MAKE_CONFIG.iterate_assets():
|
for asset in GLOBALS.MAKE_CONFIG.iterate_assets():
|
||||||
additional_files = expand_paths(GLOBALS.MAKE_CONFIG.get_relative_path(asset.relative_path))
|
additional_files = expand_paths(GLOBALS.MAKE_CONFIG.get_relative_path(asset.relative_path))
|
||||||
if len(additional_files) == 0:
|
if len(additional_files) == 0:
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ def copy_build_targets(composite: List[Tuple[str, str, str]], includes: List[Tup
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if not GLOBALS.BUILD_STORAGE.is_path_changed(temporary_script):
|
if not GLOBALS.BUILD_STORAGE.is_path_changed(temporary_script):
|
||||||
failure(f"Build target {basename(temporary_script)!r} is not changed.")
|
frozen(f"Build target {basename(temporary_script)!r} is not changed.")
|
||||||
|
|
||||||
GLOBALS.BUILD_STORAGE.save()
|
GLOBALS.BUILD_STORAGE.save()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user