Flutter Engine
The Flutter Engine
Functions | Variables
dom Namespace Reference

Functions

def help ()
 
def analyze ()
 
def build ()
 
def dart2js ()
 
def compile_dart2js (dart_file, checked)
 
def gen ()
 
def size_check ()
 
def test_ff ()
 
def test_drt ()
 
def test_chrome ()
 
def test_dart2js (browser, argv)
 
def test_server ()
 
def test_server_dartium ()
 
def start_test_server (port, build_directory)
 
def call (args)
 
def main ()
 

Variables

 dart_out_dir = utils.GetBuildRoot(utils.GuessOS(), 'release', '64')
 
 dart_bin = os.path.join(dart_out_dir, 'dart.exe')
 
 dart_dir
 
dictionary commands
 

Function Documentation

◆ analyze()

def dom.analyze ( )
 Runs the dart analyzer. 

Definition at line 43 of file dom.py.

43def analyze():
44 ''' Runs the dart analyzer. '''
45 return call([
46 os.path.join(dart_out_dir, 'dart-sdk', 'bin', 'dart'),
47 'analyze',
48 os.path.join('tests', 'lib', 'html', 'element_test.dart'),
49 ])
50
51
def analyze()
Definition: dom.py:43
def call(args)
Definition: dom.py:159

◆ build()

def dom.build ( )
 Builds the Dart binary 

Definition at line 52 of file dom.py.

52def build():
53 ''' Builds the Dart binary '''
54 return call([
55 os.path.join('tools', 'build.py'),
56 '--mode=release',
57 '--arch=ia32',
58 'runtime',
59 ])
60
61
def build()
Definition: dom.py:52

◆ call()

def dom.call (   args)

Definition at line 159 of file dom.py.

159def call(args):
160 print(' '.join(args))
161 pipe = subprocess.Popen(
162 args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
163 output, error = pipe.communicate()
164 if output:
165 print(output)
166 if error:
167 print(error)
168 return pipe.returncode
169
170
def print(*args, **kwargs)
Definition: run_tests.py:49
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ compile_dart2js()

def dom.compile_dart2js (   dart_file,
  checked 
)

Definition at line 66 of file dom.py.

66def compile_dart2js(dart_file, checked):
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]
70 if checked:
71 args.append('--checked')
72
73 call(args)
74 return out_file
75
76
def compile_dart2js(dart_file, checked)
Definition: dom.py:66

◆ dart2js()

def dom.dart2js ( )

Definition at line 62 of file dom.py.

62def dart2js():
63 compile_dart2js(argv.pop(0), True)
64
65
def dart2js()
Definition: dom.py:62

◆ gen()

def dom.gen ( )

Definition at line 77 of file dom.py.

77def gen():
78 os.chdir(os.path.join('tools', 'dom', 'scripts'))
79 result = call([
80 os.path.join(os.getcwd(), 'dartdomgenerator.py'), '--rebuild',
81 '--parallel', '--systems=htmldart2js,htmldartium'
82 ])
83 os.chdir(os.path.join('..', '..', '..'))
84 return result
85
86
def gen()
Definition: dom.py:77

◆ help()

def dom.help ( )

Definition at line 29 of file dom.py.

29def help():
30 print('Helper script to make it easy to perform common tasks encountered '
31 'during the life of a Dart DOM developer.\n'
32 '\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'
35 '\n'
36 'Or re-generate DOM classes and run the Dart analyzer:\n'
37 ' dom.py gen analyze\n')
38 print('Commands: ')
39 for cmd in sorted(commands.keys()):
40 print('\t%s - %s' % (cmd, commands[cmd][1]))
41
42
def help()
Definition: dom.py:29

◆ main()

def dom.main ( )

Definition at line 201 of file dom.py.

201def main():
202 success = True
203 argv.pop(0)
204
205 if not argv:
206 help()
207 success = False
208
209 while (argv):
210 # Make sure that we're always rooted in the dart root folder.
211 os.chdir(dart_dir)
212 command = argv.pop(0)
213
214 if not command in commands:
215 help()
216 success = False
217 break
218 returncode = commands[command][0]()
219 success = success and not bool(returncode)
220
221 sys.exit(not success)
222
223
def main()
Definition: dom.py:201

◆ size_check()

def dom.size_check ( )
 Displays the dart2js size of swarm. 

Definition at line 87 of file dom.py.

87def size_check():
88 ''' Displays the dart2js size of swarm. '''
89 dart_file = os.path.join('samples', 'swarm', 'swarm.dart')
90 out_file = compile_dart2js(dart_file, False)
91
92 return call([
93 'du',
94 '-kh',
95 '--apparent-size',
96 out_file,
97 ])
98
99 os.remove(out_file)
100 os.remove(out_file + '.deps')
101 os.remove(out_file + '.map')
102
103
def size_check()
Definition: dom.py:87

