Skip to content

Commit

Permalink
[#286] Build hook: Add --debug_build option
Browse files Browse the repository at this point in the history
Based on the --debug_build option in the build hook in the main
iRODS repository.
  • Loading branch information
alanking committed Jan 6, 2025
1 parent 804b1c4 commit 606c219
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions irods_consortium_continuous_integration_build_hook.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
from __future__ import print_function

import argparse
import glob
import multiprocessing
import optparse
import os
import tempfile

import irods_python_ci_utilities


def add_cmake_to_front_of_path():
cmake_path = '/opt/irods-externals/cmake3.21.4-0/bin'
os.environ['PATH'] = os.pathsep.join([cmake_path, os.environ['PATH']])
Expand Down Expand Up @@ -61,25 +58,30 @@ def copy_output_packages(build_directory, output_root_directory):
irods_python_ci_utilities.append_os_specific_directory(output_root_directory),
lambda s:s.endswith(irods_python_ci_utilities.get_package_suffix()))

def main(build_directory, output_root_directory, irods_packages_root_directory, externals_directory):
def main(build_directory, output_root_directory, irods_packages_root_directory, externals_directory, debug_build=False):
install_building_dependencies(externals_directory)
if irods_packages_root_directory:
irods_python_ci_utilities.install_irods_dev_and_runtime_packages(irods_packages_root_directory)
build_directory = os.path.abspath(build_directory or tempfile.mkdtemp(prefix='irods_storage_tiering_plugin_build_directory'))
irods_python_ci_utilities.subprocess_get_output(['cmake', os.path.dirname(os.path.realpath(__file__))], check_rc=True, cwd=build_directory)
build_type = "Debug" if debug_build else "Release"
cmake_command = ['cmake', f"-DCMAKE_BUILD_TYPE={build_type}", os.path.dirname(os.path.realpath(__file__))]
print(cmake_command)
irods_python_ci_utilities.subprocess_get_output(cmake_command, check_rc=True, cwd=build_directory)
irods_python_ci_utilities.subprocess_get_output(['make', '-j', str(multiprocessing.cpu_count()), 'package'], check_rc=True, cwd=build_directory)
if output_root_directory:
copy_output_packages(build_directory, output_root_directory)

if __name__ == '__main__':
parser = optparse.OptionParser()
parser.add_option('--build_directory')
parser.add_option('--output_root_directory')
parser.add_option('--irods_packages_root_directory')
parser.add_option('--externals_packages_directory')
options, _ = parser.parse_args()
parser = argparse.ArgumentParser(description='Build unified storage tiering plugin.')
parser.add_argument('--build_directory')
parser.add_argument('--output_root_directory')
parser.add_argument('--irods_packages_root_directory')
parser.add_argument('--externals_packages_directory')
parser.add_argument('--debug_build', action='store_true')
args = parser.parse_args()

main(options.build_directory,
options.output_root_directory,
options.irods_packages_root_directory,
options.externals_packages_directory)
main(args.build_directory,
args.output_root_directory,
args.irods_packages_root_directory,
args.externals_packages_directory,
args.debug_build)

0 comments on commit 606c219

Please sign in to comment.