Improved set-version to ignore skipped deps
This commit is contained in:
parent
ff5f9b833d
commit
beadbf8e91
@ -70,13 +70,15 @@ class Application(ApplicationABC):
|
|||||||
diff_paths.append(os.path.basename(os.path.dirname(file)))
|
diff_paths.append(os.path.basename(os.path.dirname(file)))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
skipped = []
|
||||||
for project in self._workspace.projects:
|
for project in self._workspace.projects:
|
||||||
if project not in diff_paths and String.convert_to_snake_case(project) not in diff_paths and not force:
|
if project not in diff_paths and String.convert_to_snake_case(project) not in diff_paths and not force:
|
||||||
Console.write_line(f'Skipping {project} due to missing changes')
|
Console.write_line(f'Skipping {project} due to missing changes')
|
||||||
|
skipped.append(project)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
Console.write_line(f'Set dependencies {self._version_pipe.transform(version)} for {project}')
|
Console.write_line(f'Set dependencies {self._version_pipe.transform(version)} for {project}')
|
||||||
self._version_setter.set_dependencies(self._workspace.projects[project], version)
|
self._version_setter.set_dependencies(self._workspace.projects[project], version, skipped=skipped)
|
||||||
if not project.startswith('cpl') and not project.startswith('unittest'):
|
if not project.startswith('cpl') and not project.startswith('unittest'):
|
||||||
Console.write_line(f'Skipping {project}')
|
Console.write_line(f'Skipping {project}')
|
||||||
continue
|
continue
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
from string import ascii_letters
|
||||||
|
|
||||||
|
from cpl_core.utils import String
|
||||||
|
|
||||||
from cpl_core.console import Console
|
from cpl_core.console import Console
|
||||||
|
|
||||||
@ -30,7 +33,7 @@ class VersionSetterService:
|
|||||||
project_json['ProjectSettings']['Version'] = version
|
project_json['ProjectSettings']['Version'] = version
|
||||||
self._write_file(file, project_json)
|
self._write_file(file, project_json)
|
||||||
|
|
||||||
def set_dependencies(self, file: str, version: dict):
|
def set_dependencies(self, file: str, version: dict, skipped=None):
|
||||||
project_json = self._read_file(file)
|
project_json = self._read_file(file)
|
||||||
dependencies = project_json['ProjectSettings']['Dependencies']
|
dependencies = project_json['ProjectSettings']['Dependencies']
|
||||||
new_deps = []
|
new_deps = []
|
||||||
@ -40,6 +43,13 @@ class VersionSetterService:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
dep_version = dependency.split('=')[1]
|
dep_version = dependency.split('=')[1]
|
||||||
|
dep_name = dependency.split('=')[0]
|
||||||
|
if dep_name[len(dep_name)-1] not in ascii_letters:
|
||||||
|
dep_name = dep_name[:len(dep_name)-1]
|
||||||
|
|
||||||
|
if skipped is not None and (dep_name in skipped or String.convert_to_snake_case(dep_name) in skipped):
|
||||||
|
new_deps.append(dependency)
|
||||||
|
continue
|
||||||
new_deps.append(dependency.replace(dep_version, f'{version["Major"]}.{version["Minor"]}.{version["Micro"]}'))
|
new_deps.append(dependency.replace(dep_version, f'{version["Major"]}.{version["Minor"]}.{version["Micro"]}'))
|
||||||
|
|
||||||
project_json['ProjectSettings']['Dependencies'] = new_deps
|
project_json['ProjectSettings']['Dependencies'] = new_deps
|
||||||
|
Loading…
Reference in New Issue
Block a user