refactor: auto generate Info.plist to avoid bumping during releases (#18849)

This commit is contained in:
Samuel Attard 2019-06-17 15:56:15 -07:00 коммит произвёл GitHub
Родитель 0af3548b55
Коммит ccd15fc12e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 15 добавлений и 23 удалений

Просмотреть файл

@ -687,7 +687,7 @@ if (is_mac) {
electron_version = read_file("ELECTRON_VERSION", "trim string")
extra_substitutions = [
"ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework",
"ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.framework",
"ELECTRON_VERSION=$electron_version",
]
@ -738,7 +738,8 @@ if (is_mac) {
sources += [ "atom/common/atom_constants.cc" ]
include_dirs = [ "." ]
info_plist = "atom/renderer/resources/mac/Info.plist"
extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
extra_substitutions =
[ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
ldflags = [
"-rpath",
"@executable_path/../../..",
@ -779,7 +780,7 @@ if (is_mac) {
libs = [ "AppKit.framework" ]
info_plist = "atom/app/resources/mac/loginhelper-Info.plist"
extra_substitutions =
[ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
[ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
}
bundle_data("electron_login_helper_app") {
@ -851,7 +852,11 @@ if (is_mac) {
deps += [ ":electron_login_helper_app" ]
}
info_plist = "atom/browser/resources/mac/Info.plist"
extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id" ]
electron_version = read_file("ELECTRON_VERSION", "trim string")
extra_substitutions = [
"ELECTRON_BUNDLE_ID=$electron_mac_bundle_id",
"ELECTRON_VERSION=$electron_version",
]
ldflags = [
"-rpath",
"@executable_path/../Frameworks",

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>${ATOM_BUNDLE_ID}</string>
<string>${ELECTRON_BUNDLE_ID}</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>

Просмотреть файл

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${ATOM_BUNDLE_ID}</string>
<string>${ELECTRON_BUNDLE_ID}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@ -17,9 +17,9 @@
<key>CFBundleIconFile</key>
<string>electron.icns</string>
<key>CFBundleVersion</key>
<string>7.0.0-nightly.20190616</string>
<string>${ELECTRON_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>7.0.0-nightly.20190616</string>
<string>${ELECTRON_VERSION}</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>${ATOM_BUNDLE_ID}</string>
<string>${ELECTRON_BUNDLE_ID}</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>${ATOM_BUNDLE_ID}</string>
<string>${ELECTRON_BUNDLE_ID}</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>

Просмотреть файл

@ -56,7 +56,6 @@ async function main () {
// update all version-related files
await Promise.all([
updateVersion(version),
updateInfoPlist(version),
updatePackageJSON(version),
updateVersionH(components),
updateWinRC(components)
@ -119,18 +118,6 @@ async function updatePackageJSON (version) {
})
}
// update CFBundle version information and overwrite pre-existing file
// TODO(codebytere): provide these version fields at GN build time
async function updateInfoPlist (version) {
const filePath = path.resolve(__dirname, '..', 'atom', 'browser', 'resources', 'mac', 'Info.plist')
const file = plist.parse(await readFile(filePath, { encoding: 'utf8' }))
file.CFBundleVersion = version
file.CFBundleShortVersionString = version
await writeFile(filePath, plist.build(file))
}
// push bump commit to release branch
async function commitVersionBump (version) {
const gitDir = path.resolve(__dirname, '..')