|
|
@ -2,15 +2,15 @@
|
|
|
|
import shutil as shut
|
|
|
|
import shutil as shut
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
from lib import *
|
|
|
|
from lib import *
|
|
|
|
import json
|
|
|
|
|
|
|
|
from clean import clean
|
|
|
|
from clean import clean
|
|
|
|
from check import check_daemon_depends, check_ui_depends
|
|
|
|
from check import check, check_daemon_tooling, check_ui_tooling
|
|
|
|
|
|
|
|
from typing import List
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build_output = 'out'
|
|
|
|
build_output = 'out'
|
|
|
|
verbose = False
|
|
|
|
verbose = False
|
|
|
|
ffmpeg = False
|
|
|
|
ffmpeg = False
|
|
|
|
install_deps = False
|
|
|
|
install_tooling = False
|
|
|
|
|
|
|
|
|
|
|
|
windows = os.name == 'nt'
|
|
|
|
windows = os.name == 'nt'
|
|
|
|
|
|
|
|
|
|
|
@ -18,18 +18,18 @@ windows = os.name == 'nt'
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
opts = parse_args()
|
|
|
|
opts = parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
global install_deps
|
|
|
|
global install_tooling
|
|
|
|
global build_output
|
|
|
|
global build_output
|
|
|
|
global verbose
|
|
|
|
global verbose
|
|
|
|
global ffmpeg
|
|
|
|
global ffmpeg
|
|
|
|
global install_deps
|
|
|
|
global install_tooling
|
|
|
|
|
|
|
|
|
|
|
|
build_output = opts.output if opts.output else build_output
|
|
|
|
build_output = opts.output if opts.output else build_output
|
|
|
|
verbose = opts.verbose
|
|
|
|
verbose = opts.verbose
|
|
|
|
ffmpeg = opts.ffmpeg
|
|
|
|
ffmpeg = opts.ffmpeg
|
|
|
|
install_deps = opts.install_deps
|
|
|
|
install_tooling = opts.install_tooling
|
|
|
|
|
|
|
|
|
|
|
|
build(opts.component)
|
|
|
|
build(opts.component, opts.bundles)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def parse_args():
|
|
|
|
def parse_args():
|
|
|
@ -39,30 +39,34 @@ def parse_args():
|
|
|
|
'component', type=str, nargs='?', default='all', choices=['daemon', 'ui', 'all'])
|
|
|
|
'component', type=str, nargs='?', default='all', choices=['daemon', 'ui', 'all'])
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
'--verbose', action='store_true', help='Verbose build')
|
|
|
|
'--verbose', action='store_true', help='Verbose build')
|
|
|
|
parser.add_argument('--install-deps', action='store_true',
|
|
|
|
|
|
|
|
help='Install dependencies')
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
'--output', action='store', help='Build output directory')
|
|
|
|
'--output', action='store', help='Build output directory')
|
|
|
|
parser.add_argument(
|
|
|
|
parser.add_argument(
|
|
|
|
'--ffmpeg', action='store_true', help='Build with ffmpeg')
|
|
|
|
'--ffmpeg', action='store_true', help='Build with ffmpeg')
|
|
|
|
|
|
|
|
parser.add_argument('--install-tooling',
|
|
|
|
|
|
|
|
action='store_true', help='Install tooling')
|
|
|
|
|
|
|
|
parser.add_argument('--bundles', nargs='+',
|
|
|
|
|
|
|
|
help='UI bundles to build')
|
|
|
|
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
args = parser.parse_args()
|
|
|
|
return args
|
|
|
|
return args
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def build(component: str):
|
|
|
|
def build(component: str, bundles: List[str] = None):
|
|
|
|
'''Builds the selected component'''
|
|
|
|
'''Builds the selected component'''
|
|
|
|
clean()
|
|
|
|
clean()
|
|
|
|
create_output_dir()
|
|
|
|
create_output_dir()
|
|
|
|
|
|
|
|
|
|
|
|
if component == 'daemon' or component == 'all':
|
|
|
|
if component == 'all':
|
|
|
|
check_daemon_depends()
|
|
|
|
check(install_tooling)
|
|
|
|
build_daemon()
|
|
|
|
build_daemon()
|
|
|
|
elif component == 'ui' or component == 'all':
|
|
|
|
build_ui(bundles)
|
|
|
|
check_ui_depends(install_deps)
|
|
|
|
elif component == 'daemon':
|
|
|
|
build_ui()
|
|
|
|
check_daemon_tooling(install_tooling)
|
|
|
|
else:
|
|
|
|
build_daemon()
|
|
|
|
raise Exception('Unknown component: {}'.format(component))
|
|
|
|
elif component == 'ui':
|
|
|
|
|
|
|
|
check_ui_tooling()
|
|
|
|
|
|
|
|
build_ui(bundles)
|
|
|
|
|
|
|
|
|
|
|
|
print('Build complete')
|
|
|
|
print('Build complete')
|
|
|
|
|
|
|
|
|
|
|
@ -82,9 +86,13 @@ def build_daemon():
|
|
|
|
store_artifact('mediarepo-daemon/target/release/mediarepo-daemon')
|
|
|
|
store_artifact('mediarepo-daemon/target/release/mediarepo-daemon')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def build_ui():
|
|
|
|
def build_ui(bundles: List[str] = None):
|
|
|
|
'''Builds UI'''
|
|
|
|
'''Builds UI'''
|
|
|
|
yarn('install', 'mediarepo-ui')
|
|
|
|
yarn('install', 'mediarepo-ui')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if bundles is not None:
|
|
|
|
|
|
|
|
cargo('tauri build --bundles ' + ' '.join(bundles), 'mediarepo-ui')
|
|
|
|
|
|
|
|
else:
|
|
|
|
cargo('tauri build ', 'mediarepo-ui')
|
|
|
|
cargo('tauri build ', 'mediarepo-ui')
|
|
|
|
|
|
|
|
|
|
|
|
if windows:
|
|
|
|
if windows:
|
|
|
|