Add support for a minimal distribution mode where only release binaries and resources are packaged.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1197 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-04-10 21:02:37 +00:00
parent 006ac136a8
commit e65fcf9710
2 changed files with 212 additions and 173 deletions

View File

@ -120,7 +120,13 @@ parser.add_option('--no-release-build',
help="don't perform the CEF release build") help="don't perform the CEF release build")
parser.add_option('--no-distrib', parser.add_option('--no-distrib',
action='store_true', dest='nodistrib', default=False, action='store_true', dest='nodistrib', default=False,
help="don't create the CEF binary distribution") help="don't create any CEF binary distribution")
parser.add_option('--minimal-distrib',
action='store_true', dest='minimaldistrib', default=False,
help='create a minimal CEF binary distribution')
parser.add_option('--minimal-distrib-only',
action='store_true', dest='minimaldistribonly', default=False,
help='create a minimal CEF binary distribution only')
parser.add_option('--ninja-build', parser.add_option('--ninja-build',
action='store_true', dest='ninjabuild', default=False, action='store_true', dest='ninjabuild', default=False,
help="build using ninja") help="build using ninja")
@ -134,6 +140,11 @@ if options.downloaddir is None:
parser.print_help(sys.stderr) parser.print_help(sys.stderr)
sys.exit() sys.exit()
if options.noreleasebuild and (options.minimaldistrib or options.minimaldistribonly):
print 'Invalid combination of options'
parser.print_help(sys.stderr)
sys.exit()
# script directory # script directory
script_dir = os.path.dirname(__file__) script_dir = os.path.dirname(__file__)
@ -412,10 +423,23 @@ if any_changed or options.forcebuild:
# make CEF Release build # make CEF Release build
run(path+' Release', cef_tools_dir, depot_tools_dir) run(path+' Release', cef_tools_dir, depot_tools_dir)
if any_changed or options.forcedistrib: if (any_changed or options.forcedistrib) and not options.nodistrib:
if not options.nodistrib: # make a CEF binary distribution
# make CEF binary distribution make_minimal = options.minimaldistrib or options.minimaldistribonly
path = os.path.join(cef_tools_dir, 'make_distrib'+script_ext) path = os.path.join(cef_tools_dir, 'make_distrib'+script_ext)
if options.ninjabuild: if options.ninjabuild:
path = path + ' --ninja-build' path = path + ' --ninja-build'
if options.nodebugbuild or options.noreleasebuild or make_minimal:
path = path + ' --allow-partial'
if not options.minimaldistribonly:
# create the full distribution
run(path, cef_tools_dir, depot_tools_dir)
if make_minimal:
# create the minimial distribution
path = path + ' --minimal'
if not options.minimaldistribonly:
# don't create the symbol archive twice
path = path + ' --no-symbols'
run(path, cef_tools_dir, depot_tools_dir) run(path, cef_tools_dir, depot_tools_dir)

View File

