mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Rewrite build_pkgs.sh and build_test_pkgs.sh in Dart.
The bots need to run these before running the tests, so I'm porting them to Dart so they'll run on Windows. As a nice bonus, they're much faster now, I'm assuming because we use one warmed up VM for all of the packages. build_test_pkgs.sh on my machine went from ~12 seconds to ~4. R=jmesserly@google.com, vsm@google.com Review URL: https://codereview.chromium.org/2498673003 .
This commit is contained in:
parent
6a458a8294
commit
926df1e5b3
5 changed files with 112 additions and 132 deletions
|
@ -70,7 +70,7 @@ script:
|
|||
- if [[ -z "$TEST" ]]; then ./tool/presubmit.sh ; fi
|
||||
- if [[ "$TEST" == coverage ]]; then ./tool/build_sdk.sh && ./tool/coverage.sh ; fi
|
||||
- if [[ "$TEST" == node ]]; then ./tool/node_test.sh ; fi
|
||||
- if [[ "$TEST" == package ]]; then ./tool/build_sdk.sh && ./tool/build_pkgs.sh ; fi
|
||||
- if [[ "$TEST" == package ]]; then ./tool/build_sdk.sh && ./tool/build_pkgs.dart ; fi
|
||||
env:
|
||||
- ANALYZER=master
|
||||
- ANALYZER=master DDC_BROWSERS=Firefox
|
||||
|
|
104
pkg/dev_compiler/tool/build_pkgs.dart
Executable file
104
pkg/dev_compiler/tool/build_pkgs.dart
Executable file
|
@ -0,0 +1,104 @@
|
|||
#!/usr/bin/env dart
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dev_compiler/src/compiler/command.dart';
|
||||
|
||||
/// Compiles the packages that the DDC tests use to JS into:
|
||||
///
|
||||
/// gen/codegen_output/pkg/...
|
||||
///
|
||||
/// Assumes the working directory is pkg/dev_compiler.
|
||||
///
|
||||
/// If no arguments are passed, builds the all of the modules tested on Travis.
|
||||
/// If "test" is passed, only builds the modules needed by the tests.
|
||||
void main(List<String> arguments) {
|
||||
var test = arguments.length == 1 && arguments[0] == 'test';
|
||||
|
||||
new Directory("gen/codegen_output/pkg").createSync(recursive: true);
|
||||
|
||||
// Build leaf packages. These have no other package dependencies.
|
||||
|
||||
// Under pkg.
|
||||
compileModule('async_helper');
|
||||
compileModule('expect', libs: ['minitest']);
|
||||
compileModule('js', libs: ['js_util']);
|
||||
if (!test) {
|
||||
compileModule('lookup_map');
|
||||
compileModule('meta');
|
||||
compileModule('microlytics', libs: ['html_channels']);
|
||||
compileModule('typed_mock');
|
||||
}
|
||||
|
||||
// Under third_party/pkg.
|
||||
compileModule('collection');
|
||||
compileModule('matcher');
|
||||
compileModule('path');
|
||||
if (!test) {
|
||||
compileModule('args', libs: ['command_runner']);
|
||||
compileModule('charcode');
|
||||
compileModule('fixnum');
|
||||
compileModule('logging');
|
||||
compileModule('markdown');
|
||||
compileModule('mime');
|
||||
compileModule('plugin', libs: ['manager']);
|
||||
compileModule('typed_data');
|
||||
compileModule('usage');
|
||||
compileModule('utf');
|
||||
compileModule('when');
|
||||
}
|
||||
|
||||
// Composite packages with dependencies.
|
||||
compileModule('stack_trace', deps: ['path']);
|
||||
if (!test) {
|
||||
compileModule('async', deps: ['collection']);
|
||||
}
|
||||
|
||||
if (test) {
|
||||
compileModule('unittest',
|
||||
deps: ['matcher', 'path', 'stack_trace'],
|
||||
libs: ['html_config', 'html_individual_config', 'html_enhanced_config'],
|
||||
unsafeForceCompile: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// Compiles a [module] with a single matching ".dart" library and additional
|
||||
/// [libs] and [deps] on other modules.
|
||||
void compileModule(String module,
|
||||
{List<String> libs, List<String> deps, bool unsafeForceCompile: false}) {
|
||||
var args = [
|
||||
'--dart-sdk-summary=lib/sdk/ddc_sdk.sum',
|
||||
'-ogen/codegen_output/pkg/$module.js'
|
||||
];
|
||||
|
||||
// There is always a library that matches the module.
|
||||
args.add('package:$module/$module.dart');
|
||||
|
||||
// Add any additional libraries.
|
||||
if (libs != null) {
|
||||
for (var lib in libs) {
|
||||
args.add('package:$module/$lib.dart');
|
||||
}
|
||||
}
|
||||
|
||||
// Add summaries for any modules this depends on.
|
||||
if (deps != null) {
|
||||
for (var dep in deps) {
|
||||
args.add('-sgen/codegen_output/pkg/$dep.sum');
|
||||
}
|
||||
}
|
||||
|
||||
if (unsafeForceCompile) {
|
||||
args.add('--unsafe-force-compile');
|
||||
}
|
||||
|
||||
// TODO(rnystrom): Hack. DDC has its own forked copy of async_helper that
|
||||
// has a couple of differences from pkg/async_helper. We should unfork them,
|
||||
// but I'm not sure how they'll affect the other non-DDC tests. For now, just
|
||||
// use ours.
|
||||
if (module == 'async_helper') {
|
||||
args.add('--url-mapping=package:async_helper/async_helper.dart,'
|
||||
'test/codegen/async_helper.dart');
|
||||
}
|
||||
|
||||
compile(args);
|
||||
}
|
|
@ -1,92 +1,5 @@
|
|||
#!/bin/bash
|
||||
set -e # bail on error
|
||||
|
||||
cd $( dirname "${BASH_SOURCE[0]}" )/..
|
||||
|
||||
mkdir -p gen/codegen_output/pkg/
|
||||
|
||||
SDK=--dart-sdk-summary=lib/sdk/ddc_sdk.sum
|
||||
|
||||
# Build leaf packages. These have no other package dependencies.
|
||||
|
||||
# Under pkg
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/async_helper.js \
|
||||
package:async_helper/async_helper.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/expect.js \
|
||||
package:expect/expect.dart \
|
||||
package:expect/minitest.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/js.js \
|
||||
package:js/js.dart \
|
||||
package:js/js_util.dart \
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/lookup_map.js \
|
||||
package:lookup_map/lookup_map.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/meta.js \
|
||||
package:meta/meta.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/microlytics.js \
|
||||
package:microlytics/microlytics.dart \
|
||||
package:microlytics/html_channels.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/typed_mock.js \
|
||||
package:typed_mock/typed_mock.dart
|
||||
|
||||
# Under third_party/pkg
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/args.js \
|
||||
package:args/args.dart \
|
||||
package:args/command_runner.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/charcode.js \
|
||||
package:charcode/charcode.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/collection.js \
|
||||
package:collection/collection.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/fixnum.js \
|
||||
package:fixnum/fixnum.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/logging.js \
|
||||
package:logging/logging.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/markdown.js \
|
||||
package:markdown/markdown.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/matcher.js \
|
||||
package:matcher/matcher.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/mime.js \
|
||||
package:mime/mime.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/path.js \
|
||||
package:path/path.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/plugin.js \
|
||||
package:plugin/plugin.dart \
|
||||
package:plugin/manager.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/typed_data.js \
|
||||
package:typed_data/typed_data.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/usage.js \
|
||||
package:usage/usage.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/utf.js \
|
||||
package:utf/utf.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/when.js \
|
||||
package:when/when.dart
|
||||
|
||||
# Composite packages with dependencies
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/async.js \
|
||||
-s gen/codegen_output/pkg/collection.sum \
|
||||
package:async/async.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/stack_trace.js \
|
||||
-s gen/codegen_output/pkg/path.sum \
|
||||
package:stack_trace/stack_trace.dart
|
||||
# TODO: This script is deprecated in favor of the Dart version. For now, forward
|
||||
# to it so existing scripts don't break. Eventually, delete this one.
|
||||
./tool/build_pkgs.dart
|
||||
|
|
|
@ -1,42 +1,5 @@
|
|||
#!/bin/bash
|
||||
set -e # bail on error
|
||||
|
||||
cd $( dirname "${BASH_SOURCE[0]}" )/..
|
||||
|
||||
mkdir -p gen/codegen_output/pkg/
|
||||
|
||||
SDK=--dart-sdk-summary=lib/sdk/ddc_sdk.sum
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/expect.js \
|
||||
package:expect/expect.dart \
|
||||
package:expect/minitest.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/async_helper.js \
|
||||
--url-mapping=package:async_helper/async_helper.dart,test/codegen/async_helper.dart \
|
||||
package:async_helper/async_helper.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/collection.js \
|
||||
package:collection/collection.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/js.js \
|
||||
package:js/js.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/matcher.js \
|
||||
package:matcher/matcher.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/path.js \
|
||||
package:path/path.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK -o gen/codegen_output/pkg/stack_trace.js \
|
||||
-s gen/codegen_output/pkg/path.sum \
|
||||
package:stack_trace/stack_trace.dart
|
||||
|
||||
./bin/dartdevc.dart $SDK --unsafe-force-compile \
|
||||
-o gen/codegen_output/pkg/unittest.js \
|
||||
-s gen/codegen_output/pkg/matcher.sum \
|
||||
-s gen/codegen_output/pkg/path.sum \
|
||||
-s gen/codegen_output/pkg/stack_trace.sum \
|
||||
package:unittest/unittest.dart \
|
||||
package:unittest/html_config.dart \
|
||||
package:unittest/html_individual_config.dart \
|
||||
package:unittest/html_enhanced_config.dart
|
||||
# TODO: This script is deprecated in favor of the Dart version. For now, forward
|
||||
# to it so existing scripts don't break. Eventually, delete this one.
|
||||
./tool/build_pkgs.dart test
|
||||
|
|
|
@ -27,7 +27,7 @@ if [ -d gen/codegen_output ]; then
|
|||
rm -r gen/codegen_output || fail
|
||||
fi
|
||||
|
||||
./tool/build_test_pkgs.sh
|
||||
./tool/build_pkgs.dart test
|
||||
|
||||
# Make sure we don't run tests in code coverage mode.
|
||||
# this will cause us to generate files that are not part of the baseline
|
||||
|
|
Loading…
Reference in a new issue