Improved workspace handling in publish and build command

This commit is contained in:
Sven Heidemann 2021-04-08 20:28:19 +02:00
parent 5f668e17c9
commit 34ed7123d1
2 changed files with 7 additions and 3 deletions

View File

@ -22,8 +22,8 @@ class ApplicationEnvironment(ApplicationEnvironmentABC):
self._start_time: datetime = datetime.now() self._start_time: datetime = datetime.now()
self._end_time: datetime = datetime.now() self._end_time: datetime = datetime.now()
self._working_directory = os.path.abspath('./')
self._runtime_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) self._runtime_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
self._working_directory = os.path.abspath('./')
@property @property
def environment_name(self) -> str: def environment_name(self) -> str:
@ -82,11 +82,13 @@ class ApplicationEnvironment(ApplicationEnvironmentABC):
self._runtime_directory = runtime_directory self._runtime_directory = runtime_directory
return return
self._runtime_directory = pathlib.Path().absolute() self._runtime_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def set_working_directory(self, working_directory: str): def set_working_directory(self, working_directory: str):
if working_directory != '': if working_directory != '':
self._working_directory = working_directory self._working_directory = working_directory
os.chdir(self._working_directory)
return return
self._working_directory = pathlib.Path().absolute() self._working_directory = os.path.abspath('./')
os.chdir(self._working_directory)

View File

@ -408,6 +408,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._env.set_working_directory(os.path.join(self._env.working_directory, '../'))
self.exclude(f'*/{self._config.get_configuration("ProjectName")}.json') self.exclude(f'*/{self._config.get_configuration("ProjectName")}.json')
self._output_path = os.path.abspath(os.path.join(self._output_path, self._project_settings.name, 'build')) self._output_path = os.path.abspath(os.path.join(self._output_path, self._project_settings.name, 'build'))
@ -429,6 +430,7 @@ class PublisherService(PublisherABC):
4. Remove all included source from dist_path/publish 4. Remove all included source from dist_path/publish
:return: :return:
""" """
self._env.set_working_directory(os.path.join(self._env.working_directory, '../'))
self.exclude(f'*/{self._config.get_configuration("ProjectName")}.json') self.exclude(f'*/{self._config.get_configuration("ProjectName")}.json')
self._output_path = os.path.abspath(os.path.join(self._output_path, self._project_settings.name, 'publish')) self._output_path = os.path.abspath(os.path.join(self._output_path, self._project_settings.name, 'publish'))