Fix win release archive (#11170)
* Fix windows zip release archive * Fix review issues * Reformat repack-archive.py * Fix review issues * Remove root_out_dir * Update BUILD.gn Co-authored-by: Brian Clifton <brian@clifton.me>
This commit is contained in:
@@ -194,12 +194,15 @@ group("create_dist") {
|
||||
deps = []
|
||||
if (is_android) {
|
||||
deps += [ "build/android:sign_app" ]
|
||||
} else if (is_linux) {
|
||||
# zip will be created along with installer
|
||||
deps += [ ":create_symbols_dist" ]
|
||||
} else {
|
||||
deps += [ ":create_symbols_dist" ]
|
||||
}
|
||||
|
||||
# for linux zip will be created along with installer
|
||||
if (!is_linux) {
|
||||
deps += [ ":create_dist_zips" ]
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
deps += [ "build/win:create_signed_installer" ]
|
||||
|
||||
@@ -372,67 +375,79 @@ action("create_symbols_dist") {
|
||||
|
||||
action("create_dist_zips") {
|
||||
output = "$brave_dist_dir/$brave_product_name-v$brave_version-$brave_platform-$target_arch.zip"
|
||||
|
||||
script = "//brave/script/create-dist.py"
|
||||
|
||||
inputs = get_target_outputs(":brave_license_dist_resources")
|
||||
|
||||
if (!is_mac && !is_android && !is_ios) {
|
||||
inputs += get_target_outputs(":brave_dist_resources")
|
||||
inputs += get_target_outputs(":brave_locale_dist_resources")
|
||||
if (enable_extensions) {
|
||||
foreach(locale, locales) {
|
||||
inputs += get_target_outputs(":brave_shields_locales_${locale}")
|
||||
inputs += get_target_outputs(":brave_rewards_locales_${locale}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
inputs += [ "$brave_dist_dir/chrome_elf.dll" ]
|
||||
}
|
||||
|
||||
file_inputs = []
|
||||
foreach(input, inputs) {
|
||||
file_inputs += [ rebase_path(input, brave_dist_dir) ]
|
||||
}
|
||||
|
||||
dir_inputs = []
|
||||
if (is_mac) {
|
||||
dir_inputs += [ "$brave_exe" ]
|
||||
}
|
||||
|
||||
outputs = [ output ]
|
||||
|
||||
deps = [
|
||||
":brave_license_dist_resources",
|
||||
":create_symbols_dist",
|
||||
"app/$current_os:dist_resources",
|
||||
]
|
||||
if (is_win) {
|
||||
# Repack a Chrome release archive to the Brave format.
|
||||
# Besides changing from 7z to zip, the directory structure is a bit different.
|
||||
# TODO(atuchin): support other platforms.
|
||||
|
||||
if (!is_mac && !is_android && !is_ios) {
|
||||
deps += [
|
||||
":brave_dist_resources",
|
||||
":brave_locale_dist_resources",
|
||||
script = "//brave/script/repack-archive.py"
|
||||
deps = [ "//chrome/installer/mini_installer:mini_installer_archive" ]
|
||||
|
||||
input = "$root_out_dir/chrome.7z"
|
||||
inputs = [ input ]
|
||||
|
||||
args = [
|
||||
"--input=" + rebase_path(input),
|
||||
"--output=" + rebase_path(output),
|
||||
"--target_dir=Chrome-bin",
|
||||
]
|
||||
} else { # !is_win
|
||||
script = "//brave/script/create-dist.py"
|
||||
|
||||
inputs = get_target_outputs(":brave_license_dist_resources")
|
||||
|
||||
if (!is_mac && !is_android && !is_ios) {
|
||||
inputs += get_target_outputs(":brave_dist_resources")
|
||||
inputs += get_target_outputs(":brave_locale_dist_resources")
|
||||
if (enable_extensions) {
|
||||
foreach(locale, locales) {
|
||||
inputs += get_target_outputs(":brave_shields_locales_${locale}")
|
||||
inputs += get_target_outputs(":brave_rewards_locales_${locale}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
file_inputs = []
|
||||
foreach(input, inputs) {
|
||||
file_inputs += [ rebase_path(input, brave_dist_dir) ]
|
||||
}
|
||||
|
||||
dir_inputs = []
|
||||
if (is_mac) {
|
||||
dir_inputs += [ "$brave_exe" ]
|
||||
}
|
||||
|
||||
deps = [
|
||||
":brave_license_dist_resources",
|
||||
"app/$current_os:dist_resources",
|
||||
]
|
||||
|
||||
if (enable_extensions) {
|
||||
deps += [ ":brave_extensions_locale_dist_resources" ]
|
||||
}
|
||||
}
|
||||
if (!is_mac && !is_android && !is_ios) {
|
||||
deps += [
|
||||
":brave_dist_resources",
|
||||
":brave_locale_dist_resources",
|
||||
]
|
||||
|
||||
rebase_output = rebase_path(output)
|
||||
if (is_mac) {
|
||||
rebase_base_dir = rebase_path(root_out_dir)
|
||||
} else {
|
||||
rebase_base_dir = rebase_path(brave_dist_dir, root_out_dir)
|
||||
}
|
||||
args = [
|
||||
"--base-dir=$rebase_base_dir",
|
||||
"--inputs=$file_inputs",
|
||||
"--dir-inputs=$dir_inputs",
|
||||
"--output=$rebase_output",
|
||||
]
|
||||
if (enable_extensions) {
|
||||
deps += [ ":brave_extensions_locale_dist_resources" ]
|
||||
}
|
||||
}
|
||||
|
||||
rebase_output = rebase_path(output)
|
||||
if (is_mac) {
|
||||
rebase_base_dir = rebase_path(root_out_dir)
|
||||
} else {
|
||||
rebase_base_dir = rebase_path(brave_dist_dir, root_out_dir)
|
||||
}
|
||||
args = [
|
||||
"--base-dir=$rebase_base_dir",
|
||||
"--inputs=$file_inputs",
|
||||
"--dir-inputs=$dir_inputs",
|
||||
"--output=$rebase_output",
|
||||
]
|
||||
} # !is_win
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
|
||||
@@ -39,7 +39,7 @@ index 732479bbf5975289bd251ab6d41c8dda7e808a50..b85b6ffd7bab57a5da1d6819bccbaab0
|
||||
'with the installer archive {x86|x64}.')
|
||||
parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
|
||||
default=False)
|
||||
+ parser.add_option('--skip_signing', default=False)
|
||||
+ parser.add_option('--skip_signing', action='store_true', default=False)
|
||||
|
||||
options, _ = parser.parse_args()
|
||||
if not options.build_dir:
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
from lib.util import scoped_cwd, make_zip, tempdir
|
||||
|
||||
|
||||
def GetLZMAExec():
|
||||
if sys.platform == 'win32':
|
||||
root_src_dir = os.path.abspath(os.path.join(
|
||||
os.path.dirname(__file__), *[os.pardir] * 2))
|
||||
lzma_exec = os.path.join(root_src_dir, "third_party",
|
||||
"lzma_sdk", "Executable", "7za.exe")
|
||||
else:
|
||||
lzma_exec = '7zr' # Use system 7zr.
|
||||
return lzma_exec
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--output', help='Path to output archive.')
|
||||
parser.add_argument('--input', help='Path to input archive.')
|
||||
parser.add_argument('--target_dir',
|
||||
help='If provided, the paths in the archive will be '
|
||||
'relative to this directory', default='.')
|
||||
args = parser.parse_args()
|
||||
|
||||
temp_dir = tempdir('brave_archive')
|
||||
lzma_exec = GetLZMAExec()
|
||||
cmd = [lzma_exec, 'x', args.input, '-y', '-o' + temp_dir]
|
||||
subprocess.check_call(cmd, stdout=subprocess.PIPE, shell=False)
|
||||
with scoped_cwd(os.path.join(temp_dir, args.target_dir)):
|
||||
make_zip(args.output, [], ['.'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user