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

Unified Diff: third_party/pkg/update_angular.sh

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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 | « third_party/pkg/angular/webstorm-user-settings.jar ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/update_angular.sh
diff --git a/third_party/pkg/update_angular.sh b/third_party/pkg/update_angular.sh
new file mode 100755
index 0000000000000000000000000000000000000000..88dad3a7c12d73b0c10aef92892aeffad7f0b096
--- /dev/null
+++ b/third_party/pkg/update_angular.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# bail on error
+set -e
+
+source update.sh
+
+generate_test_files() {
+ pushd angular/test > /dev/null
+
+ local test_files=$(find * -name "*_spec.dart" \
+ -not -path "playback/*" \
+ -not -path "io/*" \
+ -not -path "*/generated_parser_spec.dart")
+ local out_dir='../../../../pkg/third_party/angular_tests'
+ rm -rf "${out_dir}"
+
+ for src_file in ${test_files}; do
+ local test_dir=$(dirname ${src_file})
+ mkdir -p "${out_dir}/${test_dir}"
+ local out_file="${out_dir}/${src_file}"
+ local out_file="${out_file%spec.dart}test.dart"
+ local import_file="$(echo "$(dirname "./${src_file}")/" \
Siggi Cherem (dart-lang) 2014/01/04 01:16:38 would it work here to just use echo $test_dir ?
+ | sed -e "s/[^\/]\+/../g")"
+ import_file="${import_file}../../third_party/pkg/angular/test/${src_file}"
+
+ if [[ "${src_file}}" =~ tools/* ]]; then
+ generate_vm_test ${import_file} ${out_file}
+ else
+ generate_browser_test ${import_file} ${out_file}
+ fi
+ done
+ popd > /dev/null
+}
+
+generate_browser_test() {
+ local import_file=$1
+ local out_file=$2
+
+ cat << END_TEMPLATE > ${out_file}
+/// auto-generated by generate_angular_tests.sh
+
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library angular_tests;
+
+import 'package:angular/mock/module.dart';
+import 'package:unittest/html_config.dart';
+import 'package:unittest/unittest.dart';
+import '${import_file}' as test_lib;
+
+main() {
+ useHtmlConfiguration();
+
+ setUp(() {
+ setUpInjector();
+ });
+
+ test_lib.main();
+}
+
+END_TEMPLATE
+}
+
+generate_vm_test() {
+ local import_file=$1
+ local out_file=$2
+
+ cat << END_TEMPLATE > ${out_file}
+/// auto-generated by update_angular.sh
+
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library angular_tests;
+
+import 'package:unittest/unittest.dart';
+import 'package:unittest/compact_vm_config.dart';
+import '${import_file}' as test_lib;
+
+main() {
+ useCompactVMConfiguration();
+
+ test_lib.main();
+}
+
+END_TEMPLATE
+}
+
+update "angular" "https://github.com/angular/angular.dart"
+
+echo "*** Generating test files"
+generate_test_files
« no previous file with comments | « third_party/pkg/angular/webstorm-user-settings.jar ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698