@ -169,6 +169,9 @@ parser.add_option('--no-symbols',
parser.add_option('--ninja-build', parser.add_option('--ninja-build',
action='store_true', dest='ninjabuild', default=False, action='store_true', dest='ninjabuild', default=False,
help='build was created using ninja') help='build was created using ninja')
parser.add_option('--minimal',
action='store_true', dest='minimal', default=False,
help='include only release build binary files')
parser.add_option('-q', '--quiet', parser.add_option('-q', '--quiet',
action='store_true', dest='quiet', default=False, action='store_true', dest='quiet', default=False,
help='do not output detailed status information') help='do not output detailed status information')
@ -215,15 +218,17 @@ elif sys.platform.startswith('linux'):
platform = 'linux' platform = 'linux'
# output directory # output directory
output_dir = os.path.abspath(os.path.join(options.outputdir, \ output_dir_name = 'cef_binary_'+cef_ver+'_'+platform
'cef_binary_'+cef_ver+'_'+platform)) if options.minimal:
output_dir_name = output_dir_name + '_minimal'
output_dir = os.path.abspath(os.path.join(options.outputdir, output_dir_name))
remove_dir(output_dir, options.quiet) remove_dir(output_dir, options.quiet)
make_dir(output_dir, options.quiet) make_dir(output_dir, options.quiet)
if not options.nosymbols: if not options.nosymbols:
# symbol directory # symbol directory
symbol_dir = os.path.abspath(os.path.join(options.outputdir, \ symbol_dir_name = output_dir_name + '_symbols'
'cef_binary_'+cef_ver+'_'+platform+'_symbols')) symbol_dir = os.path.abspath(os.path.join(options.outputdir, symbol_dir_name))
remove_dir(symbol_dir, options.quiet) remove_dir(symbol_dir, options.quiet)
make_dir(symbol_dir, options.quiet) make_dir(symbol_dir, options.quiet)
@ -238,53 +243,54 @@ cef_paths = cef_paths['variables']
cef_paths2 = eval_file(os.path.join(cef_dir, 'cef_paths2.gypi')) cef_paths2 = eval_file(os.path.join(cef_dir, 'cef_paths2.gypi'))
cef_paths2 = cef_paths2['variables'] cef_paths2 = cef_paths2['variables']
# create the include directory if not options.minimal:
include_dir = os.path.join(output_dir, 'include') # create the include directory
make_dir(include_dir, options.quiet) include_dir = os.path.join(output_dir, 'include')
make_dir(include_dir, options.quiet)
# create the cefclient directory # create the cefclient directory
cefclient_dir = os.path.join(output_dir, 'cefclient') cefclient_dir = os.path.join(output_dir, 'cefclient')
make_dir(cefclient_dir, options.quiet) make_dir(cefclient_dir, options.quiet)
# create the libcef_dll_wrapper directory # create the libcef_dll_wrapper directory
wrapper_dir = os.path.join(output_dir, 'libcef_dll') wrapper_dir = os.path.join(output_dir, 'libcef_dll')
make_dir(wrapper_dir, options.quiet) make_dir(wrapper_dir, options.quiet)
# transfer common include files # transfer common include files
transfer_gypi_files(cef_dir, cef_paths2['includes_common'], \ transfer_gypi_files(cef_dir, cef_paths2['includes_common'], \
'include/', include_dir, options.quiet) 'include/', include_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths2['includes_capi'], \ transfer_gypi_files(cef_dir, cef_paths2['includes_capi'], \
'include/', include_dir, options.quiet) 'include/', include_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths2['includes_wrapper'], \ transfer_gypi_files(cef_dir, cef_paths2['includes_wrapper'], \
'include/', include_dir, options.quiet) 'include/', include_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths['autogen_cpp_includes'], \ transfer_gypi_files(cef_dir, cef_paths['autogen_cpp_includes'], \
'include/', include_dir, options.quiet) 'include/', include_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths['autogen_capi_includes'], \ transfer_gypi_files(cef_dir, cef_paths['autogen_capi_includes'], \
'include/', include_dir, options.quiet) 'include/', include_dir, options.quiet)
# transfer common cefclient files # transfer common cefclient files
transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_common'], \ transfer_gypi_files(cef_dir, cef_paths2['cefclient_sources_common'], \
'tests/cefclient/', cefclient_dir, options.quiet) 'tests/cefclient/', cefclient_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths2['cefclient_bundle_resources_common'], \ transfer_gypi_files(cef_dir, cef_paths2['cefclient_bundle_resources_common'], \
'tests/cefclient/', cefclient_dir, options.quiet) 'tests/cefclient/', cefclient_dir, options.quiet)
# transfer common libcef_dll_wrapper files # transfer common libcef_dll_wrapper files
transfer_gypi_files(cef_dir, cef_paths2['libcef_dll_wrapper_sources_common'], \ transfer_gypi_files(cef_dir, cef_paths2['libcef_dll_wrapper_sources_common'], \
'libcef_dll/', wrapper_dir, options.quiet) 'libcef_dll/', wrapper_dir, options.quiet)
transfer_gypi_files(cef_dir, cef_paths['autogen_client_side'], \ transfer_gypi_files(cef_dir, cef_paths['autogen_client_side'], \
'libcef_dll/', wrapper_dir, options.quiet) 'libcef_dll/', wrapper_dir, options.quiet)
# transfer gyp files # transfer gyp files
copy_file(os.path.join(script_dir, 'distrib/cefclient.gyp'), output_dir, options.quiet) copy_file(os.path.join(script_dir, 'distrib/cefclient.gyp'), output_dir, options.quiet)
paths_gypi = os.path.join(cef_dir, 'cef_paths2.gypi') paths_gypi = os.path.join(cef_dir, 'cef_paths2.gypi')
data = read_file(paths_gypi) data = read_file(paths_gypi)
data = data.replace('tests/cefclient/', 'cefclient/') data = data.replace('tests/cefclient/', 'cefclient/')
write_file(os.path.join(output_dir, 'cef_paths2.gypi'), data) write_file(os.path.join(output_dir, 'cef_paths2.gypi'), data)
copy_file(os.path.join(cef_dir, 'cef_paths.gypi'), \ copy_file(os.path.join(cef_dir, 'cef_paths.gypi'), \
os.path.join(output_dir, 'cef_paths.gypi'), options.quiet) os.path.join(output_dir, 'cef_paths.gypi'), options.quiet)
# transfer additional files # transfer additional files
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/transfer.cfg'), \ transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/transfer.cfg'), \
output_dir, options.quiet) output_dir, options.quiet)
if platform == 'windows': if platform == 'windows':
@ -292,6 +298,7 @@ if platform == 'windows':
create_readme(os.path.join(script_dir, 'distrib/win/README.txt'), output_dir, cef_url, \ create_readme(os.path.join(script_dir, 'distrib/win/README.txt'), output_dir, cef_url, \
cef_rev, cef_ver, chromium_url, chromium_rev, chromium_ver, date) cef_rev, cef_ver, chromium_url, chromium_rev, chromium_ver, date)
if not options.minimal:
# transfer include files # transfer include files
transfer_gypi_files(cef_dir, cef_paths2['includes_win'], \ transfer_gypi_files(cef_dir, cef_paths2['includes_win'], \
'include/', include_dir, options.quiet) 'include/', include_dir, options.quiet)
@ -307,6 +314,7 @@ if platform == 'windows':
out_dir = os.path.join(src_dir, 'build') out_dir = os.path.join(src_dir, 'build')
libcef_dll_file = 'lib/libcef.lib' libcef_dll_file = 'lib/libcef.lib'
if not options.minimal:
# transfer build/Debug files # transfer build/Debug files
build_dir = os.path.join(out_dir, 'Debug'); build_dir = os.path.join(out_dir, 'Debug');
if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.exe')): if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.exe')):
@ -335,6 +343,7 @@ if platform == 'windows':
make_dir(dst_dir, options.quiet) make_dir(dst_dir, options.quiet)
copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet) copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
copy_files(os.path.join(build_dir, '*.dll'), dst_dir, options.quiet) copy_files(os.path.join(build_dir, '*.dll'), dst_dir, options.quiet)
if not options.minimal:
copy_file(os.path.join(build_dir, 'cefclient.exe'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'cefclient.exe'), dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'cef.pak'), dst_dir, options.quiet)
copy_file(os.path.join(build_dir, 'devtools_resources.pak'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'devtools_resources.pak'), dst_dir, options.quiet)
@ -353,6 +362,7 @@ if platform == 'windows':
else: else:
sys.stderr.write("No Release build files.\n") sys.stderr.write("No Release build files.\n")
if not options.minimal:
# generate doc files # generate doc files
os.popen('make_cppdocs.bat '+cef_rev) os.popen('make_cppdocs.bat '+cef_rev)
@ -377,6 +387,7 @@ elif platform == 'macosx':
create_readme(os.path.join(script_dir, 'distrib/mac/README.txt'), output_dir, cef_url, \ create_readme(os.path.join(script_dir, 'distrib/mac/README.txt'), output_dir, cef_url, \
cef_rev, cef_ver, chromium_url, chromium_rev, chromium_ver, date) cef_rev, cef_ver, chromium_url, chromium_rev, chromium_ver, date)
if not options.minimal:
# transfer include files # transfer include files
transfer_gypi_files(cef_dir, cef_paths2['includes_mac'], \ transfer_gypi_files(cef_dir, cef_paths2['includes_mac'], \
'include/', include_dir, options.quiet) 'include/', include_dir, options.quiet)
@ -398,6 +409,7 @@ elif platform == 'macosx':
valid_build_dir = None valid_build_dir = None
if not options.minimal:
# transfer xcodebuild/Debug files # transfer xcodebuild/Debug files
build_dir = os.path.join(out_dir, 'Debug') build_dir = os.path.join(out_dir, 'Debug')
if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.app')): if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient.app')):
@ -433,6 +445,7 @@ elif platform == 'macosx':
copy_files(os.path.join(build_dir, 'cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/*.*'), \ copy_files(os.path.join(build_dir, 'cefclient.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/*.*'), \
dst_dir, options.quiet) dst_dir, options.quiet)
if not options.minimal:
# transfer additional files, if any # transfer additional files, if any
transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/mac/transfer.cfg'), \ transfer_files(cef_dir, script_dir, os.path.join(script_dir, 'distrib/mac/transfer.cfg'), \
output_dir, options.quiet) output_dir, options.quiet)
@ -464,6 +477,7 @@ elif platform == 'linux':
valid_build_dir = None valid_build_dir = None
if not options.minimal:
# transfer out/Debug files # transfer out/Debug files
build_dir = os.path.join(out_dir, 'Debug'); build_dir = os.path.join(out_dir, 'Debug');
if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient')): if not options.allowpartial or path_exists(os.path.join(build_dir, 'cefclient')):
@ -493,6 +507,7 @@ elif platform == 'linux':
copy_file(os.path.join(build_dir, 'devtools_resources.pak'), dst_dir, options.quiet) copy_file(os.path.join(build_dir, 'devtools_resources.pak'), dst_dir, options.quiet)
copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet) copy_dir(os.path.join(build_dir, 'locales'), os.path.join(dst_dir, 'locales'), options.quiet)
if not options.minimal:
# transfer include files # transfer include files
transfer_gypi_files(cef_dir, cef_paths2['includes_linux'], \ transfer_gypi_files(cef_dir, cef_paths2['includes_linux'], \
'include/', include_dir, options.quiet) 'include/', include_dir, options.quiet)
@ -533,14 +548,14 @@ elif platform == 'linux':
fix_make_projects() fix_make_projects()
# Create an archive of the output directory # Create an archive of the output directory
zip_file = os.path.split(output_dir)[1] + '.zip' zip_file = output_dir_name + '.zip'
if not options.quiet: if not options.quiet:
sys.stdout.write('Creating '+zip_file+"...\n") sys.stdout.write('Creating '+zip_file+"...\n")
create_archive(output_dir, os.path.join(output_dir, os.pardir, zip_file)) create_archive(output_dir, os.path.join(output_dir, os.pardir, zip_file))
if not options.nosymbols: if not options.nosymbols:
# Create an archive of the symbol directory # Create an archive of the symbol directory
zip_file = os.path.split(symbol_dir)[1] + '.zip' zip_file = symbol_dir_name + '.zip'
if not options.quiet: if not options.quiet:
sys.stdout.write('Creating '+zip_file+"...\n") sys.stdout.write('Creating '+zip_file+"...\n")
create_archive(symbol_dir, os.path.join(symbol_dir, os.pardir, zip_file)) create_archive(symbol_dir, os.path.join(symbol_dir, os.pardir, zip_file))