Browse Source

create build directory in "shut pkg build", "shut <> bump" now passes the new version to the update() function

shut-new-model
Niklas Rosenstein 9 months ago
parent
commit
38ee0f927b
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
4 changed files with 7 additions and 4 deletions
  1. + 2
    - 2
      src/shut/commands/commons/bump.py
  2. + 2
    - 1
      src/shut/commands/mono/bump.py
  3. + 1
    - 0
      src/shut/commands/pkg/build.py
  4. + 2
    - 1
      src/shut/commands/pkg/bump.py

+ 2
- 2
src/shut/commands/commons/bump.py

@ -127,7 +127,7 @@ class VersionBumpData(Generic[T], metaclass=abc.ABCMeta):
return changed_files
@abc.abstractmethod
def update(self) -> Iterable[str]:
def update(self, new_version: Version) -> Iterable[str]:
"""
Run the "update" function for the current monorepo or package. A list of the modified files
must be returned.
@ -227,7 +227,7 @@ def do_bump(args: Args, data: VersionBumpData[AbstractProjectModel]) -> None:
if not args.skip_update:
print()
print('updating files')
changed_files += data.update()
changed_files += data.update(new_version)
if args.tag:
print()

+ 2
- 1
src/shut/commands/mono/bump.py

@ -45,7 +45,8 @@ class MonorepoBumpdata(VersionBumpData[MonorepoModel]):
def run_checks(self) -> int:
return check_monorepo(self.obj, self.args.warnings_as_errors)
def update(self) -> None:
def update(self, new_version: Version) -> None:
self.obj.version = new_version
vfiles = update_monorepo(self.obj, dry=self.args.dry, indent=1)
return vfiles.abspaths(self.obj.get_directory())

+ 1
- 0
src/shut/commands/pkg/build.py

@ -35,6 +35,7 @@ from .. import project
def run_builds(builders: List[Builder], build_dir: str, verbose: bool) -> bool:
os.makedirs(build_dir)
for builder in builders:
print(colored(f'building {colored(builder.id, "green")}'))
for filename in builder.get_outputs():

+ 2
- 1
src/shut/commands/pkg/bump.py

@ -52,7 +52,8 @@ class PackageBumpData(VersionBumpData[PackageModel]):
def run_checks(self) -> int:
return check_package(self.obj, self.args.warnings_as_errors)
def update(self) -> Iterable[str]:
def update(self, new_version: Version) -> Iterable[str]:
self.obj.data.version = new_version
vfiles = update_package(self.obj, dry=self.args.dry, indent=1)
return vfiles.abspaths(self.obj.get_directory())

Loading…
Cancel
Save