Skip to content
Snippets Groups Projects
Commit d2ae07d3 authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Aline Gondim Santos
Browse files

plugins: integration with Jami Plugins SDK

Change-Id: I2712856e0658bf5c1961f727f6233e9e79a34e76
parent 9c966b2b
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,6 @@ contrib_build_dir = daemon_dir + r'\contrib\build' ...@@ -54,7 +54,6 @@ contrib_build_dir = daemon_dir + r'\contrib\build'
contrib_tmp_dir = daemon_dir + r'\contrib\tarballs' contrib_tmp_dir = daemon_dir + r'\contrib\tarballs'
plugins_bin_dir = daemon_dir + r'\..\plugins\build' plugins_bin_dir = daemon_dir + r'\..\plugins\build'
plugins_dir = daemon_dir + r'\..\plugins' plugins_dir = daemon_dir + r'\..\plugins'
pluginsList = ['GreenScreen']
# SCM # SCM
wget_args = [ wget_args = [
...@@ -192,8 +191,10 @@ def make_plugin(pkg_info, force, sdk_version, toolset): ...@@ -192,8 +191,10 @@ def make_plugin(pkg_info, force, sdk_version, toolset):
env_set = 'false' if pkg_info.get('with_env', '') == '' else 'true' env_set = 'false' if pkg_info.get('with_env', '') == '' else 'true'
sdk_to_use = sdk_version if env_set == 'false' else pkg_info.get( sdk_to_use = sdk_version if env_set == 'false' else pkg_info.get(
'with_env', '') 'with_env', '')
cmake_script = "cmake -G " + getCMakeGenerator(getLatestVSVersion( cmake_script = "cmake -DCMAKE_SYSTEM_VERSION=" + sdk_version + \
)) + cmake_defines + "-S " + plugin_path + " -B " + plugin_path + "/msvc" " -G " + getCMakeGenerator(getLatestVSVersion()) + cmake_defines + \
" -T " + toolset + \
" -S " + plugin_path + " -B " + plugin_path + "/msvc"
root_logger.warning("Cmake generating vcxproj files") root_logger.warning("Cmake generating vcxproj files")
_ = getSHrunner().exec_batch(cmake_script) _ = getSHrunner().exec_batch(cmake_script)
build(pkg_name, build(pkg_name,
...@@ -203,7 +204,7 @@ def make_plugin(pkg_info, force, sdk_version, toolset): ...@@ -203,7 +204,7 @@ def make_plugin(pkg_info, force, sdk_version, toolset):
env_set, env_set,
sdk_to_use, sdk_to_use,
toolset) toolset)
track_build(pkg_name, version) track_build(pkg_name, version, True)
def make_daemon(pkg_info, force, sdk_version, toolset): def make_daemon(pkg_info, force, sdk_version, toolset):
...@@ -231,11 +232,11 @@ def make_daemon(pkg_info, force, sdk_version, toolset): ...@@ -231,11 +232,11 @@ def make_daemon(pkg_info, force, sdk_version, toolset):
conf=pkg_info.get('configuration', 'Release')) conf=pkg_info.get('configuration', 'Release'))
def make(pkg_info, force, sdk_version, toolset): def make(pkg_info, force, sdk_version, toolset, isPlugin):
pkg_name = pkg_info.get('name') pkg_name = pkg_info.get('name')
if pkg_name == 'daemon': if pkg_name == 'daemon':
return make_daemon(pkg_info, force, sdk_version, toolset) return make_daemon(pkg_info, force, sdk_version, toolset)
if pkg_name in pluginsList: if isPlugin:
return make_plugin(pkg_info, force, sdk_version, toolset) return make_plugin(pkg_info, force, sdk_version, toolset)
version = pkg_info.get('version') version = pkg_info.get('version')
pkg_build_uptodate = False pkg_build_uptodate = False
...@@ -300,7 +301,7 @@ def make(pkg_info, force, sdk_version, toolset): ...@@ -300,7 +301,7 @@ def make(pkg_info, force, sdk_version, toolset):
sdk_to_use, sdk_to_use,
toolset, toolset,
use_cmake=use_cmake): use_cmake=use_cmake):
track_build(pkg_name, version) track_build(pkg_name, version, isPlugin)
else: else:
log.error("Couldn't build contrib " + pkg_name) log.error("Couldn't build contrib " + pkg_name)
exit(1) exit(1)
...@@ -429,10 +430,10 @@ def apply(pkg_name, patches, win_patches): ...@@ -429,10 +430,10 @@ def apply(pkg_name, patches, win_patches):
os.chdir(tmp_dir) os.chdir(tmp_dir)
def get_pkg_file(pkg_name): def get_pkg_file(pkg_name, isPlugin):
if pkg_name == 'daemon': if pkg_name == 'daemon':
pkg_location = daemon_msvc_dir pkg_location = daemon_msvc_dir
elif (pkg_name in pluginsList): elif (isPlugin):
pkg_location = plugins_dir + r'\\' + pkg_name pkg_location = plugins_dir + r'\\' + pkg_name
else: else:
pkg_location = daemon_dir + r'\contrib\src\\' + pkg_name pkg_location = daemon_dir + r'\contrib\src\\' + pkg_name
...@@ -443,21 +444,21 @@ def get_pkg_file(pkg_name): ...@@ -443,21 +444,21 @@ def get_pkg_file(pkg_name):
return pkg_json_file return pkg_json_file
def resolve(pkg_name, force=False, sdk_version='', toolset=''): def resolve(pkg_name, force=False, sdk_version='', toolset='', isPlugin=False):
pkg_json_file = get_pkg_file(pkg_name) pkg_json_file = get_pkg_file(pkg_name, isPlugin)
with open(pkg_json_file, encoding="utf8", errors='ignore') as json_file: with open(pkg_json_file, encoding="utf8", errors='ignore') as json_file:
log.info('Resolving: ' + pkg_name) log.info('Resolving: ' + pkg_name)
pkg_info = json.load(json_file) pkg_info = json.load(json_file)
try: try:
return make(pkg_info, force, sdk_version, toolset) return make(pkg_info, force, sdk_version, toolset, isPlugin)
except Exception as e: except Exception as e:
print(e) print(e)
log.error('Make ' + pkg_name + ' failed!') log.error('Make ' + pkg_name + ' failed!')
sys.exit(1) sys.exit(1)
def track_build(pkg_name, version): def track_build(pkg_name, version, isPlugin):
if pkg_name in pluginsList: if isPlugin:
build_file = plugins_bin_dir + '\\.' + pkg_name build_file = plugins_bin_dir + '\\.' + pkg_name
else: else:
build_file = contrib_build_dir + '\\.' + pkg_name build_file = contrib_build_dir + '\\.' + pkg_name
...@@ -727,6 +728,10 @@ def parse_args(): ...@@ -727,6 +728,10 @@ def parse_args():
ap.add_argument( ap.add_argument(
'-t', '--toolset', default=win_toolset_default, type=str, '-t', '--toolset', default=win_toolset_default, type=str,
help='Use specified platform toolset version') help='Use specified platform toolset version')
ap.add_argument(
'-P', '--plugin', default=False, action='store_true',
help="Defines if we're building a plugin"
)
parsed_args = ap.parse_args() parsed_args = ap.parse_args()
...@@ -774,7 +779,7 @@ def main(): ...@@ -774,7 +779,7 @@ def main():
pkg_json_file = get_pkg_file(parsed_args.clean) pkg_json_file = get_pkg_file(parsed_args.clean)
with open(pkg_json_file, encoding="utf8", errors='ignore') as json_file: with open(pkg_json_file, encoding="utf8", errors='ignore') as json_file:
pkg_info = json.load(json_file) pkg_info = json.load(json_file)
if (parsed_args.clean not in pluginsList): if (not parsed_args.plugin):
exclude_dirs = contrib_build_dir exclude_dirs = contrib_build_dir
dir_to_clean = exclude_dirs + '\\' + pkg_info['name'] dir_to_clean = exclude_dirs + '\\' + pkg_info['name']
file_to_clean = exclude_dirs + '\\.' + pkg_info['name'] file_to_clean = exclude_dirs + '\\.' + pkg_info['name']
...@@ -805,7 +810,7 @@ def main(): ...@@ -805,7 +810,7 @@ def main():
os.makedirs(contrib_build_dir) os.makedirs(contrib_build_dir)
log.info('Making: ' + parsed_args.build) log.info('Making: ' + parsed_args.build)
resolve(parsed_args.build, parsed_args.force, resolve(parsed_args.build, parsed_args.force,
parsed_args.sdk, parsed_args.toolset) parsed_args.sdk, parsed_args.toolset, parsed_args.plugin)
log.info('Make done for: ' + parsed_args.build) log.info('Make done for: ' + parsed_args.build)
log.debug("--- %s ---" % secondsToStr(time.time() - start_time)) log.debug("--- %s ---" % secondsToStr(time.time() - start_time))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment