Skip to content

Commit

Permalink
Merge pull request #23 from brave/create_dist_2
Browse files Browse the repository at this point in the history
Windows and macOS packaging and signing
  • Loading branch information
bbondy authored Jan 29, 2018
2 parents 64f3a3c + 18d16ff commit 2f9ab52
Show file tree
Hide file tree
Showing 41 changed files with 818 additions and 52 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ node_modules/
*.sln
debug.log
npm-debug.log
*~
21 changes: 20 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@ group("browser_dependencies") {
"//brave/browser",
"common",
":brave_framework_resources",
"chromium_src:browser",
]
}

group("brave") {
public_deps = [
"//chrome",
]
if (is_win) {
deps = [
"build/win:copy_exe",
"build/win:copy_pdb"
]
}
}

repack("packed_extra_resources") {
visibility = [ "./*" ]
sources = [
"$root_gen_dir/components/brave_components_resources.pak",
"$target_gen_dir/browser/resources/brave_extension.pak",
Expand Down Expand Up @@ -71,3 +77,16 @@ if (is_mac) {
public_deps = brave_framework_public_deps
}
}

group("create_dist") {
deps = []
if (is_win) {
deps += [
"//chrome/installer/mini_installer",
"build/win:create_signed_installer"
]
}
if (is_mac) {
deps += [ "build/mac:create_dist_mac" ]
}
}
61 changes: 61 additions & 0 deletions app/brave_exe.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Microsoft Visual C++ generated resource script.
//
#include "../../chrome/app/chrome_exe_resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// The application icon should: have the lowest ID, be placed first, and its
// resource name should be alphabetically less than the name of any other icon
// resource (http://msdn.microsoft.com/en-us/library/ms997538.aspx).
// Note: chrome/installer/util/shell_util.cc depends on the order and number of
// icons. To avoid breaking existing shortcuts, add new icons at the end
// (following the ordering described above).
IDR_MAINFRAME ICON "theme\\brave\\win\\brave.ico"
// These three are no longer used, but remain as placeholders. (They cannot be
// removed, or existing shortcuts to the later resources will break.)
IDR_MAINFRAME_2 ICON "theme\\brave\\win\\placeholder.ico"
IDR_MAINFRAME_3 ICON "theme\\brave\\win\\placeholder.ico"
IDR_MAINFRAME_4 ICON "theme\\brave\\win\\placeholder.ico"
// The SXS icon must have an index of 4, the constant is used in Chrome code to
// identify it.
IDR_SXS ICON "theme\\brave\\win\\brave_sxs.ico"

// Start a naming scheme to keep icons in order. A leading X is used to keep
// the name alphabetically after IDR_SXS. The maximum of the number that follows
// should be incremented when a new icon is added. The icon indices in
// chrome_icon_resources_win.h should also be updated.

IDR_X001_APP_LIST ICON "theme\\brave\\win\\app_list.ico"
IDR_X002_APP_LIST_SXS ICON "theme\\brave\\win\\app_list_sxs.ico"
IDR_X003_INCOGNITO ICON "theme\\brave\\win\\incognito.ico"
IDR_X004_DEV ICON "theme\\brave\\win\\brave_dev.ico"
IDR_X005_BETA ICON "theme\\brave\\win\\brave_beta.ico"


#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
2 changes: 2 additions & 0 deletions app/brave_exe.ver
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INTERNAL_NAME=brave_exe
ORIGINAL_FILENAME=brave.exe
Binary file added app/theme/brave/win/app_list_sxs.ico
Binary file not shown.
Binary file added app/theme/brave/win/brave_beta.ico
Binary file not shown.
Binary file added app/theme/brave/win/brave_dev.ico
Binary file not shown.
Binary file added app/theme/brave/win/brave_sxs.ico
Binary file not shown.
Binary file added app/theme/brave/win/placeholder.ico
Binary file not shown.
Binary file modified app/theme/brave/win/tiles/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/theme/brave/win/tiles/SmallLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ source_set("browser_process") {
]

deps = [
"//content/public/browser"
"//content/public/browser",
"//brave/chromium_src:browser",
]
}

Expand Down
8 changes: 8 additions & 0 deletions build/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changing these will cause a full rebuild
antimuon_include_dirs_ = [
"//brave/chromium_src",
]