◆ start_test_server()

def dom.start_test_server (   port,
  build_directory 
)

Definition at line 146 of file dom.py.

146def start_test_server(port, build_directory):
147 print(
148 'Browse tests at '
149 '\033[94mhttp://localhost:%d/root_build/generated_tests/\033[0m' % port)
150 return call([
152 os.path.join('tools', 'testing', 'dart', 'http_server.dart'),
153 '--port=%d' % port,
154 '--crossOriginPort=%d' % (port + 1), '--network=0.0.0.0',
155 '--build-directory=%s' % build_directory
156 ])
157
158
def start_test_server(port, build_directory)
Definition: dom.py:146
def CheckedInSdkExecutable()
Definition: utils.py:504

◆ test_chrome()

def dom.test_chrome ( )

Definition at line 112 of file dom.py.

112def test_chrome():
113 test_dart2js('chrome', argv)
114
115
def test_chrome()
Definition: dom.py:112
def test_dart2js(browser, argv)
Definition: dom.py:116

◆ test_dart2js()

def dom.test_dart2js (   browser,
  argv 
)

Definition at line 116 of file dom.py.

116def test_dart2js(browser, argv):
117 cmd = [
118 os.path.join('tools', 'test.py'),
119 '-c',
120 'dart2js',
121 '-r',
122 browser,
123 '--mode=release',
124 '--checked',
125 '--arch=ia32',
126 '-v',
127 ]
128 if argv:
129 cmd.append(argv.pop(0))
130 else:
131 print(
132 'Test commands should be followed by tests to run. Defaulting to html'
133 )
134 cmd.append('html')
135 return call(cmd)
136
137

◆ test_drt()

def dom.test_drt ( )

Definition at line 108 of file dom.py.

108def test_drt():
109 test_dart2js('drt', argv)
110
111
def test_drt()
Definition: dom.py:108

◆ test_ff()

def dom.test_ff ( )

Definition at line 104 of file dom.py.

104def test_ff():
105 test_dart2js('ff', argv)
106
107
def test_ff()
Definition: dom.py:104

◆ test_server()

def dom.test_server ( )

Definition at line 138 of file dom.py.

138def test_server():
139 start_test_server(5400, os.path.join('out', 'ReleaseX64'))
140
141
def test_server()
Definition: dom.py:138

◆ test_server_dartium()

def dom.test_server_dartium ( )

Definition at line 142 of file dom.py.

143 start_test_server(5500, os.path.join('..', 'out', 'Release'))
144
145
def test_server_dartium()
Definition: dom.py:142

Variable Documentation

◆ commands

dictionary dom.commands
Initial value:
1= {
2 'analyze': [analyze, 'Run the dart analyzer'],
3 'build': [build, 'Build dart in release mode'],
4 'dart2js': [dart2js, 'Run dart2js on the .dart file specified'],
5 'gen': [gen, 'Re-generate DOM generated files (run go.sh)'],
6 'size_check': [size_check, 'Check the size of dart2js compiled Swarm'],
7 'test_chrome': [
8 test_chrome, 'Run tests in checked mode in Chrome.\n'
9 '\t\tOptionally provide name of test to run.'
10 ],
11 # TODO(antonm): fix option name.
12 'test_drt': [
13 test_drt, 'Run tests in checked mode in content shell.\n'
14 '\t\tOptionally provide name of test to run.'
15 ],
16 'test_ff': [
17 test_ff, 'Run tests in checked mode in Firefox.\n'
18 '\t\tOptionally provide name of test to run.'
19 ],
20 'test_server': [
21 test_server, 'Starts the testing server for manually '
22 'running browser tests.'
23 ],
24 'test_server_dartium': [
25 test_server_dartium, 'Starts the testing server for '
26 'manually running browser tests from a dartium enlistment.'
27 ],
28}

Definition at line 171 of file dom.py.

◆ dart_bin

dom.dart_bin = os.path.join(dart_out_dir, 'dart.exe')

Definition at line 19 of file dom.py.

◆ dart_dir

dom.dart_dir
Initial value:
1= os.path.abspath(
2 os.path.join(
3 os.path.dirname(os.path.realpath(__file__)), os.path.pardir,
4 os.path.pardir))

Definition at line 23 of file dom.py.

◆ dart_out_dir

dom.dart_out_dir = utils.GetBuildRoot(utils.GuessOS(), 'release', '64')

Definition at line 17 of file dom.py.