Merge pull request #12892 from electron/skip_pdf_resource
build: don't ship pdf_viewer_resources.pak when feature flag is disabled
This commit is contained in:
commit
e79751c8d4
2 changed files with 14 additions and 3 deletions
|
@ -14,7 +14,7 @@ if sys.platform == "win32":
|
||||||
from lib.config import BASE_URL, PLATFORM, enable_verbose_mode, \
|
from lib.config import BASE_URL, PLATFORM, enable_verbose_mode, \
|
||||||
get_target_arch, get_zip_name, build_env
|
get_target_arch, get_zip_name, build_env
|
||||||
from lib.util import scoped_cwd, rm_rf, get_electron_version, make_zip, \
|
from lib.util import scoped_cwd, rm_rf, get_electron_version, make_zip, \
|
||||||
execute, electron_gyp
|
execute, electron_gyp, electron_features
|
||||||
|
|
||||||
|
|
||||||
ELECTRON_VERSION = get_electron_version()
|
ELECTRON_VERSION = get_electron_version()
|
||||||
|
@ -28,6 +28,7 @@ NATIVE_MKSNAPSHOT_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'native_mksnapshot')
|
||||||
|
|
||||||
PROJECT_NAME = electron_gyp()['project_name%']
|
PROJECT_NAME = electron_gyp()['project_name%']
|
||||||
PRODUCT_NAME = electron_gyp()['product_name%']
|
PRODUCT_NAME = electron_gyp()['product_name%']
|
||||||
|
PDF_VIEWER_ENABLED = electron_features()['enable_pdf_viewer%']
|
||||||
|
|
||||||
TARGET_BINARIES = {
|
TARGET_BINARIES = {
|
||||||
'darwin': [
|
'darwin': [
|
||||||
|
@ -35,7 +36,6 @@ TARGET_BINARIES = {
|
||||||
'win32': [
|
'win32': [
|
||||||
'{0}.exe'.format(PROJECT_NAME), # 'electron.exe'
|
'{0}.exe'.format(PROJECT_NAME), # 'electron.exe'
|
||||||
'content_shell.pak',
|
'content_shell.pak',
|
||||||
'pdf_viewer_resources.pak',
|
|
||||||
'd3dcompiler_47.dll',
|
'd3dcompiler_47.dll',
|
||||||
'icudtl.dat',
|
'icudtl.dat',
|
||||||
'libEGL.dll',
|
'libEGL.dll',
|
||||||
|
@ -52,7 +52,6 @@ TARGET_BINARIES = {
|
||||||
'linux': [
|
'linux': [
|
||||||
PROJECT_NAME, # 'electron'
|
PROJECT_NAME, # 'electron'
|
||||||
'content_shell.pak',
|
'content_shell.pak',
|
||||||
'pdf_viewer_resources.pak',
|
|
||||||
'icudtl.dat',
|
'icudtl.dat',
|
||||||
'libffmpeg.so',
|
'libffmpeg.so',
|
||||||
'libnode.so',
|
'libnode.so',
|
||||||
|
@ -126,6 +125,10 @@ def copy_binaries():
|
||||||
for binary in TARGET_BINARIES[PLATFORM]:
|
for binary in TARGET_BINARIES[PLATFORM]:
|
||||||
shutil.copy2(os.path.join(OUT_DIR, binary), DIST_DIR)
|
shutil.copy2(os.path.join(OUT_DIR, binary), DIST_DIR)
|
||||||
|
|
||||||
|
if PLATFORM != 'darwin' and PDF_VIEWER_ENABLED:
|
||||||
|
shutil.copy2(os.path.join(OUT_DIR, 'pdf_viewer_resources.pak'),
|
||||||
|
DIST_DIR)
|
||||||
|
|
||||||
for directory in TARGET_DIRECTORIES[PLATFORM]:
|
for directory in TARGET_DIRECTORIES[PLATFORM]:
|
||||||
shutil.copytree(os.path.join(OUT_DIR, directory),
|
shutil.copytree(os.path.join(OUT_DIR, directory),
|
||||||
os.path.join(DIST_DIR, directory),
|
os.path.join(DIST_DIR, directory),
|
||||||
|
@ -255,6 +258,8 @@ def create_dist_zip():
|
||||||
with scoped_cwd(DIST_DIR):
|
with scoped_cwd(DIST_DIR):
|
||||||
files = TARGET_BINARIES[PLATFORM] + TARGET_BINARIES_EXT + ['LICENSE',
|
files = TARGET_BINARIES[PLATFORM] + TARGET_BINARIES_EXT + ['LICENSE',
|
||||||
'LICENSES.chromium.html', 'version']
|
'LICENSES.chromium.html', 'version']
|
||||||
|
if PLATFORM != 'darwin' and PDF_VIEWER_ENABLED:
|
||||||
|
files += ['pdf_viewer_resources.pak']
|
||||||
dirs = TARGET_DIRECTORIES[PLATFORM]
|
dirs = TARGET_DIRECTORIES[PLATFORM]
|
||||||
make_zip(zip_file, files, dirs)
|
make_zip(zip_file, files, dirs)
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,12 @@ def electron_gyp():
|
||||||
obj = eval(f.read());
|
obj = eval(f.read());
|
||||||
return obj['variables']
|
return obj['variables']
|
||||||
|
|
||||||
|
def electron_features():
|
||||||
|
SOURCE_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
|
||||||
|
gyp = os.path.join(SOURCE_ROOT, 'features.gypi')
|
||||||
|
with open(gyp) as f:
|
||||||
|
obj = eval(f.read());
|
||||||
|
return obj['variables']['variables']
|
||||||
|
|
||||||
def get_electron_version():
|
def get_electron_version():
|
||||||
return 'v' + electron_gyp()['version%']
|
return 'v' + electron_gyp()['version%']
|
||||||
|
|
Loading…
Reference in a new issue