Skip to content

Commit

Permalink
Added pedantic to build_node_compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
pulyaevskiy committed Sep 14, 2019
1 parent ba7dba0 commit c1deb1f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 38 deletions.
11 changes: 1 addition & 10 deletions build_node_compilers/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
# Lint rules and documentation, see http://dart-lang.github.io/linter/lints
linter:
rules:
- cancel_subscriptions
- hash_and_equals
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- test_types_in_equals
- unrelated_type_equality_checks
- valid_regexps
include: package:pedantic/analysis_options.yaml
28 changes: 2 additions & 26 deletions build_node_compilers/lib/src/dev_compiler_bootstrap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import 'platforms.dart';
/// Alias `_p.url` to `p`.
_p.Context get _context => _p.url;

var _modulePartialExtension = _context.withoutExtension(jsModuleExtension);

Future<void> bootstrapDdc(BuildStep buildStep,
{DartPlatform platform,
Set<String> skipPlatformCheckPackages = const {}}) async {
Expand Down Expand Up @@ -55,20 +53,7 @@ https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-ski
var appDigestsOutput =
dartEntrypointId.changeExtension(digestsEntrypointExtension);

// The name of the entrypoint dart library within the entrypoint JS module.
//
// This is used to invoke `main()` from within the bootstrap script.
//
// TODO(jakemac53): Sane module name creation, this only works in the most
// basic of cases.
//
// See https://github.com/dart-lang/sdk/issues/27262 for the root issue
// which will allow us to not rely on the naming schemes that dartdevc uses
// internally, but instead specify our own.
var oldAppModuleScope = toJSIdentifier(
_context.withoutExtension(_context.basename(buildStep.inputId.path)));

// Like above but with a package-relative entrypoint.
// Package-relative entrypoint name within the entrypoint JS module.
var appModuleScope =
pathToJSIdentifier(_context.withoutExtension(buildStep.inputId.path));

Expand All @@ -92,16 +77,7 @@ https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-resolve-ski
bootstrapId.path,
from: _context.dirname(dartEntrypointId.path)));

var primarySourceParts = _context.split(module.primarySource.path);
var appModuleUri = _context.joinAll([
// Convert to a package: uri for files under lib.
if (primarySourceParts.first == 'lib')
'package:${module.primarySource.package}',
// Strip top-level directory from the path.
...primarySourceParts.skip(1),
]);

var bootstrapContent = new StringBuffer();
var bootstrapContent = StringBuffer();
bootstrapContent.write(_dartLoaderSetup(modulePaths));
bootstrapContent.write(_appBootstrap(appModuleName, appModuleScope));

Expand Down
2 changes: 1 addition & 1 deletion build_node_compilers/lib/src/node_entrypoint_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum WebCompiler {

/// The top level keys supported for the `options` config for the
/// [NodeEntrypointBuilder].
const _supportedOptions = const [
const _supportedOptions = [
_compiler,
_dart2jsArgs,
_buildRootAppSummary,
Expand Down
1 change: 1 addition & 0 deletions build_node_compilers/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:

dev_dependencies:
build_test: ^0.10.0
pedantic: ^1.0.0
test: ^1.0.0
a:
path: test/fixtures/a
Expand Down
2 changes: 1 addition & 1 deletion build_node_compilers/test/dart2js_bootstrap_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ main() {
'a|web/index.dart.js': decodedMatches(contains('world')),
'a|web/index.dart.js.map': anything,
};
await testBuilder(new NodeEntrypointBuilder(WebCompiler.Dart2Js), assets,
await testBuilder(NodeEntrypointBuilder(WebCompiler.Dart2Js), assets,
outputs: expectedOutputs);
});
}

0 comments on commit c1deb1f

Please sign in to comment.