Skip to content

Commit

Permalink
build: store the patches config in a json file (electron#15395)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeykuzmin authored Nov 5, 2018
1 parent 9b05381 commit 32ea2b6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
1 change: 1 addition & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ hooks = [
'action': [
'python',
'src/electron/script/apply_all_patches.py',
'src/electron/patches/common/config.json',
],
},
{
Expand Down
11 changes: 11 additions & 0 deletions patches/common/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"src/electron/patches/common/chromium": "src",

"src/electron/patches/common/boringssl": "src/third_party/boringssl/src",

"src/electron/patches/common/ffmpeg": "src/third_party/ffmpeg",

"src/electron/patches/common/skia": "src/third_party/skia",

"src/electron/patches/common/v8": "src/v8"
}
34 changes: 15 additions & 19 deletions script/apply_all_patches.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
#!/usr/bin/env python

import argparse
import json
import sys

from lib import git
from lib.patches import patch_from_dir


patch_dirs = {
'src/electron/patches/common/chromium':
'src',

'src/electron/patches/common/boringssl':
'src/third_party/boringssl/src',

'src/electron/patches/common/ffmpeg':
'src/third_party/ffmpeg',

'src/electron/patches/common/skia':
'src/third_party/skia',

'src/electron/patches/common/v8':
'src/v8',
}


def apply_patches(dirs):
for patch_dir, repo in dirs.iteritems():
git.am(repo=repo, patch_data=patch_from_dir(patch_dir),
committer_name="Electron Scripts", committer_email="scripts@electron")


def parse_args():
parser = argparse.ArgumentParser(description='Apply Electron patches')
parser.add_argument('config', nargs='+',
type=argparse.FileType('r'),
help='patches\' config(s) in the JSON format')
return parser.parse_args()


def main():
apply_patches(patch_dirs)
configs = parse_args().config
for config_json in configs:
apply_patches(json.load(config_json))


if __name__ == '__main__':
Expand Down

0 comments on commit 32ea2b6

Please sign in to comment.