config("antimuon_include_dirs") {
include_dirs = antimuon_include_dirs_
}
31 changes: 31 additions & 0 deletions build/mac/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
declare_args() {
mac_signing_identifier = ""
}

action("create_dist_mac") {
output = "$root_out_dir/Brave.dmg"
script = "//build/gn_run_binary.py"
shell_script = "//chrome/installer/mac/pkg-dmg"
inputs = [
script,
shell_script,
]
outputs = [ output ]
args = [
rebase_path(shell_script, root_build_dir),
"--source",
"/var/empty",
"--target",
"Brave.dmg",
"--format",
"UDBZ",
"--verbosity",
"0",
"--volname",
"Brave",
"--copy",
"Brave.app",
"--tempdir",
"/tmp",
]
}
45 changes: 45 additions & 0 deletions build/win/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
copy("copy_exe") {
sources = [
"$root_out_dir/chrome.exe",
]

outputs = [
"$root_out_dir/brave.exe",
]

deps = [
"//chrome:reorder_imports"
]
}

copy("copy_pdb") {
sources = [
"$root_out_dir/chrome.exe.pdb",
]

outputs = [
"$root_out_dir/brave.exe.pdb",
]

deps = [
"//chrome:reorder_imports"
]
}


action("create_signed_installer") {
script = "//brave/script/create-signed-installer.py"
inputs = [
"$root_out_dir/mini_installer.exe"
]
outputs = [
"$root_out_dir/brave_installer.exe",
]
out_dir = rebase_path(root_out_dir, "//")
args = [
"--root_out_dir=$out_dir"
]
deps = [
"//chrome/installer/mini_installer"
]
}
15 changes: 15 additions & 0 deletions chromium_src/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
source_set("browser") {
sources = []
if (is_win) {
sources += [
"chrome/install_static/chromium_install_modes.cc",
"chrome/install_static/chromium_install_modes.h",
]
}
}
source_set("common") {
sources = []
}
source_set("renderer") {
sources = []
}
42 changes: 42 additions & 0 deletions chromium_src/chrome/common/chrome_icon_resources_win.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef CHROME_COMMON_CHROME_ICON_RESOURCES_WIN_H_
#define CHROME_COMMON_CHROME_ICON_RESOURCES_WIN_H_

namespace icon_resources {

// This file contains the indices of icon resources in chrome_exe.rc.

enum {
// The main application icon is always index 0.
kApplicationIndex = 0,

// Legacy indices that are no longer used.
kApplication2Index = 1,
kApplication3Index = 2,
kApplication4Index = 3,

// The Chrome Canary application icon.
kSxSApplicationIndex = 4,

// The Chrome App Launcher icon.
kAppLauncherIndex = 5,

// The Chrome App Launcher Canary icon.
kSxSAppLauncherIndex = 6,

// The Chrome incognito icon.
kIncognitoIndex = 7,

// The Chrome Dev application icon.
kDevApplicationIndex = 8,

// The Chrome Beta application icon.
kBetaApplicationIndex = 9,
};

} // namespace icon_resources

#endif // CHROME_COMMON_CHROME_ICON_RESOURCES_WIN_H_
124 changes: 124 additions & 0 deletions chromium_src/chrome/install_static/chromium_install_modes.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

// Brand-specific constants and install modes for Brave.

#include <stdlib.h>

#include "chrome/common/chrome_icon_resources_win.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/install_static/install_modes.h"

