Skip to content

Upgrading build 0.12 to 1

Breaking0.12.8 → 1.6.3Breaking7Platform2New7Changed22Fixed2Other4

BreakingUpgrade verdict

7 breaking changes and 2 platform requirement changes.

  • Custom asset readers must now report invalid inputs themselves, because the build step no longer checks for them.
  • If you implement certain interfaces, you may need to update the return type of some methods from a generic future to a void future.
  • Code that uses the resolver may behave differently because it now runs on a new underlying engine.
  • The context field on library elements no longer works as before.
Top 5 of 9 that need code or config changes

Dart SDK requirement changed in 1.6.3: >=2.0.0 <3.0.0 → >=2.11.99 <3.0.0.

Breaking7
AssetReader implementations are now expected to throw InvalidInputException for invalid inputs, and the check was removed from the build step.
AssetReaderInvalidInputException
Some return types for interfaces to implement change from Future<dynamic> to Future<void>.
Future<dynamic>Future<void>
Resolver implementations in other packages are now backed by an AnalysisDriver, with behavior changes that may be breaking.
ResolverAnalysisDriverLibraryElement
LibraryElement instances returned by the resolver now have non-working context fields.
LibraryElementcontext
LibraryElement instances returned by the resolver now have no source offsets for annotations or their errors.
LibraryElement
LibraryElement instances returned by the resolver now have Source instances with different URIs than before.
LibraryElementSource
Changes the return type of Builder.build from Future<dynamic> to FutureOr<void>.
Builder.buildFuture<dynamic>FutureOr<void>
Platform2
Updates the minimum Dart SDK constraint to 2.1.0.
Requires Dart >=2.18.0.

