Merge pull request #7 from dart-lang/rename
rename package to initialize
diff --git a/lib/build/loader_replacer.dart b/lib/build/loader_replacer.dart
index 5270f9d..5888036 100644
--- a/lib/build/loader_replacer.dart
+++ b/lib/build/loader_replacer.dart
@@ -1,7 +1,7 @@
// Copyright (c) 2015, 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 static_init.build.loader_replacer;
+library initialize.build.loader_replacer;
import 'dart:async';
import 'package:barback/barback.dart';
@@ -11,7 +11,7 @@
LoaderReplacer.asPlugin();
bool isPrimary(AssetId id) =>
- id.package == 'static_init' && id.path == 'lib/static_init.dart';
+ id.package == 'initialize' && id.path == 'lib/initialize.dart';
Future apply(Transform transform) {
var id = transform.primaryInput.id;
diff --git a/lib/static_init.dart b/lib/initialize.dart
similarity index 74%
rename from lib/static_init.dart
rename to lib/initialize.dart
index c55a8d5..c5d07dd 100644
--- a/lib/static_init.dart
+++ b/lib/initialize.dart
@@ -1,19 +1,20 @@
// Copyright (c) 2015, 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 static_init;
+library initialize;
-// The transformer will replace this with a static_loader.
+// The `loader_replacer` transformer will replace this with a static_loader.
import 'src/mirror_loader.dart' as loader;
import 'dart:async';
import 'dart:collection';
part 'src/init_method.dart';
-part 'src/static_initializer.dart';
+part 'src/initializer.dart';
/// Top level function which crawls the dependency graph and runs initializers.
-/// If `typeFilter` is supplied then only those types of annotations will be
-/// parsed.
+/// If `typeFilter` and/or `customFilter` are supplied then only those types of
+/// annotations will be parsed. If both filters are supplied they are treated
+/// as an AND.
Future run({List<Type> typeFilter, InitializerFilter customFilter}) {
return _runInitQueue(loader.loadInitializers(
typeFilter: typeFilter, customFilter: customFilter));
diff --git a/lib/src/init_method.dart b/lib/src/init_method.dart
index 9db51d7..ebc8f93 100644
--- a/lib/src/init_method.dart
+++ b/lib/src/init_method.dart
@@ -1,14 +1,14 @@
// Copyright (c) 2015, 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.
-part of static_init;
+part of initialize;
/// Metadata used to label static or top-level methods that are called
/// automatically when calling static_init.run(). This class is private because
/// it shouldn't be used directly in annotations, instead use the `initMethod`
/// singleton below.
typedef dynamic _ZeroArg();
-class _InitMethod implements StaticInitializer<_ZeroArg> {
+class _InitMethod implements Initializer<_ZeroArg> {
const _InitMethod();
@override
diff --git a/lib/src/static_initializer.dart b/lib/src/initializer.dart
similarity index 79%
rename from lib/src/static_initializer.dart
rename to lib/src/initializer.dart
index d11f69b..3ddf0cc 100644
--- a/lib/src/static_initializer.dart
+++ b/lib/src/initializer.dart
@@ -1,13 +1,13 @@
// Copyright (c) 2015, 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.
-part of static_init;
+part of initialize;
/// Implement this class to create your own initializer.
///
/// Hello world example:
///
-/// class Print implements StaticInitializer<Type> {
+/// class Print implements Initializer<Type> {
/// final String message;
/// const Print(this.message);
///
@@ -20,9 +20,9 @@
///
/// Call [run] from your main and this will print 'Foo says `hello world!`'
///
-abstract class StaticInitializer<T> {
+abstract class Initializer<T> {
dynamic initialize(T target);
}
/// Typedef for a custom filter function.
-typedef bool InitializerFilter(StaticInitializer initializer);
+typedef bool InitializerFilter(Initializer initializer);
diff --git a/lib/src/mirror_loader.dart b/lib/src/mirror_loader.dart
index c65685d..1512ec9 100644
--- a/lib/src/mirror_loader.dart
+++ b/lib/src/mirror_loader.dart
@@ -1,22 +1,21 @@
// Copyright (c) 2015, 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 static_init.mirror_loader;
+library initialize.mirror_loader;
-import 'dart:async';
import 'dart:collection' show Queue;
import 'dart:mirrors';
import 'package:path/path.dart' as path;
-import 'package:static_init/static_init.dart';
+import 'package:initialize/initialize.dart';
Queue<Function> loadInitializers(
{List<Type> typeFilter, InitializerFilter customFilter}) {
- return new StaticInitializationCrawler(typeFilter, customFilter).run();
+ return new InitializationCrawler(typeFilter, customFilter).run();
}
-// Crawls a library and all its dependencies for `StaticInitializer`
-// annotations using mirrors
-class StaticInitializationCrawler {
+// Crawls a library and all its dependencies for `Initializer` annotations using
+// mirrors
+class InitializationCrawler {
// Set of all visited annotations, keys are the declarations that were
// annotated, values are the annotations that have been processed.
static final _annotationsFound =
@@ -32,7 +31,7 @@
// The root library that we start parsing from.
LibraryMirror _root;
- StaticInitializationCrawler(this.typeFilter, this.customFilter,
+ InitializationCrawler(this.typeFilter, this.customFilter,
{LibraryMirror root}) {
_root = root == null ? currentMirrorSystem().isolate.rootLibrary : root;
}
@@ -41,8 +40,8 @@
// annotations into a queue of init functions.
Queue<Function> run() => _readLibraryDeclarations(_root);
- // Reads StaticInitializer annotations on this library and all its
- // dependencies in post-order.
+ // Reads Initializer annotations on this library and all its dependencies in
+ // post-order.
Queue<Function> _readLibraryDeclarations(LibraryMirror lib,
[Set<LibraryMirror> librariesSeen, Queue<Function> queue]) {
if (librariesSeen == null) librariesSeen = new Set<LibraryMirror>();
@@ -108,7 +107,7 @@
MirrorSystem.getName(declaration.qualifiedName);
// Reads annotations on declarations and adds them to `_initQueue` if they are
- // static initializers.
+ // initializers.
void _readAnnotations(DeclarationMirror declaration, Queue<Function> queue) {
var annotations =
declaration.metadata.where((m) => _filterMetadata(declaration, m));
@@ -128,8 +127,8 @@
if (superMetas.isNotEmpty) {
throw new UnsupportedError(
'We have detected a cycle in your import graph when running '
- 'static initializers on ${declaration.qualifiedName}. This means '
- 'the super class ${declaration.superclass.qualifiedName} has a '
+ 'initializers on ${declaration.qualifiedName}. This means the '
+ 'super class ${declaration.superclass.qualifiedName} has a '
'dependency on this library (possibly transitive).');
}
}
@@ -154,11 +153,11 @@
}
}
- // Filter function that returns true only if `meta` is a `StaticInitializer`,
- // it passes the `typeFilter` or `customFilter` if they exist, and it has not
+ // Filter function that returns true only if `meta` is an `Initializer`,
+ // it passes the `typeFilter` and `customFilter` if they exist, and it has not
// yet been seen.
bool _filterMetadata(DeclarationMirror declaration, InstanceMirror meta) {
- if (meta.reflectee is! StaticInitializer) return false;
+ if (meta.reflectee is! Initializer) return false;
if (typeFilter != null &&
!typeFilter.any((t) => meta.reflectee.runtimeType == t)) {
return false;
@@ -173,8 +172,8 @@
}
final _TOP_LEVEL_FUNCTIONS_ONLY = new UnsupportedError(
- 'Only top level methods are supported for StaticInitializers');
+ 'Only top level methods are supported for initializers');
final _UNSUPPORTED_DECLARATION = new UnsupportedError(
- 'StaticInitializers are only supported on libraries, classes, and top '
- 'level methods');
+ 'Initializers are only supported on libraries, classes, and top level '
+ 'methods');
diff --git a/lib/src/static_loader.dart b/lib/src/static_loader.dart
index 93deb23..11980fa 100644
--- a/lib/src/static_loader.dart
+++ b/lib/src/static_loader.dart
@@ -1,15 +1,15 @@
// Copyright (c) 2015, 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 static_init.static_loader;
+library initialize.static_loader;
import 'dart:collection' show Queue;
-import 'package:static_init/static_init.dart';
+import 'package:initialize/initialize.dart';
/// This represents an annotation/declaration pair.
class InitEntry<T> {
/// The annotation instance.
- final StaticInitializer<T> meta;
+ final Initializer<T> meta;
/// The target of the annotation to pass to initialize.
final T target;
diff --git a/lib/transformer.dart b/lib/transformer.dart
index ac39da6..5f4d740 100644
--- a/lib/transformer.dart
+++ b/lib/transformer.dart
@@ -1,7 +1,7 @@
// Copyright (c) 2015, 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 static_init.transformer;
+library initialize.transformer;
import 'dart:async';
import 'dart:collection' show Queue;
@@ -90,10 +90,10 @@
AssetId _entryPoint;
AssetId _newEntryPoint;
- /// The resolved static_init library.
- LibraryElement _staticInitLibrary;
- /// The resolved StaticInitializer class from the static_init library.
- ClassElement _staticInitializer;
+ /// The resolved initialize library.
+ LibraryElement _initializeLibrary;
+ /// The resolved Initializer class from the initialize library.
+ ClassElement _initializer;
/// Queue for intialization annotations.
final _initQueue = new Queue<_InitializerData>();
@@ -105,9 +105,9 @@
_BootstrapFileBuilder(
this._resolver, this._transform, this._entryPoint, this._newEntryPoint) {
_logger = _transform.logger;
- _staticInitLibrary = _resolver
- .getLibrary(new AssetId('static_init', 'lib/static_init.dart'));
- _staticInitializer = _staticInitLibrary.getType('StaticInitializer');
+ _initializeLibrary = _resolver
+ .getLibrary(new AssetId('initialize', 'lib/initialize.dart'));
+ _initializer = _initializeLibrary.getType('Initializer');
}
/// Adds the new entry point file to the transform. Should only be ran once.
@@ -119,8 +119,8 @@
new Asset.fromString(_newEntryPoint, _buildNewEntryPoint(entryLib)));
}
- /// Reads StaticInitializer annotations on this library and all
- /// its dependencies in post-order.
+ /// Reads Initializer annotations on this library and all its dependencies in
+ /// post-order.
void _readLibraries(LibraryElement library, [Set<LibraryElement> seen]) {
if (seen == null) seen = new Set<LibraryElement>();
seen.add(library);
@@ -145,8 +145,8 @@
superClass.element.library != clazz.library) {
_logger.warning(
'We have detected a cycle in your import graph when running '
- 'static initializers on ${clazz.name}. This means the super '
- 'class ${superClass.name} has a dependency on this library '
+ 'initializers on ${clazz.name}. This means the super class '
+ '${superClass.name} has a dependency on this library '
'(possibly transitive).');
}
superClass = superClass.superclass;
@@ -158,12 +158,12 @@
bool _readAnnotations(Element element) {
var found = false;
element.metadata.where((ElementAnnotation meta) {
- // First filter out anything that is not a StaticInitializer.
+ // First filter out anything that is not a Initializer.
var e = meta.element;
if (e is PropertyAccessorElement) {
- return _isStaticInitializer(e.variable.evaluationResult.value.type);
+ return _isInitializer(e.variable.evaluationResult.value.type);
} else if (e is ConstructorElement) {
- return _isStaticInitializer(e.returnType);
+ return _isInitializer(e.returnType);
}
return false;
}).where((ElementAnnotation meta) {
@@ -184,7 +184,7 @@
// Import the static_loader and original entry point.
importsBuffer.writeln(
- "import 'package:static_init/src/static_loader.dart';");
+ "import 'package:initialize/src/static_loader.dart';");
_maybeWriteImport(entryLib, libraryPrefixes, importsBuffer);
initializersBuffer.writeln(' initializers.addAll([');
@@ -250,8 +250,8 @@
elementString =
'${libraryPrefixes[data.element.library]}.${element.name}';
} else {
- _logger.error('StaticInitializers can only be applied to top level '
- 'functions, libraries, and classes.');
+ _logger.error('Initializers can only be applied to top level functins, '
+ 'libraries, and classes.');
}
if (annotationElement is ConstructorElement) {
@@ -263,8 +263,8 @@
astMeta = node.metadata;
} else {
_logger.error(
- 'StaticInitializer annotations are only supported on libraries, '
- 'classes, and top level methods. Found $node.');
+ 'Initializer annotations are only supported on libraries, classes, '
+ 'and top level methods. Found $node.');
}
final annotation =
astMeta.firstWhere((m) => m.elementAnnotation == data.annotation);
@@ -285,12 +285,12 @@
}
}
- bool _isStaticInitializer(InterfaceType type) {
+ bool _isInitializer(InterfaceType type) {
if (type == null) return false;
- if (type.element.type == _staticInitializer.type) return true;
- if (_isStaticInitializer(type.superclass)) return true;
+ if (type.element.type == _initializer.type) return true;
+ if (_isInitializer(type.superclass)) return true;
for (var interface in type.interfaces) {
- if (_isStaticInitializer(interface)) return true;
+ if (_isInitializer(interface)) return true;
}
return false;
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 785688d..eee278d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,4 +1,4 @@
-name: static_init
+name: initialize
version: 0.0.0
author: Polymer.dart Authors <web@dartlang.org>
description: Generic building blocks for doing static initialization.
@@ -10,21 +10,21 @@
environment:
sdk: '>=1.4.0 <2.0.0'
transformers:
-- static_init/build/loader_replacer:
- $include: lib/static_init.dart
-- static_init:
- $include: test/static_init_test.dart
- entryPoint: test/static_init_test.dart
-- static_init:
- $include: test/static_init_cycle_error_test.dart
- entryPoint: test/static_init_cycle_error_test.dart
-- static_init:
- $include: test/static_init_custom_filter_test.dart
- entryPoint: test/static_init_custom_filter_test.dart
-- static_init:
- $include: test/static_init_type_filter_test.dart
- entryPoint: test/static_init_type_filter_test.dart
-- static_init:
+- initialize/build/loader_replacer:
+ $include: lib/initialize.dart
+- initialize:
+ $include: test/initializer_test.dart
+ entryPoint: test/initializer_test.dart
+- initialize:
+ $include: test/initializer_cycle_error_test.dart
+ entryPoint: test/initializer_cycle_error_test.dart
+- initialize:
+ $include: test/initializer_custom_filter_test.dart
+ entryPoint: test/initializer_custom_filter_test.dart
+- initialize:
+ $include: test/initializer_type_filter_test.dart
+ entryPoint: test/initializer_type_filter_test.dart
+- initialize:
$include: test/init_method_test.dart
entryPoint: test/init_method_test.dart
- $dart2js:
diff --git a/test/bar.dart b/test/bar.dart
index 440b6cd..664d4f7 100644
--- a/test/bar.dart
+++ b/test/bar.dart
@@ -2,7 +2,7 @@
// 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.
@initializeTracker
-library static_init.test.bar;
+library initialize.test.bar;
import 'foo.dart';
import 'initialize_tracker.dart';
diff --git a/test/common.dart b/test/common.dart
index 2062318..859b72e 100644
--- a/test/common.dart
+++ b/test/common.dart
@@ -1,8 +1,7 @@
// 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.
-
-library static_init.test.build.common;
+library initialize.test.build.common;
import 'package:barback/barback.dart';
import 'package:code_transformers/src/test_harness.dart';
diff --git a/test/cycle_a.dart b/test/cycle_a.dart
index 04bdb77..b0d55da 100644
--- a/test/cycle_a.dart
+++ b/test/cycle_a.dart
@@ -1,7 +1,7 @@
// Copyright (c) 2015, 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 static_init.test.cycle_a;
+library initialize.test.cycle_a;
import 'initialize_tracker.dart';
import 'cycle_b.dart';
diff --git a/test/cycle_b.dart b/test/cycle_b.dart
index cee38cb..7dd9b5c 100644
--- a/test/cycle_b.dart
+++ b/test/cycle_b.dart
@@ -1,7 +1,7 @@
// Copyright (c) 2015, 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 static_init.test.cycle_b;
+library initialize.test.cycle_b;
import 'initialize_tracker.dart';
import 'cycle_a.dart';
diff --git a/test/foo.dart b/test/foo.dart
index aaf2e09..6e5340c 100644
--- a/test/foo.dart
+++ b/test/foo.dart
@@ -2,7 +2,7 @@
// 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.
@initializeTracker
-library static_init.test.foo;
+library initialize.test.foo;
import 'initialize_tracker.dart';
diff --git a/test/init_method_test.dart b/test/init_method_test.dart
index a641948..55fa282 100644
--- a/test/init_method_test.dart
+++ b/test/init_method_test.dart
@@ -1,9 +1,9 @@
// Copyright (c) 2015, 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 static_init.init_method_test;
+library initialize.init_method_test;
-import 'package:static_init/static_init.dart';
+import 'package:initialize/initialize.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/compact_vm_config.dart';
@@ -13,12 +13,12 @@
main() {
useCompactVMConfiguration();
- // Run all static initializers.
+ // Run all initializers.
run().then((_) {
test('initMethod annotation invokes functions once', () {
expect(calledFoo, 1);
expect(calledBar, 1);
- // Re-run all static initializers, should be a no-op.
+ // Re-run all initializers, should be a no-op.
return run().then((_) {
expect(calledFoo, 1);
expect(calledBar, 1);
diff --git a/test/initialize_tracker.dart b/test/initialize_tracker.dart
index 236af80..6bd5982 100644
--- a/test/initialize_tracker.dart
+++ b/test/initialize_tracker.dart
@@ -1,12 +1,12 @@
// Copyright (c) 2015, 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 static_init.test.initialize_tracker;
+library initialize.test.initialize_tracker;
-import 'package:static_init/static_init.dart';
+import 'package:initialize/initialize.dart';
-// Static Initializer that just saves everything it sees.
-class InitializeTracker implements StaticInitializer<dynamic> {
+// Initializer that just saves everything it sees.
+class InitializeTracker implements Initializer<dynamic> {
static final List seen = [];
const InitializeTracker();
diff --git a/test/static_init_custom_filter_test.dart b/test/initializer_custom_filter_test.dart
similarity index 88%
rename from test/static_init_custom_filter_test.dart
rename to test/initializer_custom_filter_test.dart
index 49a9749..ad54fee 100644
--- a/test/static_init_custom_filter_test.dart
+++ b/test/initializer_custom_filter_test.dart
@@ -1,10 +1,10 @@
// Copyright (c) 2015, 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 static_init.static_init_custom_filter_test;
+library initialize.initializer_custom_filter_test;
import 'dart:async';
-import 'package:static_init/static_init.dart';
+import 'package:initialize/initialize.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/compact_vm_config.dart';
import 'initialize_tracker.dart';
@@ -38,7 +38,7 @@
}
Future runPhase(int phase) => run(
- customFilter: (StaticInitializer meta) =>
+ customFilter: (Initializer meta) =>
meta is PhasedInitializer && meta.phase == phase);
@PhasedInitializer(3)
@@ -53,7 +53,7 @@
@PhasedInitializer(1)
class Baz extends Bar {}
-// Static Initializer that has a phase associated with it, this can be used in
+// Initializer that has a phase associated with it, this can be used in
// combination with a custom filter to run intialization in phases.
class PhasedInitializer extends InitializeTracker {
final int phase;
diff --git a/test/static_init_cycle_error_test.dart b/test/initializer_cycle_error_test.dart
similarity index 83%
rename from test/static_init_cycle_error_test.dart
rename to test/initializer_cycle_error_test.dart
index 447fe0d..bc5c8a3 100644
--- a/test/static_init_cycle_error_test.dart
+++ b/test/initializer_cycle_error_test.dart
@@ -1,10 +1,10 @@
// Copyright (c) 2015, 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 static_init.static_init_cycle_error_test;
+library initialize.initializer_cycle_error_test;
import 'cycle_a.dart'; // Causes a cycle.
-import 'package:static_init/static_init.dart';
+import 'package:initialize/initialize.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/compact_vm_config.dart';
diff --git a/test/static_init_test.dart b/test/initializer_test.dart
similarity index 79%
rename from test/static_init_test.dart
rename to test/initializer_test.dart
index 0798bef..9426a9b 100644
--- a/test/static_init_test.dart
+++ b/test/initializer_test.dart
@@ -2,30 +2,30 @@
// 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.
@initializeTracker
-library static_init.static_init_test;
+library initialize.initializer_test;
import 'foo.dart';
import 'bar.dart';
import 'initialize_tracker.dart';
-import 'package:static_init/static_init.dart';
+import 'package:initialize/initialize.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/compact_vm_config.dart';
main() {
useCompactVMConfiguration();
- // Run all static initializers.
+ // Run all initializers.
run().then((_) {
test('annotations are seen in post-order with superclasses first', () {
var expectedNames = [
- #static_init.test.foo,
+ #initialize.test.foo,
foo,
fooBar,
Foo,
- #static_init.test.bar,
+ #initialize.test.bar,
bar,
Bar,
- #static_init.static_init_test,
+ #initialize.initializer_test,
zap,
Zoop, // Zap extends Zoop, so Zoop comes first.
Zap
@@ -34,7 +34,7 @@
});
test('annotations only run once', () {
- // Run the static initializers again, should be a no-op.
+ // Run the initializers again, should be a no-op.
var originalSize = InitializeTracker.seen.length;
return run().then((_) {
expect(InitializeTracker.seen.length, originalSize);
diff --git a/test/static_init_type_filter_test.dart b/test/initializer_type_filter_test.dart
similarity index 79%
rename from test/static_init_type_filter_test.dart
rename to test/initializer_type_filter_test.dart
index 7982094..b5ebb92 100644
--- a/test/static_init_type_filter_test.dart
+++ b/test/initializer_type_filter_test.dart
@@ -1,9 +1,9 @@
// Copyright (c) 2015, 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 static_init.static_init_type_filter_test;
+library initialize.initializer_type_filter_test;
-import 'package:static_init/static_init.dart';
+import 'package:initialize/initialize.dart';
import 'package:unittest/unittest.dart';
import 'package:unittest/compact_vm_config.dart';
@@ -40,8 +40,8 @@
@subtractor
c() {}
-// Static Initializer that increments `total` by one.
-class _Adder implements StaticInitializer<dynamic> {
+// Initializer that increments `total` by one.
+class _Adder implements Initializer<dynamic> {
const _Adder();
@override
@@ -49,8 +49,8 @@
}
const adder = const _Adder();
-// Static Initializer that decrements `total` by one.
-class _Subtractor implements StaticInitializer<dynamic> {
+// Initializer that decrements `total` by one.
+class _Subtractor implements Initializer<dynamic> {
const _Subtractor();
@override
diff --git a/test/transformer_test.dart b/test/transformer_test.dart
index 17042fb..3ef1ef6 100644
--- a/test/transformer_test.dart
+++ b/test/transformer_test.dart
@@ -1,11 +1,11 @@
// Copyright (c) 2015, 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 static_init.build.transformer_test;
+library initialize.transformer_test;
import 'common.dart';
import 'package:barback/barback.dart';
-import 'package:static_init/transformer.dart';
+import 'package:initialize/transformer.dart';
import 'package:unittest/compact_vm_config.dart';
main() {
@@ -24,7 +24,7 @@
@constInit
library foo;
- import 'package:static_init/static_init.dart';
+ import 'package:initialize/initialize.dart';
import 'package:bar/bar.dart';
@constInit
@@ -38,7 +38,7 @@
@DynamicInit('bar2')
library bar;
- import 'package:static_init/static_init.dart';
+ import 'package:initialize/initialize.dart';
@DynamicInit('Bar')
@DynamicInit('Bar2')
@@ -48,33 +48,33 @@
@initMethod
bar() {}
''',
- // Mock out the StaticInitializer package plus some initializers.
- 'static_init|lib/static_init.dart': '''
- library static_init;
+ // Mock out the Initialize package plus some initializers.
+ 'initialize|lib/initialize.dart': '''
+ library initialize;
- abstract class StaticInitializer<T> {}
+ abstract class Initializer<T> {}
- class _ConstInit extends StaticInitializer<dynamic> {
+ class _ConstInit extends Initializer<dynamic> {
const ConstInit();
}
const _ConstInit constInit = const _ConstInit();
- class DynamicInit extends StaticInitializer<dynamic> {
+ class DynamicInit extends Initializer<dynamic> {
final String _name;
const DynamicInit(this._name);
}
- class _InitMethod implements StaticInitializer<Function> {
+ class _InitMethod implements Initializer<Function> {
const _InitMethod();
}
const _InitMethod initMethod = const _InitMethod();
'''
}, {
'a|web/index.bootstrap.dart': '''
- import 'package:static_init/src/static_loader.dart';
+ import 'package:initialize/src/static_loader.dart';
import 'index.dart' as i0;
import 'package:bar/bar.dart' as i1;
- import 'package:static_init/static_init.dart' as i2;
+ import 'package:initialize/initialize.dart' as i2;
import 'foo.dart' as i3;
main() {