Merge bin/generate-requireall into build.py
This commit is contained in:
@@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
from optparse import OptionParser
|
|
||||||
import os
|
|
||||||
import os.path
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
|
||||||
|
|
||||||
option_parser = OptionParser()
|
|
||||||
option_parser.add_option('--require', action='append')
|
|
||||||
options, args = option_parser.parse_args(argv[1:])
|
|
||||||
|
|
||||||
requires = set(options.require or ())
|
|
||||||
for arg in args:
|
|
||||||
for dirpath, dirnames, filenames in os.walk(arg):
|
|
||||||
for filename in filenames:
|
|
||||||
if not filename.endswith('.js'):
|
|
||||||
continue
|
|
||||||
for line in open(os.path.join(dirpath, filename)):
|
|
||||||
m = re.match(r'goog\.provide\(\'(.*)\'\);', line)
|
|
||||||
if m:
|
|
||||||
requires.add(m.group(1))
|
|
||||||
|
|
||||||
for require in sorted(requires):
|
|
||||||
sys.stdout.write('goog.require(\'%s\');\n' % (require,))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(main(sys.argv))
|
|
||||||
13
build.py
13
build.py
@@ -5,6 +5,7 @@ import glob
|
|||||||
import gzip
|
import gzip
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@@ -103,9 +104,17 @@ def build_src_external_src_types_js(t):
|
|||||||
t.output('bin/generate-exports', '--typedef', 'src/objectliterals.exports')
|
t.output('bin/generate-exports', '--typedef', 'src/objectliterals.exports')
|
||||||
|
|
||||||
|
|
||||||
@pake.target('build/src/internal/src/requireall.js', 'bin/generate-requireall', SRC)
|
@pake.target('build/src/internal/src/requireall.js', SRC)
|
||||||
def build_src_internal_src_requireall_js(t):
|
def build_src_internal_src_requireall_js(t):
|
||||||
t.output('bin/generate-requireall', '--require=goog.dom')
|
requires = set(('goog.dom',))
|
||||||
|
for dependency in t.dependencies:
|
||||||
|
for line in open(dependency):
|
||||||
|
match = re.match(r'goog\.provide\(\'(.*)\'\);', line)
|
||||||
|
if match:
|
||||||
|
requires.add(match.group(1))
|
||||||
|
with open(t.name, 'w') as f:
|
||||||
|
for require in sorted(requires):
|
||||||
|
f.write('goog.require(\'%s\');\n' % (require,))
|
||||||
|
|
||||||
|
|
||||||
@pake.target('build/src/internal/src/types.js', 'bin/generate-exports', 'src/objectliterals.exports')
|
@pake.target('build/src/internal/src/types.js', 'bin/generate-exports', 'src/objectliterals.exports')
|
||||||
|
|||||||
Reference in New Issue
Block a user