updating directories and related functions
This commit is contained in:
parent
1c728876e6
commit
e66a5f79a2
2 changed files with 34 additions and 26 deletions
|
@ -305,3 +305,11 @@ def get_out_dir():
|
|||
|
||||
def get_dist_dir():
|
||||
return os.path.join(get_out_dir(), 'gen', 'electron_dist')
|
||||
|
||||
def get_electron_exec():
|
||||
if sys.platform == 'darwin':
|
||||
return 'out/{0}/Electron.app/Contents/MacOS/Electron'.format(get_out_dir())
|
||||
elif sys.platform == 'win32':
|
||||
return 'out/{0}/electron.exe'.format(get_out_dir())
|
||||
elif sys.platform == 'linux':
|
||||
return 'out/{0}/electron'.format(get_out_dir())
|
|
@ -6,6 +6,7 @@ import errno
|
|||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
@ -14,7 +15,8 @@ from io import StringIO
|
|||
from lib.config import PLATFORM, get_target_arch, get_env_var, s3_config, \
|
||||
get_zip_name
|
||||
from lib.util import get_electron_branding, execute, get_electron_version, \
|
||||
parse_version, scoped_cwd, s3put
|
||||
parse_version, scoped_cwd, s3put, get_electron_exec, \
|
||||
get_out_dir
|
||||
|
||||
|
||||
ELECTRON_REPO = 'electron/electron'
|
||||
|
@ -24,8 +26,7 @@ PROJECT_NAME = get_electron_branding()['project_name']
|
|||
PRODUCT_NAME = get_electron_branding()['product_name']
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
|
||||
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
|
||||
OUT_DIR = get_out_dir()
|
||||
|
||||
DIST_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION)
|
||||
SYMBOLS_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'symbols')
|
||||
|
@ -60,40 +61,48 @@ def main():
|
|||
'You have to pass --overwrite to overwrite a published release'
|
||||
|
||||
# Upload Electron files.
|
||||
upload_electron(release, os.path.join(DIST_DIR, DIST_NAME), args)
|
||||
# Rename dist.zip to get_zip_name('electron', version, suffix='')
|
||||
electron_zip = os.path.join(OUT_DIR, DIST_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'dist.zip'), electron_zip)
|
||||
upload_electron(release, electron_zip, args)
|
||||
if get_target_arch() != 'mips64el':
|
||||
upload_electron(release, os.path.join(DIST_DIR, SYMBOLS_NAME), args)
|
||||
symbols_zip = os.path.join(OUT_DIR, SYMBOLS_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'symobls.zip'), symbols_zip)
|
||||
upload_electron(release, symbols_zip, args)
|
||||
if PLATFORM == 'darwin':
|
||||
api_path = os.path.join(SOURCE_ROOT, 'electron-api.json')
|
||||
api_path = os.path.join(OUT_DIR, 'electron-api.json')
|
||||
upload_electron(release, api_path, args)
|
||||
|
||||
ts_defs_path = os.path.join(SOURCE_ROOT, 'electron.d.ts')
|
||||
ts_defs_path = os.path.join(OUT_DIR, 'electron.d.ts')
|
||||
upload_electron(release, ts_defs_path, args)
|
||||
|
||||
upload_electron(release, os.path.join(DIST_DIR, DSYM_NAME), args)
|
||||
dsym_zip = os.path.join(OUT_DIR, DSYM_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'dsym.zip'), dsym_zip)
|
||||
upload_electron(release, dsym_zip, args)
|
||||
elif PLATFORM == 'win32':
|
||||
upload_electron(release, os.path.join(DIST_DIR, PDB_NAME), args)
|
||||
upload_electron(release, os.path.join(OUT_DIR, PDB_NAME), args)
|
||||
|
||||
# Upload free version of ffmpeg.
|
||||
ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION)
|
||||
upload_electron(release, os.path.join(DIST_DIR, ffmpeg), args)
|
||||
ffmpeg_zip = os.path.join(OUT_DIR, ffmpeg)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'ffmpeg.zip'), ffmpeg_zip)
|
||||
upload_electron(release, ffmpeg_zip, args)
|
||||
|
||||
chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION)
|
||||
upload_electron(release, os.path.join(DIST_DIR, chromedriver), args)
|
||||
chromedriver_zip = os.path.join(OUT_DIR, chromedriver)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'chromedriver.zip'), chromedriver_zip)
|
||||
upload_electron(release, chromedriver_zip, args)
|
||||
mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION)
|
||||
upload_electron(release, os.path.join(DIST_DIR, mksnapshot), args)
|
||||
upload_electron(release, os.path.join(OUT_DIR, mksnapshot), args)
|
||||
|
||||
if get_target_arch().startswith('arm'):
|
||||
# Upload the x64 binary for arm/arm64 mksnapshot
|
||||
mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION, 'x64')
|
||||
upload_electron(release, os.path.join(DIST_DIR, mksnapshot), args)
|
||||
upload_electron(release, os.path.join(OUT_DIR, mksnapshot), args)
|
||||
|
||||
if not tag_exists and not args.upload_to_s3:
|
||||
# Upload symbols to symbol server.
|
||||
run_python_script('upload-symbols.py')
|
||||
if PLATFORM == 'win32':
|
||||
# Upload node headers.
|
||||
run_python_script('create-node-headers.py', '-v', args.version)
|
||||
run_python_script('upload-node-headers.py', '-v', args.version)
|
||||
|
||||
|
||||
|
@ -125,16 +134,7 @@ def get_electron_build_version():
|
|||
if get_target_arch().startswith('arm') or os.environ.has_key('CI'):
|
||||
# In CI we just build as told.
|
||||
return ELECTRON_VERSION
|
||||
if PLATFORM == 'darwin':
|
||||
electron = os.path.join(SOURCE_ROOT, 'out', 'R',
|
||||
'{0}.app'.format(PRODUCT_NAME), 'Contents',
|
||||
'MacOS', PRODUCT_NAME)
|
||||
elif PLATFORM == 'win32':
|
||||
electron = os.path.join(SOURCE_ROOT, 'out', 'R',
|
||||
'{0}.exe'.format(PROJECT_NAME))
|
||||
else:
|
||||
electron = os.path.join(SOURCE_ROOT, 'out', 'R', PROJECT_NAME)
|
||||
|
||||
electron = get_electron_exec()
|
||||
return subprocess.check_output([electron, '--version']).strip()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue