Releases: dart-lang/source_gen
0.8.2
-
Simplification to the output of generator names in header sections.
-
Update handling of whitespace in generator outputs.
- If the output from a generator has wrapping whitespace, it is trimmed.
- If the output from a generator is empty or whitespace-only, it is ignored.
- These changes will likely have no effect on output, unless you customize
the code formatter.
v0.8.1
v0.8.0
-
BREAKING removed the deprecated
requireLibraryDirectiveparameter in
PartBuilder. -
Revivableno longer throws a type error when attempting to revive a
reference to a top-level function or static-class method. Now is returns a
reference to that function or method, as expected.
v0.7.6
0.7.6
TypeCheckernow throws anUnresolvedAnnotationExceptionwith a more
detailed exception body (and properties useful for further debugging) instead
ofCould not resolve @null.
v0.7.5+1
LibraryBuilderandPartBuildernow have a more readabletoString(),
which is useful when emitting a warning or error in a build system. For
example you may seeGenerating .g.dart: MyBuilderinstead of
Instance of LibraryBuilderin your build logs.
v0.7.4+2
-
BUG FIX:
ConstantReader.revive()now properly returns no URL fragment
when the constant expression is resolved from a top-level or static-field.
The documentation had said otherwise, and it was impossible to tell the
difference between a constructor and a field. Now, fields are always in
the form of accessor ={clazz}.{field}or{topLevelField}. -
Fix file URIs on windows.
v0.7.4+1
- Removed a
log.finestwith the output source of each generator. This allows
a verbose option (-v) for tools like bazel or build_runner to be much more
readable and debuggable. Files are emitted to disk for inspection in any
case.
v0.7.4
-
Added
typeNameOf, which is a safe way to get the name of aDartType,
even when the type is aFunctionType, which has anullname in newer
versions of the Dart analyzer. -
Added
LibraryReader.pathToUrl(Uri|String), which computes theimportor
exportpath necessary to reach the provided URL from the current library.
Also addedpathToAssetandpathToElementas convenience functions. -
Expanded
package:buildsupport to allow version0.12.0.
v0.7.0
-
Breaking changes: See the wiki
for help upgrading.Generator.generatenow operates on aLibraryReaderrather than being
called for everyElementwithin a library. Generators can iterate over
elements usingLibraryReader.allElements.GeneratorForAnnotationwill
continue to callgenerateForAnnotatedElementrepeatedly for each element.GeneratorForAnnotationpasses in aConstantReaderfor the annotation
instance rather than re-creating it using mirrors.GeneratorBuilderis replaced withPartBuilderandLibraryBuilder
depending on whether the output is meant to be included in apartfile.- Removed
JsonSerializableand related classes. These are moved to
package:json_serializable. - Removed
lib/builder.dart. Import throughsource_gen.dartinstead. - Removed
OutputFormattertypedef.
-
Add
LibraryReader.allElements- a utility to iterate across allElement
instances contained in Dart library. -
Add
LibraryReader.elementto get back to theLibraryElementinstance. -
Add
ConstantReader.objectValueto get back to theDartObjectinstance. -
Add
ConstantReader.peekto read a value that returnsnullif not found:
// Tries to read the field "token" first, then "_token".
findTokenField(DartObject o) {
final reader = new ConstantReader(o);
final token = o.peek('token') ?? o.read('_token');
}- Add
throwOnUnresolvedoptional parameter toTypeChecker.annotationsOf,
TypeChecker.annotationsOfExact,TypeChecker.firstAnnotationOf, and
TypeChecker.firstAnnotationOfExact. Setting this tofalsewill enable you
to check for matching annotations with incomplete type information (at your
own risk). - Builder logs now log the primary inputs
AssetIdinstead of thelibrary,
which is more useful for tracking down the actual files.