14sys.path.append(os.path.join(os.path.dirname(__file__),
'..'))
19 dart_bin = os.path.join(dart_out_dir,
'dart.exe')
21 dart_bin = os.path.join(dart_out_dir,
'dart')
23dart_dir = os.path.abspath(
25 os.path.dirname(os.path.realpath(__file__)), os.path.pardir,
30 print(
'Helper script to make it easy to perform common tasks encountered '
31 'during the life of a Dart DOM developer.\n'
33 'For example, to re-generate DOM classes then run a specific test:\n'
34 ' dom.py gen test_drt html/element_test\n'
36 'Or re-generate DOM classes and run the Dart analyzer:\n'
37 ' dom.py gen analyze\n')
39 for cmd
in sorted(commands.keys()):
40 print(
'\t%s - %s' % (cmd, commands[cmd][1]))
44 ''' Runs the dart analyzer. '''
46 os.path.join(dart_out_dir,
'dart-sdk',
'bin',
'dart'),
48 os.path.join(
'tests',
'lib',
'html',
'element_test.dart'),
53 ''' Builds the Dart binary '''
55 os.path.join(
'tools',
'build.py'),
67 out_file = dart_file +
'.js'
68 dart2js_path = os.path.join(dart_out_dir,
'dart-sdk',
'bin',
'dart2js')
69 args = [dart2js_path, dart_file,
'--library-root=sdk/',
'-o%s' % out_file]
71 args.append(
'--checked')
78 os.chdir(os.path.join(
'tools',
'dom',
'scripts'))
80 os.path.join(os.getcwd(),
'dartdomgenerator.py'),
'--rebuild',
81 '--parallel',
'--systems=htmldart2js,htmldartium'
83 os.chdir(os.path.join(
'..',
'..',
'..'))
88 ''' Displays the dart2js size of swarm. '''
89 dart_file = os.path.join(
'samples',
'swarm',
'swarm.dart')
100 os.remove(out_file +
'.deps')
101 os.remove(out_file +
'.map')
118 os.path.join(
'tools',
'test.py'),
129 cmd.append(argv.pop(0))
132 'Test commands should be followed by tests to run. Defaulting to html'
149 '\033[94mhttp://localhost:%d/root_build/generated_tests/\033[0m' % port)
152 os.path.join(
'tools',
'testing',
'dart',
'http_server.dart'),
154 '--crossOriginPort=%d' % (port + 1),
'--network=0.0.0.0',
155 '--build-directory=%s' % build_directory
161 pipe = subprocess.Popen(
162 args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
163 output, error = pipe.communicate()
168 return pipe.returncode
172 'analyze': [analyze,
'Run the dart analyzer'],
173 'build': [build,
'Build dart in release mode'],
174 'dart2js': [dart2js,
'Run dart2js on the .dart file specified'],
175 'gen': [gen,
'Re-generate DOM generated files (run go.sh)'],
176 'size_check': [size_check,
'Check the size of dart2js compiled Swarm'],
178 test_chrome,
'Run tests in checked mode in Chrome.\n'
179 '\t\tOptionally provide name of test to run.'
183 test_drt,
'Run tests in checked mode in content shell.\n'
184 '\t\tOptionally provide name of test to run.'
187 test_ff,
'Run tests in checked mode in Firefox.\n'
188 '\t\tOptionally provide name of test to run.'
191 test_server,
'Starts the testing server for manually '
192 'running browser tests.'
194 'test_server_dartium': [
195 test_server_dartium,
'Starts the testing server for '
196 'manually running browser tests from a dartium enlistment.'
212 command = argv.pop(0)
214 if not command
in commands:
218 returncode = commands[command][0]()
219 success = success
and not bool(returncode)
221 sys.exit(
not success)
224if __name__ ==
'__main__':
def test_server_dartium()
def compile_dart2js(dart_file, checked)
def test_dart2js(browser, argv)
def start_test_server(port, build_directory)
def print(*args, **kwargs)
def CheckedInSdkExecutable()
def GetBuildRoot(host_os, mode=None, arch=None, sanitizer=None)
static SkString join(const CommandLineFlags::StringArray &)