forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a wrapper script for deps.js file generation, make misc changes t…
…o jinja template, and update ChromeVox Next to be a consumer. - adds a python script for deps file generation with the ability to ermap path dirnames. - add a gypi file to invoke the python script based on top level js files (root of a goog.provide/require dependency graph). Reuses jsbundler to get the topological listing. - add a new jinja option (use_chromevox_next), which hinges upon the existing use_chromevox_next gyp variable. - copy all js files using the new copy_js gypi for Cvox next. (we're not flattening at all for cv next). BUG=none Review URL: https://codereview.chromium.org/310743002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275092 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
dtseng@chromium.org
committed
Jun 5, 2014
1 parent
1edbb1d
commit acc3048
Showing
16 changed files
with
264 additions
and
93 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
chrome/browser/resources/chromeos/braille_ime/braille_ime.gyp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2014 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. | ||
|
||
{ | ||
'conditions': [ | ||
['chromeos==1', { | ||
'targets': [ | ||
{ | ||
'target_name': 'braille_ime_manifest', | ||
'type': 'none', | ||
'copies': [ | ||
{ | ||
'destination': '<(PRODUCT_DIR)/resources/chromeos/braille_ime', | ||
'files': [ | ||
'manifest.json', | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}], | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2014 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. | ||
# Common variables shared amongst all ChromeVox targets. | ||
|
||
{ | ||
'variables': { | ||
'chromevox_third_party_dir': '<(DEPTH)/chrome/third_party/chromevox', | ||
'closure_goog_dir': '<(chromevox_third_party_dir)/third_party/closure-library/closure/goog', | ||
'chromevox_dest_dir': '<(PRODUCT_DIR)/resources/chromeos/chromevox', | ||
'js_root_flags': [ | ||
'-r', '.', | ||
'-r', '<(closure_goog_dir)', | ||
], | ||
'path_rewrite_flags': [ | ||
'-w', '<(closure_goog_dir):closure', | ||
], | ||
'template_manifest_path': 'manifest.json.jinja2', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
chrome/browser/resources/chromeos/chromevox/generate_deps.gypi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2014 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. | ||
|
||
# Include this file in a target to generate a Closure style deps.js file. | ||
# | ||
# The following variables must be available when this file is included: | ||
# js_root_flags: List of '-r' flags to jsbundler.py for locating the | ||
# .js files. | ||
# deps_js_output_file: Where to write the generated deps file. | ||
|
||
{ | ||
'includes': ['common.gypi'], | ||
'actions': [ | ||
{ | ||
'action_name': 'generate_deps', | ||
'message': 'Generate deps for <(_target_name)', | ||
'variables': { | ||
'js_bundler_path': 'tools/jsbundler.py', | ||
'closure_depswriter_path': 'tools/generate_deps.py', | ||
'js_files': [ | ||
'<!@(python <(js_bundler_path) <(js_root_flags) <(_sources))' | ||
], | ||
}, | ||
'inputs': [ | ||
'<(js_bundler_path)', | ||
'<(closure_depswriter_path)', | ||
'<@(js_files)', | ||
], | ||
'outputs': [ | ||
'deps_js_output_file', | ||
], | ||
'action': [ | ||
'python', | ||
'<(closure_depswriter_path)', | ||
'-w', '<(closure_goog_dir):../closure/', | ||
'-w', ':../', | ||
'--output_file', '<(deps_js_output_file)', | ||
'<@(js_files)', | ||
], | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
chrome/browser/resources/chromeos/chromevox/tools/generate_deps.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python | ||
|
||
# Copyright 2014 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. | ||
|
||
''' Generates a deps.js file based on an input list of javascript files using | ||
Closure style provide/require calls. | ||
''' | ||
|
||
import optparse | ||
import os | ||
import sys | ||
|
||
from jsbundler import PathRewriter | ||
|
||
_SCRIPT_DIR = os.path.realpath(os.path.dirname(__file__)) | ||
_CHROME_SOURCE = os.path.realpath( | ||
os.path.join(_SCRIPT_DIR, *[os.path.pardir] * 6)) | ||
sys.path.insert(0, os.path.join( | ||
_CHROME_SOURCE, ('chrome/third_party/chromevox/third_party/' + | ||
'closure-library/closure/bin/build'))) | ||
import source | ||
|
||
|
||
def main(): | ||
parser = optparse.OptionParser(description=__doc__) | ||
parser.add_option('-w', '--rewrite_prefix', action='append', default=[], | ||
dest='prefix_map', metavar='SPEC', | ||
help=('Two path prefixes, separated by colons ' + | ||
'specifying that a file whose (relative) path ' + | ||
'name starts with the first prefix should have ' + | ||
'that prefix replaced by the second prefix to ' + | ||
'form a path relative to the output directory. ' + | ||
'The resulting path is used in the deps mapping ' + | ||
'file path to a list of provided and required ' + | ||
'namespaces.')) | ||
parser.add_option('-o', '--output_file', action='store', default=[], | ||
metavar='SPEC', | ||
help=('Where to output the generated deps file.')) | ||
options, args = parser.parse_args() | ||
|
||
path_rewriter = PathRewriter(options.prefix_map) | ||
|
||
# Write the generated deps file. | ||
with open(options.output_file, 'w') as output: | ||
for path in args: | ||
js_deps = source.Source(source.GetFileContents(path)) | ||
path = path_rewriter.RewritePath(path) | ||
line = 'goog.addDependency(\'%s\', %s, %s);\n' % ( | ||
path, sorted(js_deps.provides), sorted(js_deps.requires)) | ||
output.write(line) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.