Generated by DepDelta from published Dart source. Not mixed with prose notes.

  • removed: typedef Builder BuilderFactory(BuilderOptions options)
  • removed: typedef FutureOr BeforeExit()
  • removed: typedef FutureOr DisposeInstance<T>(T instance)
  • removed: typedef FutureOr<T> CreateInstance<T>()
  • changed: ctor AssetId.deserialize(List data) → ctor AssetId.deserialize(List<dynamic> data)
  • changed: ctor InvalidInputException(this.assetId) → ctor InvalidInputException(this.assetId, {this.allowedGlobs = …})
  • changed: function runBuilder(Builder builder, Iterable<AssetId> inputs, AssetReader reader, AssetWriter writer, Resolvers resolvers, {Logger logger, ResourceManager resourceManager, String rootPackage, StageTracker stageTracker = …}): Future<Null> → function runBuilder(Builder builder, Iterable<AssetId> inputs, AssetReader reader, AssetWriter writer, Resolvers resolvers, {Logger logger, ResourceManager resourceManager, @Deprecated('The rootPackage argument is unused') String rootPackage, StageTracker stageTracker = …, void Function(AssetId input, Iterable<AssetId> assets) reportUnusedAssetsForInput}): Future<void>
  • changed: function runPostProcessBuilder(PostProcessBuilder builder, AssetId inputId, AssetReader reader, AssetWriter writer, Logger logger, {@required void Function(AssetId) addAsset, @required void Function(AssetId) deleteAsset}): Future<Null> → function runPostProcessBuilder(PostProcessBuilder builder, AssetId inputId, AssetReader reader, AssetWriter writer, Logger logger, {@required void Function(AssetId) addAsset, @required void Function(AssetId) deleteAsset}): Future<void>
  • changed: method AssetReader.readAsString(AssetId id, {Encoding encoding = …}): Future<String> → method AssetReader.readAsString(AssetId id, {Encoding encoding}): Future<String>
  • changed: method AssetWriter.writeAsBytes(AssetId id, List<int> bytes): Future → method AssetWriter.writeAsBytes(AssetId id, List<int> bytes): Future<void>
  • changed: method AssetWriter.writeAsString(AssetId id, String contents, {Encoding encoding = …}): Future → method AssetWriter.writeAsString(AssetId id, String contents, {Encoding encoding = …}): Future<void>
  • changed: method AssetWriterSpy.writeAsBytes(AssetId id, List<int> bytes): Future → method AssetWriterSpy.writeAsBytes(AssetId id, List<int> bytes): Future<void>
  • changed: method AssetWriterSpy.writeAsString(AssetId id, String contents, {Encoding encoding = …}): Future → method AssetWriterSpy.writeAsString(AssetId id, String contents, {Encoding encoding = …}): Future<void>
  • changed: method BuildStep.writeAsBytes(AssetId id, FutureOr<List<int>> bytes): Future → method BuildStep.writeAsBytes(AssetId id, FutureOr<List<int>> bytes): Future<void>
  • changed: method BuildStep.writeAsString(AssetId id, FutureOr<String> contents, {Encoding encoding = …}): Future → method BuildStep.writeAsString(AssetId id, FutureOr<String> contents, {Encoding encoding = …}): Future<void>
  • changed: method Builder.build(BuildStep buildStep): Future → method Builder.build(BuildStep buildStep): FutureOr<void>
  • changed: method MultiplexingBuilder.build(BuildStep buildStep): Future → method MultiplexingBuilder.build(BuildStep buildStep): FutureOr<void>
  • changed: method PostProcessBuildStep.complete(): Future → method PostProcessBuildStep.complete(): Future<void>
  • changed: method PostProcessBuildStep.writeAsBytes(AssetId id, FutureOr<List<int>> bytes): Future → method PostProcessBuildStep.writeAsBytes(AssetId id, FutureOr<List<int>> bytes): Future<void>
  • changed: method PostProcessBuildStep.writeAsString(AssetId id, FutureOr<String> content, {Encoding encoding = …}): Future → method PostProcessBuildStep.writeAsString(AssetId id, FutureOr<String> content, {Encoding encoding = …}): Future<void>
  • changed: method PostProcessBuilder.build(PostProcessBuildStep buildStep): FutureOr<Null> → method PostProcessBuilder.build(PostProcessBuildStep buildStep): FutureOr<void>
  • changed: method Resolver.libraryFor(AssetId assetId): Future<LibraryElement> → method Resolver.libraryFor(AssetId assetId, {bool allowSyntaxErrors = …}): Future<LibraryElement>
  • added: class SyntaxErrorInAssetException implements Exception
  • added: class UnresolvableAssetException implements Exception
  • added: ctor SyntaxErrorInAssetException(this.assetId, this.filesWithErrors)
  • added: ctor UnresolvableAssetException(this.description)
  • added: field InvalidInputException.allowedGlobs: final List<String>
  • added: field SyntaxErrorInAssetException.assetId: final AssetId
  • added: field SyntaxErrorInAssetException.filesWithErrors: final List<AnalysisResultWithErrors>
  • added: field UnresolvableAssetException.description: final String
  • added: get SyntaxErrorInAssetException.errorToResult: Map<AnalysisError, AnalysisResultWithErrors>
  • added: get SyntaxErrorInAssetException.syntaxErrors: Iterable<AnalysisError>
  • added: method BuildStep.reportUnusedAssets(Iterable<AssetId> ids): void
  • added: method Resolver.assetIdForElement(Element element): Future<AssetId>
  • added: method Resolver.astNodeFor(Element element, {bool resolve = …}): Future<AstNode>
  • added: method Resolver.compilationUnitFor(AssetId assetId, {bool allowSyntaxErrors = …}): Future<CompilationUnit>
  • added: method SyntaxErrorInAssetException.toString(): String
  • added: method UnresolvableAssetException.toString(): String
  • added: typedef BeforeExit = FutureOr<void> Function()
  • added: typedef BuilderFactory = Builder Function(BuilderOptions options)
  • added: typedef CreateInstance<T> = FutureOr<T> Function()
  • added: typedef DisposeInstance<T> = FutureOr<void> Function(T instance)
  • added: function withEnabledExperiments<T>(T Function() fn, List<String> enabledExperiments): T
  • added: get enabledExperiments: List<String>