Added logic to change version only for projects with changes
This commit is contained in:
parent
ddff9dec11
commit
def92c78c8
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2022",
|
"Major": "2022",
|
||||||
"Minor": "6",
|
"Minor": "6",
|
||||||
"Micro": "17.dev5"
|
"Micro": "17"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"LicenseName": "MIT",
|
"LicenseName": "MIT",
|
||||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl-core>=2022.6.17.dev5"
|
"cpl-core>=2022.6.17"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.10",
|
"PythonVersion": ">=3.10",
|
||||||
"PythonPath": {},
|
"PythonPath": {},
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2022",
|
"Major": "2022",
|
||||||
"Minor": "6",
|
"Minor": "6",
|
||||||
"Micro": "17.dev5"
|
"Micro": "17"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2022",
|
"Major": "2022",
|
||||||
"Minor": "6",
|
"Minor": "6",
|
||||||
"Micro": "17.dev5"
|
"Micro": "17"
|
||||||
},
|
},
|
||||||
"Author": "Sven Heidemann",
|
"Author": "Sven Heidemann",
|
||||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"LicenseName": "MIT",
|
"LicenseName": "MIT",
|
||||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl-core>=2022.6.17.dev5"
|
"cpl-core>=2022.6.17"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.10.4",
|
"PythonVersion": ">=3.10.4",
|
||||||
"PythonPath": {},
|
"PythonPath": {},
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum
|
from cpl_cli.configuration.version_settings_name_enum import VersionSettingsNameEnum
|
||||||
@ -27,6 +28,7 @@ class Application(ApplicationABC):
|
|||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
Console.write_line('Set versions:')
|
Console.write_line('Set versions:')
|
||||||
|
|
||||||
args = self._configuration.additional_arguments
|
args = self._configuration.additional_arguments
|
||||||
version = {}
|
version = {}
|
||||||
branch = ""
|
branch = ""
|
||||||
@ -53,8 +55,15 @@ class Application(ApplicationABC):
|
|||||||
Console.error(f'Branch {branch} does not contain valid version')
|
Console.error(f'Branch {branch} does not contain valid version')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
diff_paths = []
|
||||||
|
for file in self._git_service.get_diff_files():
|
||||||
|
diff_paths.append(os.path.basename(os.path.dirname(file)))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for project in self._workspace.projects:
|
for project in self._workspace.projects:
|
||||||
|
if project not in diff_paths:
|
||||||
|
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)
|
||||||
if not project.startswith('cpl') and not project.startswith('unittest'):
|
if not project.startswith('cpl') and not project.startswith('unittest'):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import os
|
from git import Repo, DiffIndex
|
||||||
|
|
||||||
from cpl_core.environment import ApplicationEnvironmentABC
|
from cpl_core.environment import ApplicationEnvironmentABC
|
||||||
|
|
||||||
@ -7,12 +7,11 @@ class GitService:
|
|||||||
|
|
||||||
def __init__(self, env: ApplicationEnvironmentABC):
|
def __init__(self, env: ApplicationEnvironmentABC):
|
||||||
self._env = env
|
self._env = env
|
||||||
|
self._repo = Repo(env.working_directory)
|
||||||
|
|
||||||
def get_active_branch_name(self) -> str:
|
def get_active_branch_name(self) -> str:
|
||||||
head_dir = os.path.join(self._env.working_directory, '.git/HEAD')
|
branch = self._repo.active_branch
|
||||||
with open(head_dir, 'r') as f:
|
return branch.name
|
||||||
content = f.read().splitlines()
|
|
||||||
|
|
||||||
for line in content:
|
def get_diff_files(self) -> list[str]:
|
||||||
if line[0:4] == "ref:":
|
return [item.a_path for item in self._repo.index.diff(None)]
|
||||||
return line.partition("refs/heads/")[2]
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"LicenseName": "MIT",
|
"LicenseName": "MIT",
|
||||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl-core>=2022.6.17.dev5",
|
"cpl-core>=2022.6.17",
|
||||||
"gitpython==3.1.27"
|
"gitpython==3.1.27"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.10.4",
|
"PythonVersion": ">=3.10.4",
|
||||||
|
@ -25,7 +25,7 @@ class Startup(StartupABC):
|
|||||||
|
|
||||||
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC:
|
||||||
services.add_pipes()
|
services.add_pipes()
|
||||||
services.add_transient(GitService)
|
services.add_singleton(GitService)
|
||||||
services.add_transient(VersionSetterService)
|
services.add_transient(VersionSetterService)
|
||||||
|
|
||||||
return services.build_service_provider()
|
return services.build_service_provider()
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2022",
|
"Major": "2022",
|
||||||
"Minor": "6",
|
"Minor": "6",
|
||||||
"Micro": "17.dev5"
|
"Micro": "17.dev6"
|
||||||
},
|
},
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"AuthorEmail": "",
|
"AuthorEmail": "",
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"LicenseName": "",
|
"LicenseName": "",
|
||||||
"LicenseDescription": "",
|
"LicenseDescription": "",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl-core>=2022.6.17.dev5"
|
"cpl-core>=2022.6.17.dev6"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.10.4",
|
"PythonVersion": ">=3.10.4",
|
||||||
"PythonPath": {
|
"PythonPath": {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2022",
|
"Major": "2022",
|
||||||
"Minor": "6",
|
"Minor": "6",
|
||||||
"Micro": "17.dev5"
|
"Micro": "17.dev6"
|
||||||
},
|
},
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"AuthorEmail": "",
|
"AuthorEmail": "",
|
||||||
@ -16,8 +16,8 @@
|
|||||||
"LicenseName": "",
|
"LicenseName": "",
|
||||||
"LicenseDescription": "",
|
"LicenseDescription": "",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl-core>=2022.6.17.dev5",
|
"cpl-core>=2022.6.17.dev6",
|
||||||
"cpl-cli>=2022.6.17.dev5"
|
"cpl-cli>=2022.6.17.dev6"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.10.4",
|
"PythonVersion": ">=3.10.4",
|
||||||
"PythonPath": {
|
"PythonPath": {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2022",
|
"Major": "2022",
|
||||||
"Minor": "6",
|
"Minor": "6",
|
||||||
"Micro": "17.dev5"
|
"Micro": "17.dev6"
|
||||||
},
|
},
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"AuthorEmail": "",
|
"AuthorEmail": "",
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"LicenseName": "",
|
"LicenseName": "",
|
||||||
"LicenseDescription": "",
|
"LicenseDescription": "",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl-core>=2022.6.17.dev5"
|
"cpl-core>=2022.6.17.dev6"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.10.4",
|
"PythonVersion": ">=3.10.4",
|
||||||
"PythonPath": {
|
"PythonPath": {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2022",
|
"Major": "2022",
|
||||||
"Minor": "6",
|
"Minor": "6",
|
||||||
"Micro": "17.dev5"
|
"Micro": "17.dev6"
|
||||||
},
|
},
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"AuthorEmail": "",
|
"AuthorEmail": "",
|
||||||
@ -16,8 +16,8 @@
|
|||||||
"LicenseName": "",
|
"LicenseName": "",
|
||||||
"LicenseDescription": "",
|
"LicenseDescription": "",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl-core>=2022.6.17.dev5",
|
"cpl-core>=2022.6.17.dev6",
|
||||||
"cpl-query>=2022.6.17.dev5"
|
"cpl-query>=2022.6.17.dev6"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.10.4",
|
"PythonVersion": ">=3.10.4",
|
||||||
"PythonPath": {
|
"PythonPath": {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"Version": {
|
"Version": {
|
||||||
"Major": "2022",
|
"Major": "2022",
|
||||||
"Minor": "6",
|
"Minor": "6",
|
||||||
"Micro": "17.dev5"
|
"Micro": "17.dev6"
|
||||||
},
|
},
|
||||||
"Author": "",
|
"Author": "",
|
||||||
"AuthorEmail": "",
|
"AuthorEmail": "",
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"LicenseName": "",
|
"LicenseName": "",
|
||||||
"LicenseDescription": "",
|
"LicenseDescription": "",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"cpl-core>=2022.6.17.dev5"
|
"cpl-core>=2022.6.17.dev6"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.10.4",
|
"PythonVersion": ">=3.10.4",
|
||||||
"PythonPath": {
|
"PythonPath": {
|
||||||
|
Loading…
Reference in New Issue
Block a user