mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Compare commits
12 Commits
v7.0.0-nig
...
v7.0.0-nig
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab5ec0af33 | ||
|
|
dc2cd8e780 | ||
|
|
24ffc3cfb0 | ||
|
|
99e3de56df | ||
|
|
1304f259cc | ||
|
|
ed5c624b08 | ||
|
|
764be844ec | ||
|
|
fb01c94511 | ||
|
|
5686a0713e | ||
|
|
1cd7c21f38 | ||
|
|
a084093d73 | ||
|
|
79ac99c09b |
@@ -309,7 +309,7 @@ step-electron-dist-build: &step-electron-dist-build
|
||||
echo "Unknown system: `uname`"
|
||||
exit 1
|
||||
fi
|
||||
electron/script/check-zip-manifest.py out/Default/dist.zip electron/script/dist_zip.$target_os.$target_cpu.manifest
|
||||
electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.$target_cpu.manifest
|
||||
fi
|
||||
|
||||
step-electron-dist-store: &step-electron-dist-store
|
||||
@@ -350,10 +350,10 @@ step-electron-publish: &step-electron-publish
|
||||
cd src/electron
|
||||
if [ "$UPLOAD_TO_S3" == "1" ]; then
|
||||
echo 'Uploading Electron release distribution to S3'
|
||||
script/upload.py --upload_to_s3
|
||||
script/release/uploaders/upload.py --upload_to_s3
|
||||
else
|
||||
echo 'Uploading Electron release distribution to Github releases'
|
||||
script/upload.py
|
||||
script/release/uploaders/upload.py
|
||||
fi
|
||||
|
||||
step-persist-data-for-tests: &step-persist-data-for-tests
|
||||
@@ -521,7 +521,7 @@ step-maybe-trigger-arm-test: &step-maybe-trigger-arm-test
|
||||
if [ "$TRIGGER_ARM_TEST" == "true" ] && [ -z "$CIRCLE_PR_NUMBER" ]; then
|
||||
#Trigger VSTS job, passing along CircleCI job number and branch to build
|
||||
echo "Triggering electron-$TARGET_ARCH-testing build on VSTS"
|
||||
node electron/script/ci-release-build.js --job=electron-$TARGET_ARCH-testing --ci=VSTS --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
|
||||
node electron/script/release/ci-release-build.js --job=electron-$TARGET_ARCH-testing --ci=VSTS --armTest --circleBuildNum=$CIRCLE_BUILD_NUM $CIRCLE_BRANCH
|
||||
fi
|
||||
|
||||
step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
*
|
||||
!tools/xvfb-init.sh
|
||||
!tools/run-electron.sh
|
||||
!build/install-build-deps.sh
|
||||
|
||||
11
.github/CODEOWNERS
vendored
11
.github/CODEOWNERS
vendored
@@ -18,13 +18,4 @@
|
||||
|
||||
# Releases WG
|
||||
/npm/ @electron/wg-releases
|
||||
/script/release-notes @electron/wg-releases
|
||||
/script/prepare-release.js @electron/wg-releases
|
||||
/script/bump-version.js @electron/wg-releases
|
||||
/script/ci-release-build.js @electron/wg-releases
|
||||
/script/release.js @electron/wg-releases
|
||||
/script/upload-to-github.js @electron/wg-releases
|
||||
/script/release-artifact-cleanup.js @electron/wg-releases
|
||||
/script/get-last-major-for-master.js @electron/wg-releases
|
||||
/script/find-release.js @electron/wg-releases
|
||||
/script/download-circleci-artifacts.js @electron/wg-releases
|
||||
/script/release @electron/wg-releases
|
||||
@@ -1 +1 @@
|
||||
7.0.0-nightly.20190622
|
||||
7.0.0-nightly.20190625
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
|
||||
[](https://circleci.com/gh/electron/electron/tree/master)
|
||||
[](https://windows-ci.electronjs.org/project/AppVeyor/electron/branch/master)
|
||||
[](https://github.visualstudio.com/electron/_build/latest?definitionId=36)
|
||||
[](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/master)
|
||||
[](https://david-dm.org/electron/electron?type=dev)
|
||||
[](https://atom-slack.herokuapp.com/)
|
||||
|
||||
:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹 🇵🇱.
|
||||
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).
|
||||
|
||||
@@ -97,7 +97,7 @@ build_script:
|
||||
python electron\script\zip-symbols.py
|
||||
appveyor PushArtifact out/Default/symbols.zip
|
||||
}
|
||||
- python electron/script/check-zip-manifest.py out/Default/dist.zip electron/script/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
|
||||
test_script:
|
||||
# Workaround for https://github.com/appveyor/ci/issues/2420
|
||||
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
|
||||
@@ -125,9 +125,9 @@ deploy_script:
|
||||
if (Test-Path Env:\ELECTRON_RELEASE) {
|
||||
if (Test-Path Env:\UPLOAD_TO_S3) {
|
||||
Write-Output "Uploading Electron release distribution to s3"
|
||||
& python script\upload.py --upload_to_s3
|
||||
& python script\release\uploaders\upload.py --upload_to_s3
|
||||
} else {
|
||||
Write-Output "Uploading Electron release distribution to github releases"
|
||||
& python script\upload.py
|
||||
& python script\release\uploaders\upload.py
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import * as timers from 'timers'
|
||||
import * as util from 'util'
|
||||
|
||||
import { electronBindingSetup } from '@electron/internal/common/electron-binding-setup'
|
||||
|
||||
const timers = require('timers')
|
||||
|
||||
process.electronBinding = electronBindingSetup(process._linkedBinding, process.type)
|
||||
|
||||
type AnyFn = (...args: any[]) => any
|
||||
@@ -38,16 +39,20 @@ function wrap <T extends AnyFn> (func: T, wrapper: (fn: AnyFn) => T) {
|
||||
|
||||
process.nextTick = wrapWithActivateUvLoop(process.nextTick)
|
||||
|
||||
global.setImmediate = wrapWithActivateUvLoop(timers.setImmediate)
|
||||
global.setImmediate = timers.setImmediate = wrapWithActivateUvLoop(timers.setImmediate)
|
||||
global.clearImmediate = timers.clearImmediate
|
||||
|
||||
// setTimeout needs to update the polling timeout of the event loop, when
|
||||
// called under Chromium's event loop the node's event loop won't get a chance
|
||||
// to update the timeout, so we have to force the node's event loop to
|
||||
// recalculate the timeout in browser process.
|
||||
timers.setTimeout = wrapWithActivateUvLoop(timers.setTimeout)
|
||||
timers.setInterval = wrapWithActivateUvLoop(timers.setInterval)
|
||||
|
||||
// Only override the global setTimeout/setInterval impls in the browser process
|
||||
if (process.type === 'browser') {
|
||||
// setTimeout needs to update the polling timeout of the event loop, when
|
||||
// called under Chromium's event loop the node's event loop won't get a chance
|
||||
// to update the timeout, so we have to force the node's event loop to
|
||||
// recalculate the timeout in browser process.
|
||||
global.setTimeout = wrapWithActivateUvLoop(timers.setTimeout)
|
||||
global.setInterval = wrapWithActivateUvLoop(timers.setInterval)
|
||||
global.setTimeout = timers.setTimeout
|
||||
global.setInterval = timers.setInterval
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "electron",
|
||||
"version": "7.0.0-nightly.20190622",
|
||||
"version": "7.0.0-nightly.20190625",
|
||||
"repository": "https://github.com/electron/electron",
|
||||
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
|
||||
"devDependencies": {
|
||||
@@ -60,7 +60,6 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"asar": "asar",
|
||||
"bump-version": "./script/bump-version.js",
|
||||
"check-tls": "python ./script/tls.py",
|
||||
"clang-format": "find atom/ chromium_src/ -iname *.h -o -iname *.cc -o -iname *.mm | xargs clang-format -i",
|
||||
"generate-version-json": "node script/generate-version-json.js",
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
const { GitProcess } = require('dugite')
|
||||
const path = require('path')
|
||||
const semver = require('semver')
|
||||
const gitDir = path.resolve(__dirname, '..')
|
||||
|
||||
async function getLastMajorForMaster () {
|
||||
let branchNames
|
||||
const result = await GitProcess.exec(['branch', '-a', '--remote', '--list', 'origin/[0-9]-[0-9]-x'], gitDir)
|
||||
if (result.exitCode === 0) {
|
||||
branchNames = result.stdout.trim().split('\n')
|
||||
const filtered = branchNames.map(b => b.replace('origin/', ''))
|
||||
return getNextReleaseBranch(filtered)
|
||||
} else {
|
||||
throw new Error('Release branches could not be fetched.')
|
||||
}
|
||||
}
|
||||
|
||||
function getNextReleaseBranch (branches) {
|
||||
const converted = branches.map(b => b.replace(/-/g, '.').replace('x', '0'))
|
||||
return converted.reduce((v1, v2) => semver.gt(v1, v2) ? v1 : v2)
|
||||
}
|
||||
|
||||
module.exports = { getLastMajorForMaster }
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
|
||||
from lib.util import get_electron_version
|
||||
|
||||
def main():
|
||||
print(get_electron_version())
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -22,6 +22,9 @@ import zipfile
|
||||
from lib.config import is_verbose_mode, PLATFORM
|
||||
from lib.env_util import get_vs_env
|
||||
|
||||
ELECTRON_DIR = os.path.abspath(
|
||||
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
||||
)
|
||||
SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
|
||||
BOTO_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'vendor',
|
||||
'boto'))
|
||||
|
||||
@@ -2,6 +2,8 @@ const { GitProcess } = require('dugite')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const ELECTRON_DIR = path.resolve(__dirname, '..', '..')
|
||||
const SRC_DIR = path.resolve(ELECTRON_DIR, '..')
|
||||
const OUT_DIR = process.env.ELECTRON_OUT_DIR || 'Debug'
|
||||
|
||||
require('colors')
|
||||
@@ -22,7 +24,7 @@ function getElectronExec () {
|
||||
}
|
||||
|
||||
function getAbsoluteElectronExec () {
|
||||
return path.resolve(__dirname, '../../..', getElectronExec())
|
||||
return path.resolve(SRC_DIR, getElectronExec())
|
||||
}
|
||||
|
||||
async function handleGitCall (args, gitDir) {
|
||||
@@ -61,5 +63,7 @@ module.exports = {
|
||||
getCurrentBranch,
|
||||
getElectronExec,
|
||||
getAbsoluteElectronExec,
|
||||
OUT_DIR
|
||||
ELECTRON_DIR,
|
||||
OUT_DIR,
|
||||
SRC_DIR
|
||||
}
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
||||
|
||||
from lib.config import s3_config
|
||||
from lib.util import boto_path_dirs
|
||||
|
||||
@@ -5,14 +5,13 @@ const minimist = require('minimist')
|
||||
const path = require('path')
|
||||
const semver = require('semver')
|
||||
|
||||
const { ELECTRON_DIR } = require('../../lib/utils')
|
||||
const notesGenerator = require('./notes.js')
|
||||
|
||||
const gitDir = path.resolve(__dirname, '..', '..')
|
||||
|
||||
const semverify = version => version.replace(/^origin\//, '').replace('x', '0').replace(/-/g, '.')
|
||||
|
||||
const runGit = async (args) => {
|
||||
const response = await GitProcess.exec(args, gitDir)
|
||||
const response = await GitProcess.exec(args, ELECTRON_DIR)
|
||||
if (response.exitCode !== 0) {
|
||||
throw new Error(response.stderr.trim())
|
||||
}
|
||||
@@ -11,13 +11,14 @@ const octokit = require('@octokit/rest')({
|
||||
})
|
||||
const semver = require('semver')
|
||||
|
||||
const { ELECTRON_VERSION, SRC_DIR } = require('../../lib/utils')
|
||||
|
||||
const MAX_FAIL_COUNT = 3
|
||||
const CHECK_INTERVAL = 5000
|
||||
|
||||
const CACHE_DIR = path.resolve(__dirname, '.cache')
|
||||
const NO_NOTES = 'No notes'
|
||||
const FOLLOW_REPOS = [ 'electron/electron', 'electron/libchromiumcontent', 'electron/node' ]
|
||||
const gitDir = path.resolve(__dirname, '..', '..')
|
||||
|
||||
const breakTypes = new Set(['breaking-change'])
|
||||
const docTypes = new Set(['doc', 'docs'])
|
||||
@@ -373,11 +374,11 @@ const getDependencyCommitsGyp = async (pool, fromRef, toRef) => {
|
||||
const repos = [{
|
||||
owner: 'electron',
|
||||
repo: 'libchromiumcontent',
|
||||
dir: path.resolve(gitDir, 'vendor', 'libchromiumcontent')
|
||||
dir: path.resolve(ELECTRON_VERSION, 'vendor', 'libchromiumcontent')
|
||||
}, {
|
||||
owner: 'electron',
|
||||
repo: 'node',
|
||||
dir: path.resolve(gitDir, 'vendor', 'node')
|
||||
dir: path.resolve(ELECTRON_VERSION, 'vendor', 'node')
|
||||
}]
|
||||
|
||||
for (const repo of repos) {
|
||||
@@ -393,7 +394,7 @@ const getDependencyCommitsGyp = async (pool, fromRef, toRef) => {
|
||||
|
||||
const getDepsVariable = async (ref, key) => {
|
||||
// get a copy of that reference point's DEPS file
|
||||
const deps = await runGit(gitDir, ['show', `${ref}:DEPS`])
|
||||
const deps = await runGit(ELECTRON_VERSION, ['show', `${ref}:DEPS`])
|
||||
const filename = path.resolve(os.tmpdir(), 'DEPS')
|
||||
fs.writeFileSync(filename, deps)
|
||||
|
||||
@@ -413,7 +414,7 @@ const getDependencyCommitsGN = async (pool, fromRef, toRef) => {
|
||||
const repos = [{ // just node
|
||||
owner: 'electron',
|
||||
repo: 'node',
|
||||
dir: path.resolve(gitDir, '..', 'third_party', 'electron_node'),
|
||||
dir: path.resolve(SRC_DIR, 'third_party', 'electron_node'),
|
||||
deps_variable_name: 'node_version'
|
||||
}]
|
||||
|
||||
@@ -429,7 +430,7 @@ const getDependencyCommitsGN = async (pool, fromRef, toRef) => {
|
||||
// other repos - controller
|
||||
|
||||
const getDependencyCommits = async (pool, from, to) => {
|
||||
const filename = path.resolve(gitDir, 'vendor', 'libchromiumcontent')
|
||||
const filename = path.resolve(ELECTRON_VERSION, 'vendor', 'libchromiumcontent')
|
||||
const useGyp = fs.existsSync(filename)
|
||||
|
||||
return useGyp
|
||||
@@ -474,7 +475,7 @@ const getNotes = async (fromRef, toRef, newVersion) => {
|
||||
}
|
||||
|
||||
// get the electron/electron commits
|
||||
const electron = { owner: 'electron', repo: 'electron', dir: gitDir }
|
||||
const electron = { owner: 'electron', repo: 'electron', dir: ELECTRON_VERSION }
|
||||
await addRepoToPool(pool, electron, fromRef, toRef)
|
||||
|
||||
// Don't include submodules if comparing across major versions;
|
||||
@@ -13,8 +13,8 @@ const { GitProcess } = require('dugite')
|
||||
|
||||
const path = require('path')
|
||||
const readline = require('readline')
|
||||
const releaseNotesGenerator = require('./release-notes/index.js')
|
||||
const { getCurrentBranch } = require('./lib/utils.js')
|
||||
const releaseNotesGenerator = require('./notes/index.js')
|
||||
const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils.js')
|
||||
const bumpType = args._[0]
|
||||
const targetRepo = bumpType === 'nightly' ? 'nightlies' : 'electron'
|
||||
|
||||
@@ -28,12 +28,11 @@ if (!bumpType && !args.notesOnly) {
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const gitDir = path.resolve(__dirname, '..')
|
||||
async function getNewVersion (dryRun) {
|
||||
if (!dryRun) {
|
||||
console.log(`Bumping for new "${bumpType}" version.`)
|
||||
}
|
||||
const bumpScript = path.join(__dirname, 'bump-version.js')
|
||||
const bumpScript = path.join(__dirname, 'version-bumper.js')
|
||||
const scriptArgs = ['node', bumpScript, `--bump=${bumpType}`]
|
||||
if (dryRun) scriptArgs.push('--dryRun')
|
||||
try {
|
||||
@@ -122,7 +121,7 @@ async function createRelease (branchToTarget, isBeta) {
|
||||
}
|
||||
|
||||
async function pushRelease (branch) {
|
||||
const pushDetails = await GitProcess.exec(['push', 'origin', `HEAD:${branch}`, '--follow-tags'], gitDir)
|
||||
const pushDetails = await GitProcess.exec(['push', 'origin', `HEAD:${branch}`, '--follow-tags'], ELECTRON_DIR)
|
||||
if (pushDetails.exitCode === 0) {
|
||||
console.log(`${pass} Successfully pushed the release. Wait for ` +
|
||||
`release builds to finish before running "npm run release".`)
|
||||
@@ -141,7 +140,7 @@ async function runReleaseBuilds (branch) {
|
||||
|
||||
async function tagRelease (version) {
|
||||
console.log(`Tagging release ${version}.`)
|
||||
const checkoutDetails = await GitProcess.exec([ 'tag', '-a', '-m', version, version ], gitDir)
|
||||
const checkoutDetails = await GitProcess.exec([ 'tag', '-a', '-m', version, version ], ELECTRON_DIR)
|
||||
if (checkoutDetails.exitCode === 0) {
|
||||
console.log(`${pass} Successfully tagged ${version}.`)
|
||||
} else {
|
||||
@@ -183,7 +182,7 @@ async function promptForVersion (version) {
|
||||
// function to determine if there have been commits to master since the last release
|
||||
async function changesToRelease () {
|
||||
const lastCommitWasRelease = new RegExp(`^Bump v[0-9.]*(-beta[0-9.]*)?(-nightly[0-9.]*)?$`, 'g')
|
||||
const lastCommit = await GitProcess.exec(['log', '-n', '1', `--pretty=format:'%s'`], gitDir)
|
||||
const lastCommit = await GitProcess.exec(['log', '-n', '1', `--pretty=format:'%s'`], ELECTRON_DIR)
|
||||
return !lastCommitWasRelease.test(lastCommit.stdout)
|
||||
}
|
||||
|
||||
@@ -192,7 +191,7 @@ async function prepareRelease (isBeta, notesOnly) {
|
||||
const newVersion = await getNewVersion(true)
|
||||
console.log(newVersion)
|
||||
} else {
|
||||
const currentBranch = (args.branch) ? args.branch : await getCurrentBranch(gitDir)
|
||||
const currentBranch = (args.branch) ? args.branch : await getCurrentBranch(ELECTRON_DIR)
|
||||
if (notesOnly) {
|
||||
const newVersion = await getNewVersion(true)
|
||||
const releaseNotes = await getReleaseNotes(currentBranch, newVersion)
|
||||
@@ -2,10 +2,10 @@ const temp = require('temp')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const childProcess = require('child_process')
|
||||
const { getCurrentBranch } = require('./lib/utils.js')
|
||||
const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils')
|
||||
const request = require('request')
|
||||
const semver = require('semver')
|
||||
const rootPackageJson = require('../package.json')
|
||||
const rootPackageJson = require('../../package.json')
|
||||
const octokit = require('@octokit/rest')({
|
||||
headers: { 'User-Agent': 'electron-npm-publisher' }
|
||||
})
|
||||
@@ -55,7 +55,7 @@ new Promise((resolve, reject) => {
|
||||
const noThirdSegment = name === 'README.md' || name === 'LICENSE'
|
||||
fs.writeFileSync(
|
||||
path.join(tempDir, name),
|
||||
fs.readFileSync(path.join(__dirname, '..', noThirdSegment ? '' : 'npm', name))
|
||||
fs.readFileSync(path.join(ELECTRON_DIR, noThirdSegment ? '' : 'npm', name))
|
||||
)
|
||||
})
|
||||
// copy from root package.json to temp/package.json
|
||||
@@ -10,14 +10,13 @@ const args = require('minimist')(process.argv.slice(2), {
|
||||
})
|
||||
const { execSync } = require('child_process')
|
||||
const { GitProcess } = require('dugite')
|
||||
const { getCurrentBranch } = require('./lib/utils.js')
|
||||
const { getCurrentBranch, ELECTRON_DIR } = require('../lib/utils.js')
|
||||
|
||||
const octokit = require('@octokit/rest')({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
})
|
||||
|
||||
const path = require('path')
|
||||
const gitDir = path.resolve(__dirname, '..')
|
||||
|
||||
function getLastBumpCommit (tag) {
|
||||
const data = execSync(`git log -n1 --grep "Bump ${tag}" --format='format:{"hash": "%H", "message": "%s"}'`).toString()
|
||||
@@ -27,8 +26,8 @@ function getLastBumpCommit (tag) {
|
||||
async function revertBumpCommit (tag) {
|
||||
const branch = await getCurrentBranch()
|
||||
const commitToRevert = getLastBumpCommit(tag).hash
|
||||
await GitProcess.exec(['revert', commitToRevert], gitDir)
|
||||
const pushDetails = await GitProcess.exec(['push', 'origin', `HEAD:${branch}`, '--follow-tags'], gitDir)
|
||||
await GitProcess.exec(['revert', commitToRevert], ELECTRON_DIR)
|
||||
const pushDetails = await GitProcess.exec(['push', 'origin', `HEAD:${branch}`, '--follow-tags'], ELECTRON_DIR)
|
||||
if (pushDetails.exitCode === 0) {
|
||||
console.log(`${pass} successfully reverted release commit.`)
|
||||
} else {
|
||||
@@ -15,7 +15,7 @@ const fs = require('fs')
|
||||
const { execSync } = require('child_process')
|
||||
const nugget = require('nugget')
|
||||
const got = require('got')
|
||||
const pkg = require('../package.json')
|
||||
const pkg = require('../../package.json')
|
||||
const pkgVersion = `v${pkg.version}`
|
||||
const pass = '\u2713'.green
|
||||
const path = require('path')
|
||||
@@ -24,6 +24,8 @@ const sumchecker = require('sumchecker')
|
||||
const temp = require('temp').track()
|
||||
const { URL } = require('url')
|
||||
|
||||
const { ELECTRON_DIR } = require('../lib/utils')
|
||||
|
||||
const octokit = require('@octokit/rest')({
|
||||
auth: process.env.ELECTRON_GITHUB_TOKEN
|
||||
})
|
||||
@@ -146,20 +148,6 @@ function s3UrlsForVersion (version) {
|
||||
return patterns
|
||||
}
|
||||
|
||||
function checkVersion () {
|
||||
if (args.skipVersionCheck) return
|
||||
|
||||
console.log(`Verifying that app version matches package version ${pkgVersion}.`)
|
||||
const startScript = path.join(__dirname, 'start.py')
|
||||
const scriptArgs = ['--version']
|
||||
if (args.automaticRelease) {
|
||||
scriptArgs.unshift('-R')
|
||||
}
|
||||
const appVersion = runScript(startScript, scriptArgs).trim()
|
||||
check((pkgVersion.indexOf(appVersion) === 0), `App version ${appVersion} matches ` +
|
||||
`package version ${pkgVersion}.`, true)
|
||||
}
|
||||
|
||||
function runScript (scriptName, scriptArgs, cwd) {
|
||||
const scriptCommand = `${scriptName} ${scriptArgs.join(' ')}`
|
||||
const scriptOptions = {
|
||||
@@ -176,14 +164,14 @@ function runScript (scriptName, scriptArgs, cwd) {
|
||||
|
||||
function uploadNodeShasums () {
|
||||
console.log('Uploading Node SHASUMS file to S3.')
|
||||
const scriptPath = path.join(__dirname, 'upload-node-checksums.py')
|
||||
const scriptPath = path.join(ELECTRON_DIR, 'script', 'release', 'uploaders', 'upload-node-checksums.py')
|
||||
runScript(scriptPath, ['-v', pkgVersion])
|
||||
console.log(`${pass} Done uploading Node SHASUMS file to S3.`)
|
||||
}
|
||||
|
||||
function uploadIndexJson () {
|
||||
console.log('Uploading index.json to S3.')
|
||||
const scriptPath = path.join(__dirname, 'upload-index-json.py')
|
||||
const scriptPath = path.join(ELECTRON_DIR, 'script', 'release', 'uploaders', 'upload-index-json.py')
|
||||
runScript(scriptPath, [pkgVersion])
|
||||
console.log(`${pass} Done uploading index.json to S3.`)
|
||||
}
|
||||
@@ -202,7 +190,7 @@ async function createReleaseShasums (release) {
|
||||
})
|
||||
}
|
||||
console.log(`Creating and uploading the release ${fileName}.`)
|
||||
const scriptPath = path.join(__dirname, 'merge-electron-checksums.py')
|
||||
const scriptPath = path.join(ELECTRON_DIR, 'script', 'release', 'merge-electron-checksums.py')
|
||||
const checksums = runScript(scriptPath, ['-v', pkgVersion])
|
||||
|
||||
console.log(`${pass} Generated release SHASUMS.`)
|
||||
@@ -274,7 +262,6 @@ async function makeRelease (releaseToValidate) {
|
||||
const release = await getDraftRelease(releaseToValidate)
|
||||
await validateReleaseAssets(release, true)
|
||||
} else {
|
||||
checkVersion()
|
||||
let draftRelease = await getDraftRelease()
|
||||
uploadNodeShasums()
|
||||
uploadIndexJson()
|
||||
@@ -6,10 +6,11 @@ import os
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
from lib.config import s3_config
|
||||
from lib.util import s3put, scoped_cwd, safe_mkdir, get_out_dir
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from lib.config import s3_config
|
||||
from lib.util import s3put, scoped_cwd, safe_mkdir, get_out_dir, ELECTRON_DIR
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
OUT_DIR = get_out_dir()
|
||||
|
||||
BASE_URL = 'https://electron-metadumper.herokuapp.com/?version='
|
||||
@@ -48,7 +49,7 @@ def main():
|
||||
if not authToken or authToken == "":
|
||||
raise Exception("Please set META_DUMPER_AUTH_HEADER")
|
||||
# Upload the index.json.
|
||||
with scoped_cwd(SOURCE_ROOT):
|
||||
with scoped_cwd(ELECTRON_DIR):
|
||||
safe_mkdir(OUT_DIR)
|
||||
index_json = os.path.relpath(os.path.join(OUT_DIR, 'index.json'))
|
||||
|
||||
@@ -7,6 +7,8 @@ import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from lib.config import s3_config
|
||||
from lib.util import download, rm_rf, s3put, safe_mkdir
|
||||
|
||||
@@ -6,10 +6,11 @@ import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from lib.config import PLATFORM, get_target_arch, s3_config
|
||||
from lib.util import safe_mkdir, scoped_cwd, s3put, get_out_dir, get_dist_dir
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
DIST_DIR = get_dist_dir()
|
||||
OUT_DIR = get_out_dir()
|
||||
GEN_DIR = os.path.join(OUT_DIR, 'gen')
|
||||
@@ -4,11 +4,12 @@ import os
|
||||
import glob
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from lib.config import PLATFORM, s3_config, enable_verbose_mode
|
||||
from lib.util import get_electron_branding, execute, rm_rf, safe_mkdir, s3put, \
|
||||
get_out_dir
|
||||
get_out_dir, ELECTRON_DIR
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
RELEASE_DIR = get_out_dir()
|
||||
|
||||
|
||||
@@ -22,7 +23,7 @@ PDB_LIST = [
|
||||
|
||||
|
||||
def main():
|
||||
os.chdir(SOURCE_ROOT)
|
||||
os.chdir(ELECTRON_DIR)
|
||||
if PLATFORM == 'win32':
|
||||
for pdb in PDB_LIST:
|
||||
run_symstore(pdb, SYMBOLS_DIR, PRODUCT_NAME)
|
||||
@@ -12,12 +12,14 @@ import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../..")
|
||||
|
||||
from io import StringIO
|
||||
from lib.config import PLATFORM, get_target_arch, get_env_var, s3_config, \
|
||||
get_zip_name
|
||||
from lib.util import get_electron_branding, execute, get_electron_version, \
|
||||
scoped_cwd, s3put, get_electron_exec, \
|
||||
get_out_dir, SRC_DIR
|
||||
get_out_dir, SRC_DIR, ELECTRON_DIR
|
||||
|
||||
|
||||
ELECTRON_REPO = 'electron/electron'
|
||||
@@ -26,7 +28,6 @@ ELECTRON_VERSION = get_electron_version()
|
||||
PROJECT_NAME = get_electron_branding()['project_name']
|
||||
PRODUCT_NAME = get_electron_branding()['product_name']
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
OUT_DIR = get_out_dir()
|
||||
|
||||
DIST_NAME = get_zip_name(PROJECT_NAME, ELECTRON_VERSION)
|
||||
@@ -69,10 +70,10 @@ def main():
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'symbols.zip'), symbols_zip)
|
||||
upload_electron(release, symbols_zip, args)
|
||||
if PLATFORM == 'darwin':
|
||||
api_path = os.path.join(SOURCE_ROOT, 'electron-api.json')
|
||||
api_path = os.path.join(ELECTRON_DIR, 'electron-api.json')
|
||||
upload_electron(release, api_path, args)
|
||||
|
||||
ts_defs_path = os.path.join(SOURCE_ROOT, 'electron.d.ts')
|
||||
ts_defs_path = os.path.join(ELECTRON_DIR, 'electron.d.ts')
|
||||
upload_electron(release, ts_defs_path, args)
|
||||
dsym_zip = os.path.join(OUT_DIR, DSYM_NAME)
|
||||
shutil.copy2(os.path.join(OUT_DIR, 'dsym.zip'), dsym_zip)
|
||||
@@ -106,9 +107,9 @@ def main():
|
||||
|
||||
if not tag_exists and not args.upload_to_s3:
|
||||
# Upload symbols to symbol server.
|
||||
run_python_script('upload-symbols.py')
|
||||
run_python_upload_script('upload-symbols.py')
|
||||
if PLATFORM == 'win32':
|
||||
run_python_script('upload-node-headers.py', '-v', args.version)
|
||||
run_python_upload_script('upload-node-headers.py', '-v', args.version)
|
||||
|
||||
|
||||
def parse_args():
|
||||
@@ -130,8 +131,9 @@ def parse_args():
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def run_python_script(script, *args):
|
||||
script_path = os.path.join(SOURCE_ROOT, 'script', script)
|
||||
def run_python_upload_script(script, *args):
|
||||
script_path = os.path.join(
|
||||
ELECTRON_DIR, 'script', 'release', 'uploaders', script)
|
||||
return execute([sys.executable, script_path] + list(args))
|
||||
|
||||
|
||||
@@ -168,7 +170,8 @@ def upload_electron(release, file_path, args):
|
||||
def upload_io_to_github(release, filename, filepath, version):
|
||||
print('Uploading %s to Github' % \
|
||||
(filename))
|
||||
script_path = os.path.join(SOURCE_ROOT, 'script', 'upload-to-github.js')
|
||||
script_path = os.path.join(
|
||||
ELECTRON_DIR, 'script', 'release', 'uploaders', 'upload-to-github.js')
|
||||
execute(['node', script_path, filepath, filename, str(release['id']),
|
||||
version])
|
||||
|
||||
@@ -198,7 +201,8 @@ def auth_token():
|
||||
|
||||
|
||||
def get_release(version):
|
||||
script_path = os.path.join(SOURCE_ROOT, 'script', 'find-release.js')
|
||||
script_path = os.path.join(
|
||||
ELECTRON_DIR, 'script', 'release', 'find-github-release.js')
|
||||
release_info = execute(['node', script_path, version])
|
||||
release = json.loads(release_info)
|
||||
return release
|
||||
@@ -1,13 +1,15 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const { GitProcess } = require('dugite')
|
||||
const utils = require('./lib/version-utils')
|
||||
const fs = require('fs')
|
||||
const semver = require('semver')
|
||||
const path = require('path')
|
||||
const { promisify } = require('util')
|
||||
const minimist = require('minimist')
|
||||
|
||||
const { ELECTRON_DIR } = require('../lib/utils')
|
||||
const versionUtils = require('./version-utils')
|
||||
|
||||
const writeFile = promisify(fs.writeFile)
|
||||
const readFile = promisify(fs.readFile)
|
||||
|
||||
@@ -35,7 +37,7 @@ function parseCommandLine () {
|
||||
// run the script
|
||||
async function main () {
|
||||
const opts = parseCommandLine()
|
||||
const currentVersion = await utils.getElectronVersion()
|
||||
const currentVersion = await versionUtils.getElectronVersion()
|
||||
const version = await nextVersion(opts.bump, currentVersion)
|
||||
|
||||
const parsed = semver.parse(version)
|
||||
@@ -67,13 +69,13 @@ async function main () {
|
||||
|
||||
// get next version for release based on [nightly, beta, stable]
|
||||
async function nextVersion (bumpType, version) {
|
||||
if (utils.isNightly(version) || utils.isBeta(version)) {
|
||||
if (versionUtils.isNightly(version) || versionUtils.isBeta(version)) {
|
||||
switch (bumpType) {
|
||||
case 'nightly':
|
||||
version = await utils.nextNightly(version)
|
||||
version = await versionUtils.nextNightly(version)
|
||||
break
|
||||
case 'beta':
|
||||
version = await utils.nextBeta(version)
|
||||
version = await versionUtils.nextBeta(version)
|
||||
break
|
||||
case 'stable':
|
||||
version = semver.valid(semver.coerce(version))
|
||||
@@ -81,10 +83,10 @@ async function nextVersion (bumpType, version) {
|
||||
default:
|
||||
throw new Error('Invalid bump type.')
|
||||
}
|
||||
} else if (utils.isStable(version)) {
|
||||
} else if (versionUtils.isStable(version)) {
|
||||
switch (bumpType) {
|
||||
case 'nightly':
|
||||
version = utils.nextNightly(version)
|
||||
version = versionUtils.nextNightly(version)
|
||||
break
|
||||
case 'beta':
|
||||
throw new Error('Cannot bump to beta from stable.')
|
||||
@@ -102,39 +104,36 @@ async function nextVersion (bumpType, version) {
|
||||
|
||||
// update VERSION file with latest release info
|
||||
async function updateVersion (version) {
|
||||
const versionPath = path.resolve(__dirname, '..', 'ELECTRON_VERSION')
|
||||
const versionPath = path.resolve(ELECTRON_DIR, 'ELECTRON_VERSION')
|
||||
await writeFile(versionPath, version, 'utf8')
|
||||
}
|
||||
|
||||
// update package metadata files with new version
|
||||
async function updatePackageJSON (version) {
|
||||
['package.json'].forEach(async fileName => {
|
||||
const filePath = path.resolve(__dirname, '..', fileName)
|
||||
const file = require(filePath)
|
||||
file.version = version
|
||||
await writeFile(filePath, JSON.stringify(file, null, 2))
|
||||
})
|
||||
const filePath = path.resolve(ELECTRON_DIR, 'package.json')
|
||||
const file = require(filePath)
|
||||
file.version = version
|
||||
await writeFile(filePath, JSON.stringify(file, null, 2))
|
||||
}
|
||||
|
||||
// push bump commit to release branch
|
||||
async function commitVersionBump (version) {
|
||||
const gitDir = path.resolve(__dirname, '..')
|
||||
const gitArgs = ['commit', '-a', '-m', `Bump v${version}`, '-n']
|
||||
await GitProcess.exec(gitArgs, gitDir)
|
||||
await GitProcess.exec(gitArgs, ELECTRON_DIR)
|
||||
}
|
||||
|
||||
// updates atom.rc file with new semver values
|
||||
async function updateWinRC (components) {
|
||||
const filePath = path.resolve(__dirname, '..', 'shell', 'browser', 'resources', 'win', 'atom.rc')
|
||||
const filePath = path.resolve(ELECTRON_DIR, 'shell', 'browser', 'resources', 'win', 'atom.rc')
|
||||
const data = await readFile(filePath, 'utf8')
|
||||
const arr = data.split('\n')
|
||||
arr.forEach((line, idx) => {
|
||||
if (line.includes('FILEVERSION')) {
|
||||
arr[idx] = ` FILEVERSION ${utils.makeVersion(components, ',', utils.preType.PARTIAL)}`
|
||||
arr[idx + 1] = ` PRODUCTVERSION ${utils.makeVersion(components, ',', utils.preType.PARTIAL)}`
|
||||
arr[idx] = ` FILEVERSION ${versionUtils.makeVersion(components, ',', versionUtils.preType.PARTIAL)}`
|
||||
arr[idx + 1] = ` PRODUCTVERSION ${versionUtils.makeVersion(components, ',', versionUtils.preType.PARTIAL)}`
|
||||
} else if (line.includes('FileVersion')) {
|
||||
arr[idx] = ` VALUE "FileVersion", "${utils.makeVersion(components, '.')}"`
|
||||
arr[idx + 5] = ` VALUE "ProductVersion", "${utils.makeVersion(components, '.')}"`
|
||||
arr[idx] = ` VALUE "FileVersion", "${versionUtils.makeVersion(components, '.')}"`
|
||||
arr[idx + 5] = ` VALUE "ProductVersion", "${versionUtils.makeVersion(components, '.')}"`
|
||||
}
|
||||
})
|
||||
await writeFile(filePath, arr.join('\n'))
|
||||
@@ -1,12 +1,12 @@
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
const semver = require('semver')
|
||||
const { getLastMajorForMaster } = require('../get-last-major-for-master')
|
||||
const { GitProcess } = require('dugite')
|
||||
const { promisify } = require('util')
|
||||
|
||||
const { ELECTRON_DIR } = require('../lib/utils')
|
||||
|
||||
const readFile = promisify(fs.readFile)
|
||||
const gitDir = path.resolve(__dirname, '..', '..')
|
||||
|
||||
const preType = {
|
||||
NONE: 'none',
|
||||
@@ -42,7 +42,7 @@ const makeVersion = (components, delim, pre = preType.NONE) => {
|
||||
async function nextBeta (v) {
|
||||
const next = semver.coerce(semver.clean(v))
|
||||
|
||||
const tagBlob = await GitProcess.exec(['tag', '--list', '-l', `v${next}-beta.*`], gitDir)
|
||||
const tagBlob = await GitProcess.exec(['tag', '--list', '-l', `v${next}-beta.*`], ELECTRON_DIR)
|
||||
const tags = tagBlob.stdout.split('\n').filter(e => e !== '')
|
||||
tags.sort((t1, t2) => semver.gt(t1, t2))
|
||||
|
||||
@@ -51,7 +51,7 @@ async function nextBeta (v) {
|
||||
}
|
||||
|
||||
async function getElectronVersion () {
|
||||
const versionPath = path.join(__dirname, '..', '..', 'ELECTRON_VERSION')
|
||||
const versionPath = path.resolve(ELECTRON_DIR, 'ELECTRON_VERSION')
|
||||
const version = await readFile(versionPath, 'utf8')
|
||||
return version.trim()
|
||||
}
|
||||
@@ -60,7 +60,7 @@ async function nextNightly (v) {
|
||||
let next = semver.valid(semver.coerce(v))
|
||||
const pre = `nightly.${getCurrentDate()}`
|
||||
|
||||
const branch = (await GitProcess.exec(['rev-parse', '--abbrev-ref', 'HEAD'], gitDir)).stdout.trim()
|
||||
const branch = (await GitProcess.exec(['rev-parse', '--abbrev-ref', 'HEAD'], ELECTRON_DIR)).stdout.trim()
|
||||
if (branch === 'master') {
|
||||
next = semver.inc(await getLastMajorForMaster(), 'major')
|
||||
} else if (isStable(v)) {
|
||||
@@ -70,6 +70,23 @@ async function nextNightly (v) {
|
||||
return `${next}-${pre}`
|
||||
}
|
||||
|
||||
async function getLastMajorForMaster () {
|
||||
let branchNames
|
||||
const result = await GitProcess.exec(['branch', '-a', '--remote', '--list', 'origin/[0-9]-[0-9]-x'], ELECTRON_DIR)
|
||||
if (result.exitCode === 0) {
|
||||
branchNames = result.stdout.trim().split('\n')
|
||||
const filtered = branchNames.map(b => b.replace('origin/', ''))
|
||||
return getNextReleaseBranch(filtered)
|
||||
} else {
|
||||
throw new Error('Release branches could not be fetched.')
|
||||
}
|
||||
}
|
||||
|
||||
function getNextReleaseBranch (branches) {
|
||||
const converted = branches.map(b => b.replace(/-/g, '.').replace('x', '0'))
|
||||
return converted.reduce((v1, v2) => semver.gt(v1, v2) ? v1 : v2)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isStable,
|
||||
isBeta,
|
||||
@@ -63,7 +63,7 @@ class Menu : public mate::TrackableObject<Menu>,
|
||||
const base::Closure& callback) = 0;
|
||||
virtual void ClosePopupAt(int32_t window_id) = 0;
|
||||
|
||||
std::unique_ptr<AtomMenuModel> model_;
|
||||
scoped_refptr<AtomMenuModel> model_;
|
||||
Menu* parent_ = nullptr;
|
||||
|
||||
// Observable:
|
||||
|
||||
@@ -628,6 +628,10 @@ void SystemPreferences::RemoveUserDefault(const std::string& name) {
|
||||
}
|
||||
|
||||
bool SystemPreferences::IsDarkMode() {
|
||||
if (@available(macOS 10.14, *)) {
|
||||
return [[NSApplication sharedApplication].effectiveAppearance.name
|
||||
isEqualToString:NSAppearanceNameDarkAqua];
|
||||
}
|
||||
NSString* mode = [[NSUserDefaults standardUserDefaults]
|
||||
stringForKey:@"AppleInterfaceStyle"];
|
||||
return [mode isEqualToString:@"Dark"];
|
||||
|
||||
@@ -50,8 +50,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 7,0,0,20190622
|
||||
PRODUCTVERSION 7,0,0,20190622
|
||||
FILEVERSION 7,0,0,20190625
|
||||
PRODUCTVERSION 7,0,0,20190625
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
|
||||
namespace electron {
|
||||
|
||||
class AtomMenuModel : public ui::SimpleMenuModel {
|
||||
class AtomMenuModel : public ui::SimpleMenuModel,
|
||||
public base::RefCounted<AtomMenuModel> {
|
||||
public:
|
||||
class Delegate : public ui::SimpleMenuModel::Delegate {
|
||||
public:
|
||||
@@ -48,7 +49,6 @@ class AtomMenuModel : public ui::SimpleMenuModel {
|
||||
};
|
||||
|
||||
explicit AtomMenuModel(Delegate* delegate);
|
||||
~AtomMenuModel() override;
|
||||
|
||||
void AddObserver(Observer* obs) { observers_.AddObserver(obs); }
|
||||
void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); }
|
||||
@@ -69,6 +69,9 @@ class AtomMenuModel : public ui::SimpleMenuModel {
|
||||
AtomMenuModel* GetSubmenuModelAt(int index);
|
||||
|
||||
private:
|
||||
friend class base::RefCounted<AtomMenuModel>;
|
||||
~AtomMenuModel() override;
|
||||
|
||||
Delegate* delegate_; // weak ref.
|
||||
|
||||
std::map<int, base::string16> roles_; // command id -> role
|
||||
|
||||
@@ -30,6 +30,7 @@ class TrayIconCocoa : public TrayIcon, public AtomMenuModel::Observer {
|
||||
void SetHighlightMode(TrayIcon::HighlightMode mode) override;
|
||||
void SetIgnoreDoubleClickEvents(bool ignore) override;
|
||||
bool GetIgnoreDoubleClickEvents() override;
|
||||
void PopUpOnUI(scoped_refptr<AtomMenuModel> menu_model);
|
||||
void PopUpContextMenu(const gfx::Point& pos,
|
||||
AtomMenuModel* menu_model) override;
|
||||
void SetContextMenu(AtomMenuModel* menu_model) override;
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/mac/sdk_forward_declarations.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "shell/browser/mac/atom_application.h"
|
||||
#include "shell/browser/ui/cocoa/NSString+ANSI.h"
|
||||
#include "shell/browser/ui/cocoa/atom_menu_controller.h"
|
||||
@@ -333,6 +337,7 @@ const CGFloat kVerticalTitleMargin = 2;
|
||||
}
|
||||
|
||||
- (void)popUpContextMenu:(electron::AtomMenuModel*)menu_model {
|
||||
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
|
||||
// Show a custom menu.
|
||||
if (menu_model) {
|
||||
base::scoped_nsobject<AtomMenuController> menuController(
|
||||
@@ -340,6 +345,8 @@ const CGFloat kVerticalTitleMargin = 2;
|
||||
useDefaultAccelerator:NO]);
|
||||
forceHighlight_ = YES; // Should highlight when showing menu.
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
base::mac::ScopedSendingEvent sendingEventScoper;
|
||||
[statusItem_ popUpStatusItemMenu:[menuController menu]];
|
||||
forceHighlight_ = NO;
|
||||
[self setNeedsDisplay:YES];
|
||||
@@ -349,6 +356,8 @@ const CGFloat kVerticalTitleMargin = 2;
|
||||
if (menuController_ && ![menuController_ isMenuOpen]) {
|
||||
// Redraw the tray icon to show highlight if it is enabled.
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
base::mac::ScopedSendingEvent sendingEventScoper;
|
||||
[statusItem_ popUpStatusItemMenu:[menuController_ menu]];
|
||||
// The popUpStatusItemMenu returns only after the showing menu is closed.
|
||||
// When it returns, we need to redraw the tray icon to not show highlight.
|
||||
@@ -489,9 +498,17 @@ bool TrayIconCocoa::GetIgnoreDoubleClickEvents() {
|
||||
return [status_item_view_ getIgnoreDoubleClickEvents];
|
||||
}
|
||||
|
||||
void TrayIconCocoa::PopUpOnUI(scoped_refptr<AtomMenuModel> menu_model) {
|
||||
if (auto* model = menu_model.get())
|
||||
[status_item_view_ popUpContextMenu:model];
|
||||
}
|
||||
|
||||
void TrayIconCocoa::PopUpContextMenu(const gfx::Point& pos,
|
||||
AtomMenuModel* menu_model) {
|
||||
[status_item_view_ popUpContextMenu:menu_model];
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&TrayIconCocoa::PopUpOnUI, base::Unretained(this),
|
||||
base::WrapRefCounted(menu_model)));
|
||||
}
|
||||
|
||||
void TrayIconCocoa::SetContextMenu(AtomMenuModel* menu_model) {
|
||||
|
||||
@@ -606,8 +606,10 @@ describe('BrowserWindow module', () => {
|
||||
|
||||
const otherWindow = new BrowserWindow({ show: false, title: 'otherWindow' })
|
||||
const otherWindowShown = emittedOnce(otherWindow, 'show')
|
||||
const otherWindowFocused = emittedOnce(otherWindow, 'focus')
|
||||
otherWindow.show()
|
||||
await otherWindowShown
|
||||
await otherWindowFocused
|
||||
expect(otherWindow.isFocused()).to.equal(true)
|
||||
|
||||
w.moveTop()
|
||||
|
||||
78
spec-main/api-screen-spec.ts
Normal file
78
spec-main/api-screen-spec.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import { expect } from 'chai'
|
||||
import { screen } from 'electron'
|
||||
|
||||
describe('screen module', () => {
|
||||
describe('screen.getCursorScreenPoint()', () => {
|
||||
it('returns a point object', () => {
|
||||
const point = screen.getCursorScreenPoint()
|
||||
expect(point.x).to.be.a('number')
|
||||
expect(point.y).to.be.a('number')
|
||||
})
|
||||
})
|
||||
|
||||
describe('screen.getPrimaryDisplay()', () => {
|
||||
it('returns a display object', () => {
|
||||
const display = screen.getPrimaryDisplay()
|
||||
expect(display).to.be.an('object')
|
||||
})
|
||||
|
||||
it('has the correct non-object properties', function () {
|
||||
if (process.platform === 'linux') this.skip()
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.property('scaleFactor').that.is.a('number')
|
||||
expect(display).to.have.property('id').that.is.a('number')
|
||||
expect(display).to.have.property('rotation').that.is.a('number')
|
||||
expect(display).to.have.property('touchSupport').that.is.a('string')
|
||||
expect(display).to.have.property('accelerometerSupport').that.is.a('string')
|
||||
expect(display).to.have.property('internal').that.is.a('boolean')
|
||||
expect(display).to.have.property('monochrome').that.is.a('boolean')
|
||||
expect(display).to.have.property('depthPerComponent').that.is.a('number')
|
||||
expect(display).to.have.property('colorDepth').that.is.a('number')
|
||||
expect(display).to.have.property('colorSpace').that.is.a('string')
|
||||
})
|
||||
|
||||
it('has a size object property', function () {
|
||||
if (process.platform === 'linux') this.skip()
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.property('size').that.is.an('object')
|
||||
const size = display.size
|
||||
expect(size).to.have.property('width').that.is.greaterThan(0)
|
||||
expect(size).to.have.property('height').that.is.greaterThan(0)
|
||||
})
|
||||
|
||||
it('has a workAreaSize object property', function () {
|
||||
if (process.platform === 'linux') this.skip()
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.property('workAreaSize').that.is.an('object')
|
||||
const workAreaSize = display.workAreaSize
|
||||
expect(workAreaSize).to.have.property('width').that.is.greaterThan(0)
|
||||
expect(workAreaSize).to.have.property('height').that.is.greaterThan(0)
|
||||
})
|
||||
|
||||
it('has a bounds object property', function () {
|
||||
if (process.platform === 'linux') this.skip()
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.property('bounds').that.is.an('object')
|
||||
const bounds = display.bounds
|
||||
expect(bounds).to.have.property('x').that.is.a('number')
|
||||
expect(bounds).to.have.property('y').that.is.a('number')
|
||||
expect(bounds).to.have.property('width').that.is.greaterThan(0)
|
||||
expect(bounds).to.have.property('height').that.is.greaterThan(0)
|
||||
})
|
||||
|
||||
it('has a workArea object property', function () {
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.property('workArea').that.is.an('object')
|
||||
const workArea = display.workArea
|
||||
expect(workArea).to.have.property('x').that.is.a('number')
|
||||
expect(workArea).to.have.property('y').that.is.a('number')
|
||||
expect(workArea).to.have.property('width').that.is.greaterThan(0)
|
||||
expect(workArea).to.have.property('height').that.is.greaterThan(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,78 +0,0 @@
|
||||
const { expect } = require('chai')
|
||||
const { screen } = require('electron').remote
|
||||
|
||||
describe('screen module', () => {
|
||||
describe('screen.getCursorScreenPoint()', () => {
|
||||
it('returns a point object', () => {
|
||||
const point = screen.getCursorScreenPoint()
|
||||
expect(point.x).to.be.a('number')
|
||||
expect(point.y).to.be.a('number')
|
||||
})
|
||||
})
|
||||
|
||||
describe('screen.getPrimaryDisplay()', () => {
|
||||
it('returns a display object', () => {
|
||||
const display = screen.getPrimaryDisplay()
|
||||
expect(display).to.be.an('object')
|
||||
})
|
||||
|
||||
it('has the correct non-object properties', function () {
|
||||
if (process.platform === 'linux') this.skip()
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.a.property('scaleFactor').that.is.a('number')
|
||||
expect(display).to.have.a.property('id').that.is.a('number')
|
||||
expect(display).to.have.a.property('rotation').that.is.a('number')
|
||||
expect(display).to.have.a.property('touchSupport').that.is.a('string')
|
||||
expect(display).to.have.a.property('accelerometerSupport').that.is.a('string')
|
||||
expect(display).to.have.a.property('internal').that.is.a('boolean')
|
||||
expect(display).to.have.a.property('monochrome').that.is.a('boolean')
|
||||
expect(display).to.have.a.property('depthPerComponent').that.is.a('number')
|
||||
expect(display).to.have.a.property('colorDepth').that.is.a('number')
|
||||
expect(display).to.have.a.property('colorSpace').that.is.a('string')
|
||||
})
|
||||
|
||||
it('has a size object property', function () {
|
||||
if (process.platform === 'linux') this.skip()
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.a.property('size').that.is.an('object')
|
||||
const size = display.size
|
||||
expect(size).to.have.a.property('width').that.is.greaterThan(0)
|
||||
expect(size).to.have.a.property('height').that.is.greaterThan(0)
|
||||
})
|
||||
|
||||
it('has a workAreaSize object property', function () {
|
||||
if (process.platform === 'linux') this.skip()
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.a.property('workAreaSize').that.is.an('object')
|
||||
const workAreaSize = display.workAreaSize
|
||||
expect(workAreaSize).to.have.a.property('width').that.is.greaterThan(0)
|
||||
expect(workAreaSize).to.have.a.property('height').that.is.greaterThan(0)
|
||||
})
|
||||
|
||||
it('has a bounds object property', function () {
|
||||
if (process.platform === 'linux') this.skip()
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.a.property('bounds').that.is.an('object')
|
||||
const bounds = display.bounds
|
||||
expect(bounds).to.have.a.property('x').that.is.a('number')
|
||||
expect(bounds).to.have.a.property('y').that.is.a('number')
|
||||
expect(bounds).to.have.a.property('width').that.is.greaterThan(0)
|
||||
expect(bounds).to.have.a.property('height').that.is.greaterThan(0)
|
||||
})
|
||||
|
||||
it('has a workArea object property', function () {
|
||||
const display = screen.getPrimaryDisplay()
|
||||
|
||||
expect(display).to.have.a.property('workArea').that.is.an('object')
|
||||
const workArea = display.workArea
|
||||
expect(workArea).to.have.a.property('x').that.is.a('number')
|
||||
expect(workArea).to.have.a.property('y').that.is.a('number')
|
||||
expect(workArea).to.have.a.property('width').that.is.greaterThan(0)
|
||||
expect(workArea).to.have.a.property('height').that.is.greaterThan(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -31,7 +31,7 @@ describe('renderer nodeIntegrationInSubFrames', () => {
|
||||
})
|
||||
|
||||
it('should load preload scripts in top level iframes', async () => {
|
||||
const detailsPromise = emittedNTimes(remote.ipcMain, 'preload-ran', 2)
|
||||
const detailsPromise = emittedNTimes(ipcMain, 'preload-ran', 2)
|
||||
w.loadFile(path.resolve(__dirname, `fixtures/sub-frames/frame-container${fixtureSuffix}.html`))
|
||||
const [event1, event2] = await detailsPromise
|
||||
expect(event1[0].frameId).to.not.equal(event2[0].frameId)
|
||||
@@ -40,7 +40,7 @@ describe('renderer nodeIntegrationInSubFrames', () => {
|
||||
})
|
||||
|
||||
it('should load preload scripts in nested iframes', async () => {
|
||||
const detailsPromise = emittedNTimes(remote.ipcMain, 'preload-ran', 3)
|
||||
const detailsPromise = emittedNTimes(ipcMain, 'preload-ran', 3)
|
||||
w.loadFile(path.resolve(__dirname, `fixtures/sub-frames/frame-with-frame-container${fixtureSuffix}.html`))
|
||||
const [event1, event2, event3] = await detailsPromise
|
||||
expect(event1[0].frameId).to.not.equal(event2[0].frameId)
|
||||
@@ -52,37 +52,37 @@ describe('renderer nodeIntegrationInSubFrames', () => {
|
||||
})
|
||||
|
||||
it('should correctly reply to the main frame with using event.reply', async () => {
|
||||
const detailsPromise = emittedNTimes(remote.ipcMain, 'preload-ran', 2)
|
||||
const detailsPromise = emittedNTimes(ipcMain, 'preload-ran', 2)
|
||||
w.loadFile(path.resolve(__dirname, `fixtures/sub-frames/frame-container${fixtureSuffix}.html`))
|
||||
const [event1] = await detailsPromise
|
||||
const pongPromise = emittedOnce(remote.ipcMain, 'preload-pong')
|
||||
const pongPromise = emittedOnce(ipcMain, 'preload-pong')
|
||||
event1[0].reply('preload-ping')
|
||||
const details = await pongPromise
|
||||
expect(details[1]).to.equal(event1[0].frameId)
|
||||
})
|
||||
|
||||
it('should correctly reply to the sub-frames with using event.reply', async () => {
|
||||
const detailsPromise = emittedNTimes(remote.ipcMain, 'preload-ran', 2)
|
||||
const detailsPromise = emittedNTimes(ipcMain, 'preload-ran', 2)
|
||||
w.loadFile(path.resolve(__dirname, `fixtures/sub-frames/frame-container${fixtureSuffix}.html`))
|
||||
const [, event2] = await detailsPromise
|
||||
const pongPromise = emittedOnce(remote.ipcMain, 'preload-pong')
|
||||
const pongPromise = emittedOnce(ipcMain, 'preload-pong')
|
||||
event2[0].reply('preload-ping')
|
||||
const details = await pongPromise
|
||||
expect(details[1]).to.equal(event2[0].frameId)
|
||||
})
|
||||
|
||||
it('should correctly reply to the nested sub-frames with using event.reply', async () => {
|
||||
const detailsPromise = emittedNTimes(remote.ipcMain, 'preload-ran', 3)
|
||||
const detailsPromise = emittedNTimes(ipcMain, 'preload-ran', 3)
|
||||
w.loadFile(path.resolve(__dirname, `fixtures/sub-frames/frame-with-frame-container${fixtureSuffix}.html`))
|
||||
const [, , event3] = await detailsPromise
|
||||
const pongPromise = emittedOnce(remote.ipcMain, 'preload-pong')
|
||||
const pongPromise = emittedOnce(ipcMain, 'preload-pong')
|
||||
event3[0].reply('preload-ping')
|
||||
const details = await pongPromise
|
||||
expect(details[1]).to.equal(event3[0].frameId)
|
||||
})
|
||||
|
||||
it('should not expose globals in main world', async () => {
|
||||
const detailsPromise = emittedNTimes(remote.ipcMain, 'preload-ran', 2)
|
||||
const detailsPromise = emittedNTimes(ipcMain, 'preload-ran', 2)
|
||||
w.loadFile(path.resolve(__dirname, `fixtures/sub-frames/frame-container${fixtureSuffix}.html`))
|
||||
const details = await detailsPromise
|
||||
const senders = details.map(event => event[0].sender)
|
||||
@@ -176,9 +176,6 @@ describe('cross-site frame sandboxing', () => {
|
||||
server = null
|
||||
})
|
||||
|
||||
const fixtures = path.resolve(__dirname, 'fixtures')
|
||||
const preload = path.join(fixtures, 'module', 'preload-pid.js')
|
||||
|
||||
let w
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -212,6 +212,16 @@ describe('node feature', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('setTimeout called under blink env in renderer process', () => {
|
||||
it('can be scheduled in time', (done) => {
|
||||
setTimeout(done, 10)
|
||||
})
|
||||
|
||||
it('works from the timers module', (done) => {
|
||||
require('timers').setTimeout(done, 10)
|
||||
})
|
||||
})
|
||||
|
||||
describe('setInterval called under Chromium event loop in browser process', () => {
|
||||
it('can be scheduled in time', (done) => {
|
||||
let interval = null
|
||||
@@ -229,6 +239,40 @@ describe('node feature', () => {
|
||||
interval = remote.getGlobal('setInterval')(clear, 10)
|
||||
})
|
||||
})
|
||||
|
||||
describe('setInterval called under blink env in renderer process', () => {
|
||||
it('can be scheduled in time', (done) => {
|
||||
let interval = null
|
||||
let clearing = false
|
||||
const clear = () => {
|
||||
if (interval === null || clearing) return
|
||||
|
||||
// interval might trigger while clearing (remote is slow sometimes)
|
||||
clearing = true
|
||||
clearInterval(interval)
|
||||
clearing = false
|
||||
interval = null
|
||||
done()
|
||||
}
|
||||
interval = setInterval(clear, 10)
|
||||
})
|
||||
|
||||
it('can be scheduled in time from timers module', (done) => {
|
||||
let interval = null
|
||||
let clearing = false
|
||||
const clear = () => {
|
||||
if (interval === null || clearing) return
|
||||
|
||||
// interval might trigger while clearing (remote is slow sometimes)
|
||||
clearing = true
|
||||
require('timers').clearInterval(interval)
|
||||
clearing = false
|
||||
interval = null
|
||||
done()
|
||||
}
|
||||
interval = require('timers').setInterval(clear, 10)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('inspector', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { expect } = require('chai')
|
||||
const { remote } = require('electron')
|
||||
const { nextVersion } = require('../script/bump-version')
|
||||
const utils = require('../script/lib/version-utils')
|
||||
const { nextVersion } = require('../script/release/version-bumper')
|
||||
const utils = require('../script/release/version-utils')
|
||||
|
||||
const isCi = remote.getGlobal('isCi')
|
||||
|
||||
@@ -9,7 +9,7 @@ const isCi = remote.getGlobal('isCi')
|
||||
// gclient sync on a linux machine. These tests therefore don't run as expected
|
||||
const describeFn = (isCi && process.platform === 'darwin') ? describe.skip : describe
|
||||
|
||||
describeFn('bump-version utils', () => {
|
||||
describeFn('version-bumper', () => {
|
||||
it('makes a version with a period delimeter', () => {
|
||||
const components = {
|
||||
major: 2,
|
||||
@@ -46,7 +46,7 @@ describeFn('bump-version utils', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describeFn('bump-version script', () => {
|
||||
describeFn('version-bumper script', () => {
|
||||
const nightlyPattern = /[0-9.]*(-nightly.(\d{4})(\d{2})(\d{2}))$/g
|
||||
const betaPattern = /[0-9.]*(-beta[0-9.]*)/g
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
var path = require('path')
|
||||
|
||||
console.log(path.resolve(path.dirname(__dirname)))
|
||||
@@ -1,80 +0,0 @@
|
||||
var app = require('electron').app
|
||||
var fs = require('fs')
|
||||
var request = require('request')
|
||||
|
||||
var TARGET_URL = 'https://electronjs.org/headers/index.json'
|
||||
|
||||
function getDate () {
|
||||
var today = new Date()
|
||||
var year = today.getFullYear()
|
||||
var month = today.getMonth() + 1
|
||||
if (month <= 9) month = '0' + month
|
||||
var day = today.getDate()
|
||||
if (day <= 9) day = '0' + day
|
||||
return year + '-' + month + '-' + day
|
||||
}
|
||||
|
||||
function getInfoForCurrentVersion () {
|
||||
var json = {}
|
||||
json.version = process.versions.electron
|
||||
json.date = getDate()
|
||||
|
||||
var names = ['node', 'v8', 'uv', 'zlib', 'openssl', 'modules', 'chrome']
|
||||
for (var i in names) {
|
||||
var name = names[i]
|
||||
json[name] = process.versions[name]
|
||||
}
|
||||
|
||||
json.files = [
|
||||
'darwin-x64',
|
||||
'darwin-x64-symbols',
|
||||
'linux-ia32',
|
||||
'linux-ia32-symbols',
|
||||
'linux-x64',
|
||||
'linux-x64-symbols',
|
||||
'win32-ia32',
|
||||
'win32-ia32-symbols',
|
||||
'win32-x64',
|
||||
'win32-x64-symbols'
|
||||
]
|
||||
|
||||
return json
|
||||
}
|
||||
|
||||
function getIndexJsInServer (callback) {
|
||||
request(TARGET_URL, function (e, res, body) {
|
||||
if (e) {
|
||||
callback(e)
|
||||
} else if (res.statusCode !== 200) {
|
||||
callback(new Error('Server returned ' + res.statusCode))
|
||||
} else {
|
||||
callback(null, JSON.parse(body))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function findObjectByVersion (all, version) {
|
||||
for (var i in all) {
|
||||
if (all[i].version === version) return i
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
app.on('ready', function () {
|
||||
getIndexJsInServer(function (e, all) {
|
||||
if (e) {
|
||||
console.error(e)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
var current = getInfoForCurrentVersion()
|
||||
var found = findObjectByVersion(all, current.version)
|
||||
if (found === -1) {
|
||||
all.unshift(current)
|
||||
} else {
|
||||
all[found] = current
|
||||
}
|
||||
fs.writeFileSync(process.argv[2], JSON.stringify(all))
|
||||
process.exit(0)
|
||||
})
|
||||
})
|
||||
@@ -1,6 +0,0 @@
|
||||
var os = require('os')
|
||||
if (os.endianness) {
|
||||
console.log(require('os').endianness() === 'BE' ? 'big' : 'little')
|
||||
} else { // Your Node is rather old, but I don't care.
|
||||
console.log('little')
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This program wraps around pkg-config to generate the correct include and
|
||||
# library paths when cross-compiling using a sysroot.
|
||||
# The assumption is that the sysroot contains the .pc files in usr/lib/pkgconfig
|
||||
# and usr/share/pkgconfig (relative to the sysroot) and that they output paths
|
||||
# relative to some parent path of the sysroot.
|
||||
# This assumption is valid for a range of sysroots, in particular: a
|
||||
# LSB-compliant root filesystem mounted at the sysroot, and a board build
|
||||
# directory of a Chromium OS chroot.
|
||||
# Additional directories containing .pc files may be specified by setting
|
||||
# the PKG_CONFIG_PATH environment variable- these will be prepended to the
|
||||
# generated paths.
|
||||
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
|
||||
root="$1"
|
||||
shift
|
||||
target_arch="$1"
|
||||
shift
|
||||
libpath="$1"
|
||||
shift
|
||||
|
||||
if [ -z "$root" -o -z "$target_arch" ]
|
||||
then
|
||||
echo "usage: $0 /path/to/sysroot target_arch libdir [pkg-config-arguments] package" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python2=$(which python2)
|
||||
if [ ! -x "$python2" ] ; then
|
||||
python2=python
|
||||
fi
|
||||
|
||||
rewrite=`dirname $0`/rewrite_dirs.py
|
||||
package=${!#}
|
||||
|
||||
libdir=$root/usr/$libpath/pkgconfig:$root/usr/share/pkgconfig
|
||||
|
||||
set -e
|
||||
# Some sysroots, like the Chromium OS ones, may generate paths that are not
|
||||
# relative to the sysroot. For example,
|
||||
# /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths
|
||||
# relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of
|
||||
# relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr).
|
||||
# To support this correctly, it's necessary to extract the prefix to strip from
|
||||
# pkg-config's |prefix| variable.
|
||||
prefix=`PKG_CONFIG_LIBDIR=$libdir pkg-config --variable=prefix "$package" | sed -e 's|/usr$||'`
|
||||
result=`PKG_CONFIG_LIBDIR=$libdir pkg-config "$@"`
|
||||
echo "$result"| $python2 $rewrite --sysroot "$root" --strip-prefix "$prefix"
|
||||
@@ -1,72 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Rewrites paths in -I, -L and other option to be relative to a sysroot."""
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import os
|
||||
import optparse
|
||||
|
||||
REWRITE_PREFIX = ['-I',
|
||||
'-idirafter',
|
||||
'-imacros',
|
||||
'-imultilib',
|
||||
'-include',
|
||||
'-iprefix',
|
||||
'-iquote',
|
||||
'-isystem',
|
||||
'-L']
|
||||
|
||||
def RewritePath(path, opts):
|
||||
"""Rewrites a path by stripping the prefix and prepending the sysroot."""
|
||||
sysroot = opts.sysroot
|
||||
prefix = opts.strip_prefix
|
||||
if os.path.isabs(path) and not path.startswith(sysroot):
|
||||
if path.startswith(prefix):
|
||||
path = path[len(prefix):]
|
||||
path = path.lstrip('/')
|
||||
return os.path.join(sysroot, path)
|
||||
else:
|
||||
return path
|
||||
|
||||
|
||||
def RewriteLine(line, opts):
|
||||
"""Rewrites all the paths in recognized options."""
|
||||
args = line.split()
|
||||
count = len(args)
|
||||
i = 0
|
||||
while i < count:
|
||||
for prefix in REWRITE_PREFIX:
|
||||
# The option can be either in the form "-I /path/to/dir" or
|
||||
# "-I/path/to/dir" so handle both.
|
||||
if args[i] == prefix:
|
||||
i += 1
|
||||
try:
|
||||
args[i] = RewritePath(args[i], opts)
|
||||
except IndexError:
|
||||
sys.stderr.write('Missing argument following %s\n' % prefix)
|
||||
break
|
||||
elif args[i].startswith(prefix):
|
||||
args[i] = prefix + RewritePath(args[i][len(prefix):], opts)
|
||||
i += 1
|
||||
|
||||
return ' '.join(args)
|
||||
|
||||
|
||||
def main(argv):
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option('-s', '--sysroot', default='/', help='sysroot to prepend')
|
||||
parser.add_option('-p', '--strip-prefix', default='', help='prefix to strip')
|
||||
opts, args = parser.parse_args(argv[1:])
|
||||
|
||||
for line in sys.stdin.readlines():
|
||||
line = RewriteLine(line.strip(), opts)
|
||||
print(line)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -1,100 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# Reads etc/ld.so.conf and/or etc/ld.so.conf.d/*.conf and returns the
|
||||
# appropriate linker flags.
|
||||
#
|
||||
# sysroot_ld_path.sh /abspath/to/sysroot
|
||||
#
|
||||
|
||||
log_error_and_exit() {
|
||||
echo $0: $@
|
||||
exit 1
|
||||
}
|
||||
|
||||
process_entry() {
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
log_error_and_exit "bad arguments to process_entry()"
|
||||
fi
|
||||
local root="$1"
|
||||
local localpath="$2"
|
||||
|
||||
echo $localpath | grep -qs '^/'
|
||||
if [ $? -ne 0 ]; then
|
||||
log_error_and_exit $localpath does not start with /
|
||||
fi
|
||||
local entry="$root$localpath"
|
||||
echo -L$entry
|
||||
echo -Wl,-rpath-link=$entry
|
||||
}
|
||||
|
||||
process_ld_so_conf() {
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
log_error_and_exit "bad arguments to process_ld_so_conf()"
|
||||
fi
|
||||
local root="$1"
|
||||
local ld_so_conf="$2"
|
||||
|
||||
# ld.so.conf may include relative include paths. pushd is a bashism.
|
||||
local saved_pwd=$(pwd)
|
||||
cd $(dirname "$ld_so_conf")
|
||||
|
||||
cat "$ld_so_conf" | \
|
||||
while read ENTRY; do
|
||||
echo "$ENTRY" | grep -qs ^include
|
||||
if [ $? -eq 0 ]; then
|
||||
local included_files=$(echo "$ENTRY" | sed 's/^include //')
|
||||
echo "$included_files" | grep -qs ^/
|
||||
if [ $? -eq 0 ]; then
|
||||
if ls $root$included_files >/dev/null 2>&1 ; then
|
||||
for inc_file in $root$included_files; do
|
||||
process_ld_so_conf "$root" "$inc_file"
|
||||
done
|
||||
fi
|
||||
else
|
||||
if ls $(pwd)/$included_files >/dev/null 2>&1 ; then
|
||||
for inc_file in $(pwd)/$included_files; do
|
||||
process_ld_so_conf "$root" "$inc_file"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$ENTRY" | grep -qs ^/
|
||||
if [ $? -eq 0 ]; then
|
||||
process_entry "$root" "$ENTRY"
|
||||
fi
|
||||
done
|
||||
|
||||
# popd is a bashism
|
||||
cd "$saved_pwd"
|
||||
}
|
||||
|
||||
# Main
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo Usage $0 /abspath/to/sysroot
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $1 | grep -qs ' '
|
||||
if [ $? -eq 0 ]; then
|
||||
log_error_and_exit $1 contains whitespace.
|
||||
fi
|
||||
|
||||
LD_SO_CONF="$1/etc/ld.so.conf"
|
||||
LD_SO_CONF_D="$1/etc/ld.so.conf.d"
|
||||
|
||||
if [ -e "$LD_SO_CONF" ]; then
|
||||
process_ld_so_conf "$1" "$LD_SO_CONF" | xargs echo
|
||||
elif [ -e "$LD_SO_CONF_D" ]; then
|
||||
find "$LD_SO_CONF_D" -maxdepth 1 -name '*.conf' -print -quit > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
for entry in $LD_SO_CONF_D/*.conf; do
|
||||
process_ld_so_conf "$1" "$entry"
|
||||
done | xargs echo
|
||||
fi
|
||||
fi
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# usage: make_locale_paks build_dir [...]
|
||||
#
|
||||
# This script creates the .pak files under locales directory, it is used to fool
|
||||
# the ResourcesBundle that the locale is available.
|
||||
|
||||
import errno
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
def main():
|
||||
target_dir = sys.argv[1]
|
||||
locale_dir = os.path.join(target_dir, 'locales')
|
||||
safe_mkdir(locale_dir)
|
||||
for pak in sys.argv[2:]:
|
||||
touch(os.path.join(locale_dir, pak + '.pak'))
|
||||
|
||||
|
||||
def touch(filename):
|
||||
with open(filename, 'w+'):
|
||||
pass
|
||||
|
||||
|
||||
def safe_mkdir(path):
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
@@ -1,4 +0,0 @@
|
||||
export DISPLAY=":99.0"
|
||||
sh -e /etc/init.d/xvfb start
|
||||
cd /tmp/workspace/project/
|
||||
out/D/electron --version
|
||||
Reference in New Issue
Block a user