Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: samples/third_party/dromaeo/generate_dart2js_tests.py

Issue 10407099: Generate dart2js versions of Dromaeo (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/third_party/dromaeo/Suites.dart ('k') | samples/third_party/dromaeo/generate_frog_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/third_party/dromaeo/generate_dart2js_tests.py
diff --git a/samples/third_party/dromaeo/generate_frog_tests.py b/samples/third_party/dromaeo/generate_dart2js_tests.py
similarity index 69%
rename from samples/third_party/dromaeo/generate_frog_tests.py
rename to samples/third_party/dromaeo/generate_dart2js_tests.py
index ad32d298ff526d525d9836a4f909031517eeb741..81e6ff03b4ee7ce1c845b41f3b6240e198fd01f4 100755
--- a/samples/third_party/dromaeo/generate_frog_tests.py
+++ b/samples/third_party/dromaeo/generate_dart2js_tests.py
@@ -15,14 +15,19 @@ TOOLS_PATH = os.path.join(DART_PATH, 'tools')
sys.path.append(TOOLS_PATH)
import utils
-def Compile(source, target):
+EXECUTABLE_MAP = {
+ 'frog': 'frogc',
+ 'dart2js': 'dart2js'
+}
+
+def Compile(source, target, compiler):
+ executable = EXECUTABLE_MAP[compiler]
binary = os.path.abspath(os.path.join(DART_PATH,
utils.GetBuildRoot(utils.GuessOS(),
'release', 'ia32'),
- 'dart-sdk', 'bin', 'frogc'))
+ 'dart-sdk', 'bin', executable))
- cmd = [binary, '--compile-only',
- '--out=' + target]
+ cmd = [binary, '--out=' + target]
cmd.append(source)
print 'Executing: ' + ' '.join(cmd)
if platform.system() == "Windows":
@@ -30,11 +35,11 @@ def Compile(source, target):
else:
subprocess.call(cmd)
-def HtmlConvert(infile):
+def HtmlConvert(infile, compiler):
(head, tail) = os.path.split(infile)
if head == 'tests':
- outdir = 'frog'
+ outdir = compiler
os.chdir('tests')
if not os.path.exists(outdir):
os.makedirs(outdir)
@@ -52,10 +57,12 @@ def HtmlConvert(infile):
for line in infile:
result = re.search(pattern, line)
if result:
- dartname = result.group(1) + '.dart'
- jsname = os.path.join(outdir, dartname + '.js')
- Compile(dartname, jsname)
- script = '<script type="text/javascript" src="%s">' % (dartname + '.js')
+ testname = result.group(1)
+ dartname = testname + '.dart'
+ jsname = '%s.%s.js' % (testname, compiler)
+ outname = os.path.join(outdir, jsname)
+ Compile(dartname, outname, compiler)
+ script = '<script type="text/javascript" src="%s">' % jsname
outfile.write(re.sub(pattern, script, line))
else:
outfile.write(line)
@@ -67,7 +74,8 @@ def HtmlConvert(infile):
tests = glob.glob('tests/dom-*-*.html')
for test in tests:
- HtmlConvert(test)
+ HtmlConvert(test, 'frog')
+ HtmlConvert(test, 'dart2js')
# Frog compile driver to index-js.html.
-HtmlConvert('index.html')
+HtmlConvert('index.html', 'frog')
« no previous file with comments | « samples/third_party/dromaeo/Suites.dart ('k') | samples/third_party/dromaeo/generate_frog_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698