Copy dart:html files to sdk_nnbd automatically and opt out

Change-Id: I78ab534da123afb12a31681b47ba1f2fb9567992
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124202
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Alan Knight <alanknight@google.com>
This commit is contained in:
Alan Knight 2019-11-06 23:59:33 +00:00 committed by commit-bot@chromium.org
parent d3d19f3ca5
commit 752bbce46f
8 changed files with 17 additions and 12 deletions

View file

@ -1,5 +1,4 @@
// @dart = 2.5
/**
* HTML elements and other resources for web-based applications that need to
* interact with the browser and the DOM (Document Object Model).

View file

@ -1,5 +1,4 @@
// @dart = 2.5
/**
* A client-side key-value store with support for indexes.
*

View file

@ -1,5 +1,4 @@
// @dart = 2.5
/**
* Scalable Vector Graphics:
* Two-dimensional vector graphics with support for events and animation.

View file

@ -1,5 +1,4 @@
// @dart = 2.5
/**
* High-fidelity audio programming in the browser.
*

View file

@ -1,5 +1,4 @@
// @dart = 2.5
/**
* 3D programming in the browser.
*

View file

@ -1,5 +1,4 @@
// @dart = 2.5
/**
* An API for storing data in the browser that can be queried with SQL.
*

View file

@ -120,6 +120,9 @@ def main(outdir=None, *inputs):
# Create file containing all imports, and inlining all sources
with open(outpath, 'w') as f:
prefix = os.environ.get('DART_HTML_PREFIX')
if prefix:
f.write(prefix + '\n')
if library.name:
if library.comment:
f.write('%s' % (''.join(library.comment)))

View file

@ -191,15 +191,16 @@ def GenerateFromDatabase(common_database,
monitored.FinishMonitoring(dart2js_output_dir, _logger)
def GenerateSingleFile(library_path, output_dir, generated_output_dir=None):
def GenerateSingleFile(library_path, output_dir, generated_output_dir=None, prefix=None):
library_dir = os.path.dirname(library_path)
library_filename = os.path.basename(library_path)
copy_dart_script = os.path.relpath('../../copy_dart.py', library_dir)
output_dir = os.path.relpath(output_dir, library_dir)
if not os.path.exists(library_dir):
os.makedirs(library_dir)
prefix_arg = 'export DART_HTML_PREFIX="' + prefix + '";' if prefix else ""
command = ' '.join([
'cd', library_dir, ';', copy_dart_script, output_dir, library_filename
prefix_arg, 'cd', library_dir, ';', copy_dart_script, output_dir, library_filename
])
subprocess.call([command], shell=True)
prebuilt_dartfmt = os.path.join(utils.CheckedInSdkPath(), 'bin', 'dartfmt')
@ -340,11 +341,18 @@ def main():
_logger.info('Generating dart2js single files.')
for library_name in HTML_LIBRARY_NAMES:
source = os.path.join(dart2js_output_dir,
'%s_dart2js.dart' % library_name)
GenerateSingleFile(
os.path.join(dart2js_output_dir,
'%s_dart2js.dart' % library_name),
os.path.join('..', '..', '..', 'sdk', 'lib', library_name,
'dart2js'))
source,
os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js'))
# TODO(Issue 38701): We won't need two copies once the NNBD SDK is
# unforked.
GenerateSingleFile(
source,
os.path.join('..', '..', '..', 'sdk_nnbd', 'lib', library_name, 'dart2js'),
None,
'// @dart = 2.5')
print '\nGenerating single file %s seconds' % round(
time.time() - file_generation_start_time, 2)