зеркало из https://github.com/electron/electron.git
refactor: replace atom_version and friends with electron_version (#18847)
This commit is contained in:
Родитель
c9bca78a7a
Коммит
4dc38d39e9
4
BUILD.gn
4
BUILD.gn
|
@ -51,8 +51,8 @@ if (is_mas_build) {
|
|||
|
||||
config("branding") {
|
||||
defines = [
|
||||
"ATOM_PRODUCT_NAME=\"$electron_product_name\"",
|
||||
"ATOM_PROJECT_NAME=\"$electron_project_name\"",
|
||||
"ELECTRON_PRODUCT_NAME=\"$electron_product_name\"",
|
||||
"ELECTRON_PROJECT_NAME=\"$electron_project_name\"",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ int AtomInitializeICUandStartNode(int argc, char* argv[]) {
|
|||
atom::MainApplicationBundlePath()
|
||||
.Append("Contents")
|
||||
.Append("Frameworks")
|
||||
.Append(ATOM_PRODUCT_NAME " Framework.framework"));
|
||||
.Append(ELECTRON_PRODUCT_NAME " Framework.framework"));
|
||||
base::i18n::InitializeICU();
|
||||
return atom::NodeMain(argc, argv);
|
||||
}
|
||||
|
|
|
@ -38,13 +38,13 @@ base::FilePath GetHelperAppPath(const base::FilePath& frameworks_path,
|
|||
|
||||
void AtomMainDelegate::OverrideFrameworkBundlePath() {
|
||||
base::mac::SetOverrideFrameworkBundlePath(
|
||||
GetFrameworksPath().Append(ATOM_PRODUCT_NAME " Framework.framework"));
|
||||
GetFrameworksPath().Append(ELECTRON_PRODUCT_NAME " Framework.framework"));
|
||||
}
|
||||
|
||||
void AtomMainDelegate::OverrideChildProcessPath() {
|
||||
base::FilePath frameworks_path = GetFrameworksPath();
|
||||
base::FilePath helper_path =
|
||||
GetHelperAppPath(frameworks_path, ATOM_PRODUCT_NAME);
|
||||
GetHelperAppPath(frameworks_path, ELECTRON_PRODUCT_NAME);
|
||||
if (!base::PathExists(helper_path))
|
||||
helper_path = GetHelperAppPath(frameworks_path, GetApplicationName());
|
||||
if (!base::PathExists(helper_path))
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include "atom/browser/javascript_environment.h"
|
||||
#include "atom/browser/node_debugger.h"
|
||||
#include "atom/common/api/electron_bindings.h"
|
||||
#include "atom/common/atom_version.h"
|
||||
#include "atom/common/crash_reporter/crash_reporter.h"
|
||||
#include "atom/common/electron_version.h"
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
#include "atom/common/node_bindings.h"
|
||||
#include "atom/common/node_includes.h"
|
||||
|
@ -88,7 +88,7 @@ int NodeMain(int argc, char* argv[]) {
|
|||
|
||||
mate::Dictionary versions;
|
||||
if (process.Get("versions", &versions)) {
|
||||
versions.SetReadOnly(ATOM_PROJECT_NAME, ATOM_VERSION_STRING);
|
||||
versions.SetReadOnly(ELECTRON_PROJECT_NAME, ELECTRON_VERSION_STRING);
|
||||
}
|
||||
|
||||
node::LoadEnvironment(env);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "atom/browser/atom_browser_context.h"
|
||||
#include "atom/browser/net/system_network_context_manager.h"
|
||||
#include "atom/common/atom_version.h"
|
||||
#include "atom/common/electron_version.h"
|
||||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/node_includes.h"
|
||||
|
@ -77,7 +77,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(mate::Arguments* args) {
|
|||
|
||||
auto command_line_string =
|
||||
base::CommandLine::ForCurrentProcess()->GetCommandLineString();
|
||||
auto channel_string = std::string("Electron " ATOM_VERSION);
|
||||
auto channel_string = std::string("Electron " ELECTRON_VERSION);
|
||||
base::Value custom_constants = base::Value::FromUniquePtrValue(
|
||||
net_log::ChromeNetLog::GetPlatformConstants(command_line_string,
|
||||
channel_string));
|
||||
|
|
|
@ -96,7 +96,7 @@ device::mojom::WakeLock* PowerSaveBlocker::GetWakeLock() {
|
|||
|
||||
wake_lock_provider->GetWakeLockWithoutContext(
|
||||
device::mojom::WakeLockType::kPreventAppSuspension,
|
||||
device::mojom::WakeLockReason::kOther, ATOM_PRODUCT_NAME,
|
||||
device::mojom::WakeLockReason::kOther, ELECTRON_PRODUCT_NAME,
|
||||
mojo::MakeRequest(&wake_lock_));
|
||||
}
|
||||
return wake_lock_.get();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "atom/browser/native_window.h"
|
||||
#include "atom/browser/window_list.h"
|
||||
#include "atom/common/application_info.h"
|
||||
#include "atom/common/atom_version.h"
|
||||
#include "atom/common/electron_version.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/process/launch.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "atom/browser/ui/win/jump_list.h"
|
||||
#include "atom/common/application_info.h"
|
||||
#include "atom/common/atom_version.h"
|
||||
#include "atom/common/electron_version.h"
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
#include "base/base_paths.h"
|
||||
#include "base/file_version_info.h"
|
||||
|
@ -338,7 +338,7 @@ std::string Browser::GetExecutableFileVersion() const {
|
|||
return base::UTF16ToUTF8(version_info->product_version());
|
||||
}
|
||||
|
||||
return ATOM_VERSION_STRING;
|
||||
return ELECTRON_VERSION_STRING;
|
||||
}
|
||||
|
||||
std::string Browser::GetExecutableFileProductName() const {
|
||||
|
|
|
@ -71,7 +71,7 @@ struct RunState {
|
|||
|
||||
bool CreateDialogThread(RunState* run_state) {
|
||||
auto thread =
|
||||
std::make_unique<base::Thread>(ATOM_PRODUCT_NAME "FileDialogThread");
|
||||
std::make_unique<base::Thread>(ELECTRON_PRODUCT_NAME "FileDialogThread");
|
||||
thread->init_com_with_mta(false);
|
||||
if (!thread->Start())
|
||||
return false;
|
||||
|
|
|
@ -226,7 +226,7 @@ int ShowMessageBoxSync(const MessageBoxSettings& settings) {
|
|||
void ShowMessageBox(const MessageBoxSettings& settings,
|
||||
MessageBoxCallback callback) {
|
||||
auto thread =
|
||||
std::make_unique<base::Thread>(ATOM_PRODUCT_NAME "MessageBoxThread");
|
||||
std::make_unique<base::Thread>(ELECTRON_PRODUCT_NAME "MessageBoxThread");
|
||||
thread->init_com_with_mta(false);
|
||||
if (!thread->Start()) {
|
||||
std::move(callback).Run(settings.cancel_id, settings.checkbox_checked);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "atom/browser/browser.h"
|
||||
#include "atom/common/api/locker.h"
|
||||
#include "atom/common/application_info.h"
|
||||
#include "atom/common/atom_version.h"
|
||||
#include "atom/common/electron_version.h"
|
||||
#include "atom/common/heap_snapshot.h"
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
|
@ -106,7 +106,7 @@ void ElectronBindings::BindTo(v8::Isolate* isolate,
|
|||
|
||||
mate::Dictionary versions;
|
||||
if (dict.Get("versions", &versions)) {
|
||||
versions.SetReadOnly(ATOM_PROJECT_NAME, ATOM_VERSION_STRING);
|
||||
versions.SetReadOnly(ELECTRON_PROJECT_NAME, ELECTRON_VERSION_STRING);
|
||||
versions.SetReadOnly("chrome", CHROME_VERSION_STRING);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "atom/common/application_info.h"
|
||||
|
||||
#include "atom/browser/browser.h"
|
||||
#include "atom/common/atom_version.h"
|
||||
#include "atom/common/electron_version.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "chrome/common/chrome_version.h"
|
||||
|
@ -42,12 +42,12 @@ std::string GetApplicationUserAgent() {
|
|||
std::string name, user_agent;
|
||||
if (!base::RemoveChars(browser->GetName(), " ", &name))
|
||||
name = browser->GetName();
|
||||
if (name == ATOM_PRODUCT_NAME) {
|
||||
user_agent = "Chrome/" CHROME_VERSION_STRING " " ATOM_PRODUCT_NAME
|
||||
"/" ATOM_VERSION_STRING;
|
||||
if (name == ELECTRON_PRODUCT_NAME) {
|
||||
user_agent = "Chrome/" CHROME_VERSION_STRING " " ELECTRON_PRODUCT_NAME
|
||||
"/" ELECTRON_VERSION_STRING;
|
||||
} else {
|
||||
user_agent = base::StringPrintf(
|
||||
"%s/%s Chrome/%s " ATOM_PRODUCT_NAME "/" ATOM_VERSION_STRING,
|
||||
"%s/%s Chrome/%s " ELECTRON_PRODUCT_NAME "/" ELECTRON_VERSION_STRING,
|
||||
name.c_str(), browser->GetVersion().c_str(), CHROME_VERSION_STRING);
|
||||
}
|
||||
return content::BuildUserAgentFromProduct(user_agent);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "atom/common/atom_version.h"
|
||||
#include "atom/common/electron_version.h"
|
||||
#include "atom/common/platform_util.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/logging.h"
|
||||
|
@ -50,7 +50,7 @@ std::string GetApplicationName() {
|
|||
|
||||
// attempt #3: Electron's name
|
||||
if (ret.empty()) {
|
||||
ret = ATOM_PRODUCT_NAME;
|
||||
ret = ELECTRON_PRODUCT_NAME;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -59,9 +59,9 @@ std::string GetApplicationName() {
|
|||
std::string GetApplicationVersion() {
|
||||
std::string ret;
|
||||
|
||||
// ensure ATOM_PRODUCT_NAME and ATOM_PRODUCT_STRING match up
|
||||
if (GetApplicationName() == ATOM_PRODUCT_NAME)
|
||||
ret = ATOM_VERSION_STRING;
|
||||
// ensure ELECTRON_PRODUCT_NAME and GetApplicationVersion match up
|
||||
if (GetApplicationName() == ELECTRON_PRODUCT_NAME)
|
||||
ret = ELECTRON_VERSION_STRING;
|
||||
|
||||
// try to use the string set in app.setVersion()
|
||||
if (ret.empty())
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (c) 2013 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_COMMON_ATOM_VERSION_H_
|
||||
#define ATOM_COMMON_ATOM_VERSION_H_
|
||||
|
||||
#define ATOM_MAJOR_VERSION 7
|
||||
#define ATOM_MINOR_VERSION 0
|
||||
#define ATOM_PATCH_VERSION 0
|
||||
// clang-format off
|
||||
#define ATOM_PRE_RELEASE_VERSION -nightly.20190616
|
||||
// clang-format on
|
||||
|
||||
#ifndef ATOM_STRINGIFY
|
||||
#define ATOM_STRINGIFY(n) ATOM_STRINGIFY_HELPER(n)
|
||||
#define ATOM_STRINGIFY_HELPER(n) #n
|
||||
#endif
|
||||
|
||||
#ifndef ATOM_PRE_RELEASE_VERSION
|
||||
#define ATOM_VERSION_STRING \
|
||||
ATOM_STRINGIFY(ATOM_MAJOR_VERSION) \
|
||||
"." ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." ATOM_STRINGIFY(ATOM_PATCH_VERSION)
|
||||
#else
|
||||
#define ATOM_VERSION_STRING \
|
||||
ATOM_STRINGIFY(ATOM_MAJOR_VERSION) \
|
||||
"." ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." ATOM_STRINGIFY( \
|
||||
ATOM_PATCH_VERSION) ATOM_STRINGIFY(ATOM_PRE_RELEASE_VERSION)
|
||||
#endif
|
||||
|
||||
#define ATOM_VERSION "v" ATOM_VERSION_STRING
|
||||
|
||||
#endif // ATOM_COMMON_ATOM_VERSION_H_
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "atom/browser/browser.h"
|
||||
#include "atom/common/atom_constants.h"
|
||||
#include "atom/common/atom_version.h"
|
||||
#include "atom/common/electron_version.h"
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/native_mate_converters/map_converter.h"
|
||||
#include "base/command_line.h"
|
||||
|
@ -59,8 +59,8 @@ void CrashReporter::SetUploadParameters(const StringMap& parameters) {
|
|||
upload_parameters_ = parameters;
|
||||
upload_parameters_["process_type"] =
|
||||
process_type_.empty() ? "browser" : process_type_;
|
||||
upload_parameters_["prod"] = ATOM_PRODUCT_NAME;
|
||||
upload_parameters_["ver"] = ATOM_VERSION_STRING;
|
||||
upload_parameters_["prod"] = ELECTRON_PRODUCT_NAME;
|
||||
upload_parameters_["ver"] = ELECTRON_VERSION_STRING;
|
||||
|
||||
// Setting platform dependent parameters.
|
||||
SetUploadParameters();
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2013 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_COMMON_ELECTRON_VERSION_H_
|
||||
#define ATOM_COMMON_ELECTRON_VERSION_H_
|
||||
|
||||
#define ELECTRON_MAJOR_VERSION 7
|
||||
#define ELECTRON_MINOR_VERSION 0
|
||||
#define ELECTRON_PATCH_VERSION 0
|
||||
// clang-format off
|
||||
#define ELECTRON_PRE_RELEASE_VERSION -nightly.20190616
|
||||
// clang-format on
|
||||
|
||||
#ifndef ELECTRON_STRINGIFY
|
||||
#define ELECTRON_STRINGIFY(n) ELECTRON_STRINGIFY_HELPER(n)
|
||||
#define ELECTRON_STRINGIFY_HELPER(n) #n
|
||||
#endif
|
||||
|
||||
#ifndef ELECTRON_PRE_RELEASE_VERSION
|
||||
#define ELECTRON_VERSION_STRING \
|
||||
ELECTRON_STRINGIFY(ELECTRON_MAJOR_VERSION) \
|
||||
"." ELECTRON_STRINGIFY(ELECTRON_MINOR_VERSION) "." ELECTRON_STRINGIFY( \
|
||||
ELECTRON_PATCH_VERSION)
|
||||
#else
|
||||
#define ELECTRON_VERSION_STRING \
|
||||
ELECTRON_STRINGIFY(ELECTRON_MAJOR_VERSION) \
|
||||
"." ELECTRON_STRINGIFY(ELECTRON_MINOR_VERSION) "." ELECTRON_STRINGIFY( \
|
||||
ELECTRON_PATCH_VERSION) ELECTRON_STRINGIFY(ELECTRON_PRE_RELEASE_VERSION)
|
||||
#endif
|
||||
|
||||
#define ELECTRON_VERSION "v" ELECTRON_VERSION_STRING
|
||||
|
||||
#endif // ATOM_COMMON_ELECTRON_VERSION_H_
|
|
@ -138,20 +138,20 @@ async function commitVersionBump (version) {
|
|||
await GitProcess.exec(gitArgs, gitDir)
|
||||
}
|
||||
|
||||
// updates atom_version.h file with new semver values
|
||||
// updates electron_version.h file with new semver values
|
||||
// TODO(codebytere): auto-generate this
|
||||
async function updateVersionH (components) {
|
||||
const filePath = path.resolve(__dirname, '..', 'atom', 'common', 'atom_version.h')
|
||||
const filePath = path.resolve(__dirname, '..', 'atom', 'common', 'electron_version.h')
|
||||
const data = await readFile(filePath, 'utf8')
|
||||
const arr = data.split('\n')
|
||||
const pre = components.pre && components.pre.length >= 2 ? `-${components.pre[0]}.${components.pre[1]}` : null
|
||||
|
||||
arr.forEach((item, idx) => {
|
||||
if (item.includes('#define ATOM_MAJOR_VERSION')) {
|
||||
arr[idx] = `#define ATOM_MAJOR_VERSION ${components.major}`
|
||||
arr[idx + 1] = `#define ATOM_MINOR_VERSION ${components.minor}`
|
||||
arr[idx + 2] = `#define ATOM_PATCH_VERSION ${components.patch}`
|
||||
arr[idx + 4] = pre ? `#define ATOM_PRE_RELEASE_VERSION ${pre}` : '// #define ATOM_PRE_RELEASE_VERSION'
|
||||
if (item.includes('#define ELECTRON_MAJOR_VERSION')) {
|
||||
arr[idx] = `#define ELECTRON_MAJOR_VERSION ${components.major}`
|
||||
arr[idx + 1] = `#define ELECTRON_MINOR_VERSION ${components.minor}`
|
||||
arr[idx + 2] = `#define ELECTRON_PATCH_VERSION ${components.patch}`
|
||||
arr[idx + 4] = pre ? `#define ELECTRON_PRE_RELEASE_VERSION ${pre}` : '// #define ELECTRON_PRE_RELEASE_VERSION'
|
||||
}
|
||||
})
|
||||
await writeFile(filePath, arr.join('\n'))
|
||||
|
|
Загрузка…
Ссылка в новой задаче