namespace install_static {

const wchar_t kCompanyPathName[] = L"BraveSoftware";

const wchar_t kProductPathName[] = L"Brave";

const size_t kProductPathNameLength = _countof(kProductPathName) - 1;

const wchar_t kBinariesAppGuid[] = L"{F7526127-0B8A-406F-8998-282BEA40103A}";

// Brave integrates with Brave Update, so the app GUID above is used.
const wchar_t kBinariesPathName[] = L"";

const InstallConstants kInstallModes[] = {
// The primary install mode for stable Brave.
{
sizeof(kInstallModes[0]),
STABLE_INDEX, // The first mode is for stable/beta/dev.
"", // No install switch for the primary install mode.
L"", // Empty install_suffix for the primary install mode.
L"", // No logo suffix for the primary install mode.
L"{AFE6A462-C574-4B8A-AF43-4CC60DF4563B}",
L"Brave", // A distinct base_app_name.
L"Brave", // A distinct base_app_id.
L"BraveHTML", // ProgID prefix.
L"Brave HTML Document", // ProgID description.
L"{AFE6A462-C574-4B8A-AF43-4CC60DF4563B}", // Active Setup GUID.
L"{B1C5AAC5-2B7C-4C9D-9E96-774C53151B20}", // CommandExecuteImpl CLSID.
L"", // The empty string means "stable".
ChannelStrategy::ADDITIONAL_PARAMETERS,
true, // Supports system-level installs.
true, // Supports in-product set as default browser UX.
true, // Supports retention experiments.
true, // Supported multi-install.
icon_resources::kApplicationIndex, // App icon resource index.
IDR_MAINFRAME, // App icon resource id.
},
// A secondary install mode for Brave Beta
{
sizeof(kInstallModes[0]),
BETA_INDEX, // The mode for the side-by-side beta channel.
"brave-beta", // Install switch.
L" Beta", // Install suffix.
L"Beta", // Logo suffix.
L"{103BD053-949B-43A8-9120-2E424887DE11}", // A distinct app GUID.
L"Brave Beta", // A distinct base_app_name.
L"BraveBeta", // A distinct base_app_id.
L"BraveHTML", // ProgID prefix.
L"Brave Beta HTML Document", // ProgID description.
L"{103BD053-949B-43A8-9120-2E424887DE11}", // Active Setup GUID.
L"", // CommandExecuteImpl CLSID.
L"beta", // Forced channel name.
ChannelStrategy::FIXED,
true, // Supports system-level installs.
true, // Supports in-product set as default browser UX.
true, // Supports retention experiments.
false, // Did not support multi-install.
icon_resources::kBetaApplicationIndex, // App icon resource index.
IDR_X005_BETA, // App icon resource id.
},
// A secondary install mode for Brave Dev
{
sizeof(kInstallModes[0]),
DEV_INDEX, // The mode for the side-by-side dev channel.
"brave-dev", // Install switch.
L" Dev", // Install suffix.
L"Dev", // Logo suffix.
L"{CB2150F2-595F-4633-891A-E39720CE0531}", // A distinct app GUID.
L"Brave Dev", // A distinct base_app_name.
L"BraveDev", // A distinct base_app_id.
L"BraveDHTML", // ProgID prefix.
L"Brave Dev HTML Document", // ProgID description.
L"{CB2150F2-595F-4633-891A-E39720CE0531}", // Active Setup GUID.
L"", // CommandExecuteImpl CLSID.
L"dev", // Forced channel name.
ChannelStrategy::FIXED,
true, // Supports system-level installs.
true, // Supports in-product set as default browser UX.
true, // Supports retention experiments.
false, // Did not support multi-install.
icon_resources::kDevApplicationIndex, // App icon resource index.
IDR_X004_DEV, // App icon resource id.
},
// A secondary install mode for Brave SxS (canary).
{
sizeof(kInstallModes[0]),
CANARY_INDEX, // The mode for the side-by-side canary channel.
"brave-sxs", // Install switch.
L" SxS", // Install suffix.
L"Canary", // Logo suffix.
L"{C6CB981E-DB30-4876-8639-109F8933582C}", // A distinct app GUID.
L"Brave Canary", // A distinct base_app_name.
L"BraveCanary", // A distinct base_app_id.
L"BraveSSHTM", // ProgID prefix.
L"Brave Canary HTML Document", // ProgID description.
L"{C6CB981E-DB30-4876-8639-109F8933582C}", // Active Setup GUID.
L"{312ABB99-A176-4939-A39F-E8D34EA4D393}", // CommandExecuteImpl CLSID.
L"canary", // Forced channel name.
ChannelStrategy::FIXED,
false, // Does not support system-level installs.
false, // Does not support in-product set as default browser UX.
true, // Supports retention experiments.
false, // Did not support multi-install.
icon_resources::kSxSApplicationIndex, // App icon resource index.
IDR_SXS, // App icon resource id.
},
};

static_assert(_countof(kInstallModes) == NUM_INSTALL_MODES,
"Imbalance between kInstallModes and InstallConstantIndex");

} // namespace install_static
Loading

0 comments on commit 2f9ab52

Please sign in to comment.