From 2d025dae2da4b7eb3efc8112e0fb19bea87ade30 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Mon, 11 Dec 2017 14:06:50 -0800 Subject: [PATCH] Include shared_library and mpd_generator in ci and releases Change-Id: Ie9449cbca711324831cb15e83d0efaf7a43cf9ef --- .travis.yml | 29 ++++++++++++++++++++++++----- appveyor.yml | 22 ++++++++++++++++++---- packager/app/test/packager_app.py | 14 +++++++++++--- packager/app/test/packager_test.py | 2 +- packager/app/test/test_env.py | 6 +----- 5 files changed, 55 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 330cf676cf..1ed4b5b0f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,10 @@ os: - osx env: - - BUILD_TYPE=Debug - - BUILD_TYPE=Release + - BUILD_TYPE=Debug LIBPACKAGER_TYPE=static_library + - BUILD_TYPE=Debug LIBPACKAGER_TYPE=shared_library + - BUILD_TYPE=Release LIBPACKAGER_TYPE=static_library + - BUILD_TYPE=Release LIBPACKAGER_TYPE=shared_library before_install: - test -n $CC && unset CC @@ -21,22 +23,39 @@ before_script: - shopt -s extglob dotglob - mv !(src) src - gclient config https://github.com/google/shaka-packager.git --name=src --unmanaged + - export GYP_DEFINES="libpackager_type=${LIBPACKAGER_TYPE}" - gclient sync - cd src - ninja -C out/${BUILD_TYPE} -k 100 script: + - if [ ${LIBPACKAGER_TYPE} == "shared_library" ] && [ ${TRAVIS_OS_NAME} == "osx" ]; then + export DYLD_FALLBACK_LIBRARY_PATH=./out/${BUILD_TYPE}; + fi - ( find out/${BUILD_TYPE} -name "*_*test" | while read i ; do $i || exit ; done ) - - out/${BUILD_TYPE}/packager_test.py -v + - out/${BUILD_TYPE}/packager_test.py -v --libpackager_type=${LIBPACKAGER_TYPE} before_deploy: - - mv out/${BUILD_TYPE}/packager out/${BUILD_TYPE}/packager-${TRAVIS_OS_NAME} + - rm -rf deploy + - mkdir deploy + - | + if [ ${LIBPACKAGER_TYPE} == "shared_library" ]; then + if [ ${TRAVIS_OS_NAME} == "linux" ]; then + mv out/${BUILD_TYPE}/lib/libpackager.so deploy/libpackager-${TRAVIS_OS_NAME}.so + else + mv out/${BUILD_TYPE}/libpackager.dylib deploy/libpackager-${TRAVIS_OS_NAME}.dylib + fi + else + mv out/${BUILD_TYPE}/packager deploy/packager-${TRAVIS_OS_NAME} + mv out/${BUILD_TYPE}/mpd_generator deploy/mpd_generator-${TRAVIS_OS_NAME} + fi deploy: provider: releases api_key: secure: PbhquzRnY1BkGkM/6LmVSZjhUd8jWnj77QjxAKA8REnFhbAuzqwDYuytRmUsBFMtgatUEgTuh/1duZaIl0yXGvRZdNeGk7BgtguUy6vraWObjjNUSlQ6Njm4y/hMgaUIOhA9I2b8gokWU1PA0sDJOF/FoZaAxFpKXcW4d8Z2C0s= - file: out/${BUILD_TYPE}/packager-${TRAVIS_OS_NAME} + file_glob: true + file: deploy/* skip_cleanup: true on: tags: true diff --git a/appveyor.yml b/appveyor.yml index 122d8f1ecf..f695849294 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,6 +9,9 @@ configuration: environment: matrix: - language: cpp + libpackager_type: static_library + - language: cpp + libpackager_type: shared_library clone_folder: c:\projects\shaka-packager\src @@ -18,7 +21,7 @@ install: before_build: - cd .. - depot_tools\gclient config https://github.com/google/shaka-packager.git --name=src --unmanaged - - set GYP_DEFINES='target_arch="%PLATFORM%"' + - set GYP_DEFINES="target_arch=%PLATFORM% libpackager_type=%LIBPACKAGER_TYPE%" - depot_tools\gclient sync - if [%PLATFORM%] == [x64] ( set "output_directory=%CONFIGURATION%_x64" @@ -29,14 +32,25 @@ before_build: build_script: - cd src - ..\depot_tools\ninja -C "out\%OUTPUT_DIRECTORY%" -k 100 - - copy "out\%OUTPUT_DIRECTORY%\packager.exe" packager-win.exe test_script: - for %%f in ("out\%OUTPUT_DIRECTORY%\*_*test.exe") do (%%f || exit /b 666) - - python "out\%OUTPUT_DIRECTORY%\packager_test.py" -v + - python "out\%OUTPUT_DIRECTORY%\packager_test.py" -v --libpackager_type="%LIBPACKAGER_TYPE%" + +after_build: + - if exist deploy rmdir /s /q deploy + - mkdir deploy + - if [%LIBPACKAGER_TYPE%] == ["shared_library"] ( + copy "out\%OUTPUT_DIRECTORY%\packager.dll" deploy\packager-win.dll + ) else ( + copy "out\%OUTPUT_DIRECTORY%\packager.exe" deploy\packager-win.exe + ) + - if NOT [%LIBPACKAGER_TYPE%] == ["shared_library"] ( + copy "out\%OUTPUT_DIRECTORY%\mpd_generator.exe" deploy\mpd_generator-win.exe + ) artifacts: - - path: packager-win.exe + - path: 'deploy\*' deploy: provider: GitHub diff --git a/packager/app/test/packager_app.py b/packager/app/test/packager_app.py index 8218b7420b..159432ae0a 100644 --- a/packager/app/test/packager_app.py +++ b/packager/app/test/packager_app.py @@ -28,13 +28,21 @@ class PackagerApp(object): assert os.path.exists(self.binary), ('Please run from output directory, ' 'e.g. out/Debug/packager_test.py') + def GetEnv(self): + env = os.environ.copy() + if (platform.system() == 'Darwin' and + test_env.options.libpackager_type == 'shared_library'): + env['DYLD_FALLBACK_LIBRARY_PATH'] = test_env.SCRIPT_DIR + return env + def DumpStreamInfo(self, stream): input_str = 'input=%s' % stream cmd = [self.binary, input_str, '--dump_stream_info'] - return subprocess.check_output(cmd) + return subprocess.check_output(cmd, env=self.GetEnv()) def Version(self): - return subprocess.check_output([self.binary, '--version']) + return subprocess.check_output( + [self.binary, '--version'], env=self.GetEnv()) def Package(self, streams, flags=None): """Executes packager command.""" @@ -52,7 +60,7 @@ class PackagerApp(object): # Put single-quotes around each entry so that things like '$' signs in # segment templates won't be interpreted as shell variables. self.packaging_command_line = ' '.join(["'%s'" % entry for entry in cmd]) - packaging_result = subprocess.call(cmd) + packaging_result = subprocess.call(cmd, env=self.GetEnv()) if packaging_result != 0: print '%s returned non-0 status' % self.packaging_command_line return packaging_result diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 44f118fe89..21c802758d 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -885,7 +885,7 @@ class PackagerFunctionalTest(PackagerAppTest): # TODO(kqyang): Fix shared_library not supporting strip_parameter_set_nalus # problem. @unittest.skipUnless( - test_env.options.static_libpackager, + test_env.options.libpackager_type == 'static_library', 'libpackager shared_library does not support ' '--strip_parameter_set_nalus flag.' ) diff --git a/packager/app/test/test_env.py b/packager/app/test/test_env.py index 74474eb2df..be5c2fab47 100644 --- a/packager/app/test/test_env.py +++ b/packager/app/test/test_env.py @@ -28,11 +28,7 @@ parser = argparse.ArgumentParser() parser.add_argument('--test_update_golden_files', default=0, type=int) -parser.add_argument('--static_libpackager', - dest='static_libpackager', action='store_true') -parser.add_argument('--shared_libpackager', - dest='static_libpackager', action='store_false') -parser.set_defaults(static_libpackager=True) +parser.add_argument('--libpackager_type', default='static_library') parser.add_argument('--v') parser.add_argument('--vmodule')