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

Unified Diff: lib/src/codegen/code_generator.dart

Issue 1235503010: fixes #219, able to compile multiple entry points (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 5 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
Index: lib/src/codegen/code_generator.dart
diff --git a/lib/src/codegen/code_generator.dart b/lib/src/codegen/code_generator.dart
index 033833ead97fb8efbf655335fc7702a4a3af2455..888a2d4095ce7b97635bf4acdbedc26f7d7087be 100644
--- a/lib/src/codegen/code_generator.dart
+++ b/lib/src/codegen/code_generator.dart
@@ -4,15 +4,12 @@
library dev_compiler.src.codegen.code_generator;
-import 'dart:io';
-
-import 'package:analyzer/src/generated/ast.dart' show CompilationUnit;
import 'package:analyzer/src/generated/element.dart'
show CompilationUnitElement, LibraryElement;
import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
import 'package:path/path.dart' as path;
-import 'package:dev_compiler/devc.dart' show AbstractCompiler;
+import 'package:dev_compiler/src/compiler.dart' show AbstractCompiler;
import 'package:dev_compiler/src/info.dart';
import 'package:dev_compiler/src/utils.dart' show canonicalLibraryName;
import 'package:dev_compiler/src/checker/rules.dart';
@@ -20,16 +17,12 @@ import 'package:dev_compiler/src/options.dart' show CodegenOptions;
abstract class CodeGenerator {
final AbstractCompiler compiler;
- final String outDir;
- final Uri root;
final TypeRules rules;
final AnalysisContext context;
final CodegenOptions options;
CodeGenerator(AbstractCompiler compiler)
: compiler = compiler,
- outDir = path.absolute(compiler.options.codegenOptions.outputDir),
- root = compiler.entryPointUri,
rules = compiler.rules,
context = compiler.context,
options = compiler.options.codegenOptions;
@@ -37,7 +30,7 @@ abstract class CodeGenerator {
/// Return a hash, if any, that can be used for caching purposes. When two
/// invocations to this function return the same hash, the underlying
/// code-generator generated the same code.
- String generateLibrary(LibraryUnit unit, LibraryInfo info);
+ String generateLibrary(LibraryUnit unit);
static List<String> _searchPaths = () {
// TODO(vsm): Can we remove redundancy with multi_package_resolver logic?
@@ -114,16 +107,6 @@ abstract class CodeGenerator {
return _convertIfPackage(suffix);
}
- String makeOutputDirectory(LibraryInfo info, CompilationUnit unit) {
- var suffix = _getOutputDirectory(info.name, unit.element);
- var fileDir = path.join(outDir, suffix);
- var dir = new Directory(fileDir);
- if (!dir.existsSync()) {
- dir.createSync(recursive: true);
- }
- return fileDir;
- }
-
static Uri uriFor(LibraryElement lib) {
var unitElement = lib.definingCompilationUnit;
var uri = unitElement.source.uri;

Powered by Google App Engine
This is Rietveld 408576698