Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
dom Namespace Reference

Functions

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

Variables

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

Function Documentation

◆ analyze()

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

◆ build()

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
Definition build.py:1

◆ call()

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
void print(void *str)
Definition bridge.cpp:126

◆ compile_dart2js()

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

◆ dart2js()

dom.dart2js ( )

Definition at line 62 of file dom.py.

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

◆ gen()

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
Definition gen.py:1

◆ help()

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

◆ main()

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
Definition main.py:1

◆ size_check()

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

◆ start_test_server()

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
CheckedInSdkExecutable()
Definition utils.py:504

◆ test_chrome()

dom.test_chrome ( )

Definition at line 112 of file dom.py.

112def test_chrome():
113 test_dart2js('chrome', argv)
114
115

◆ test_dart2js()

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()

dom.test_drt ( )

Definition at line 108 of file dom.py.

108def test_drt():
109 test_dart2js('drt', argv)
110
111

◆ test_ff()

dom.test_ff ( )

Definition at line 104 of file dom.py.

104def test_ff():
105 test_dart2js('ff', argv)
106
107

◆ test_server()

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

◆ test_server_dartium()

dom.test_server_dartium ( )

Definition at line 142 of file dom.py.

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

Variable Documentation

◆ commands

dict 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.