Skip to content

Commit

Permalink
Allow enabling certain subprojects only when overriding OpenSlide
Browse files Browse the repository at this point in the history
Allow specific subprojects to be enabled only when building an overridden
OpenSlide (presumably from Git main) but not when building a released
OpenSlide.  This allows development dependencies to be added without
removing them again for intervening openslide-bin releases.

Signed-off-by: Benjamin Gilbert <bgilbert@cs.cmu.edu>
  • Loading branch information
bgilbert committed Mar 14, 2024
1 parent 391453b commit 1603670
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/release.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# openslide-bin release process

- [ ] If there's a new OpenSlide release, remove `dev_deps` condition from any subprojects used by the new release
- [ ] Run [workflow](https://github.com/openslide/openslide-bin/actions/workflows/update-check.yml) to check for updates
- [ ] Merge any resulting PR; perform any needed manual updates reported by the workflow
- [ ] Submit PR to update `CHANGELOG.md` and `_PROJECT_VERSION`
Expand Down
16 changes: 12 additions & 4 deletions bintool
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class BuildParams:
overrides directory.'''
assert self.locked
for proj in Project.get_all():
override = self.root / 'override' / proj.id
override = proj.override_path
dir = self.root / 'subprojects' / proj.id
wrap = proj.wrap_path
overridden = wrap.with_suffix('.wrap.overridden')
Expand Down Expand Up @@ -287,12 +287,20 @@ class MesonPlatform(Platform):
# we wipe
args.append('--wipe')

openslide_src = Project.get('openslide').source_dir
openslide = Project.get('openslide')
# we can't check for the existence of the wrap file; sdist needs
# dev_deps but doesn't activate overrides
dev_deps = openslide.override_path.is_dir()
args.append(f'-Ddev_deps={str(dev_deps).lower()}')
if dev_deps:
# OpenSlide is overridden; enable deps used by its Git main
log('Enabling development dependencies...')

version_suffix = (
subprocess.check_output(
['git', 'rev-parse', 'HEAD'], cwd=openslide_src
['git', 'rev-parse', 'HEAD'], cwd=openslide.source_dir
).decode()[:7]
if (openslide_src / '.git').exists()
if (openslide.source_dir / '.git').exists()
else ''
)
args.append(f'-Dopenslide:version_suffix={version_suffix}')
Expand Down
4 changes: 4 additions & 0 deletions common/software.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ def wrap(self) -> configparser.RawConfigParser:
def wrap_path(self) -> Path:
return meson_source_root() / 'subprojects' / f'{self.id}.wrap'

@property
def override_path(self) -> Path:
return meson_source_root() / 'override' / self.id

@cached_property
def version(self) -> str:
try:
Expand Down
2 changes: 2 additions & 0 deletions deps/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# should we enable all subprojects that are needed by any OS? this is
# needed when building source distributions so we don't leave anything out
all_systems = get_option('all_systems')
# should we enable subprojects needed by OpenSlide Git main?
dev_deps = get_option('dev_deps')

add_global_arguments(
'-I' + meson.current_source_dir(),
Expand Down
6 changes: 6 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ option(
value : false,
description : 'Enable subprojects for all OSes (for building source tarball)',
)
option(
'dev_deps',
type : 'boolean',
value : false,
description : 'Enable subprojects for OpenSlide Git main',
)

0 comments on commit 1603670

Please sign in to comment.