Added workspace handling to build command

This commit is contained in:
Sven Heidemann 2021-04-07 18:36:08 +02:00
parent 703d20f43f
commit 7ef238b64d
4 changed files with 8 additions and 5 deletions

View File

@ -36,7 +36,7 @@
"BuildSettings": { "BuildSettings": {
"ProjectType": "library", "ProjectType": "library",
"SourcePath": "", "SourcePath": "",
"OutputPath": "dist", "OutputPath": "../../dist",
"Main": "", "Main": "",
"EntryPoint": "cpl", "EntryPoint": "cpl",
"IncludePackageData": true, "IncludePackageData": true,

View File

@ -25,7 +25,7 @@
"BuildSettings": { "BuildSettings": {
"ProjectType": "console", "ProjectType": "console",
"SourcePath": "", "SourcePath": "",
"OutputPath": "dist", "OutputPath": "../../dist",
"Main": "main", "Main": "main",
"EntryPoint": "cpl", "EntryPoint": "cpl",
"IncludePackageData": true, "IncludePackageData": true,

View File

@ -148,7 +148,7 @@ class PublisherService(PublisherABC):
elif os.path.isfile(rel_path): elif os.path.isfile(rel_path):
self._included_files.append(rel_path) self._included_files.append(rel_path)
for r, d, f in os.walk(self._build_settings.source_path): for r, d, f in os.walk(self._source_path):
for file in f: for file in f:
relative_path = os.path.relpath(r) relative_path = os.path.relpath(r)
file_path = os.path.join(relative_path, os.path.relpath(file)) file_path = os.path.join(relative_path, os.path.relpath(file))
@ -201,6 +201,7 @@ class PublisherService(PublisherABC):
if len(module_py_lines) > 0: if len(module_py_lines) > 0:
imports = '\n'.join(module_py_lines) imports = '\n'.join(module_py_lines)
Console.write_line(self._project_settings.version.to_str())
template_content = stringTemplate(InitTemplate.get_init_py()).substitute( template_content = stringTemplate(InitTemplate.get_init_py()).substitute(
Name=self._project_settings.name, Name=self._project_settings.name,
Description=self._project_settings.description, Description=self._project_settings.description,
@ -385,7 +386,7 @@ class PublisherService(PublisherABC):
3. Copies all included source files to dist_path/build 3. Copies all included source files to dist_path/build
:return: :return:
""" """
self._output_path = os.path.join(self._output_path, 'build') self._output_path = os.path.abspath(os.path.join(self._output_path, self._project_settings.name, 'build'))
Console.spinner('Reading source files:', self._read_sources, text_foreground_color=ForegroundColorEnum.green, Console.spinner('Reading source files:', self._read_sources, text_foreground_color=ForegroundColorEnum.green,
spinner_foreground_color=ForegroundColorEnum.blue) spinner_foreground_color=ForegroundColorEnum.blue)

View File

@ -40,7 +40,9 @@ class Startup(StartupABC):
self._configuration.add_environment_variables('CPL_') self._configuration.add_environment_variables('CPL_')
self._configuration.add_json_file('appsettings.json', path=self._env.runtime_directory, self._configuration.add_json_file('appsettings.json', path=self._env.runtime_directory,
optional=False, output=False) optional=False, output=False)
self._configuration.add_console_argument(ConsoleArgument('', 'build', ['b', 'B'], '')) self._configuration.add_console_argument(
ConsoleArgument('', 'build', ['b', 'B'], ' ', is_value_token_optional=True)
)
self._configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', console_arguments=[ self._configuration.add_console_argument(ConsoleArgument('', 'generate', ['g', 'G'], '', console_arguments=[
ConsoleArgument('', 'abc', ['a', 'A'], ' '), ConsoleArgument('', 'abc', ['a', 'A'], ' '),
ConsoleArgument('', 'class', ['c', 'C'], ' '), ConsoleArgument('', 'class', ['c', 'C'], ' '),