Skip to content

Commit 73d0f63

Browse files
committed
Move annotations into json_annotation package
Closes #37
1 parent 3e62422 commit 73d0f63

20 files changed

+99
-10
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ dart:
66
- stable
77

88
env:
9+
- PKG=json_annotation TASK=dartanalyzer
10+
- PKG=json_annotation TASK=dartfmt
911
- PKG=json_serializable TASK=dartanalyzer
1012
- PKG=json_serializable TASK=dartfmt
1113
- PKG=json_serializable TASK=test

json_annotation/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Files and directories created by pub
2+
.packages
3+
.pub/
4+
pubspec.lock

json_annotation/.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: dart
2+
dart:
3+
- dev
4+
- stable
5+
6+
dart_task:
7+
- dartfmt
8+
- dartanalyzer
9+
10+
# Only building master means that we don't run two builds for each pull request.
11+
branches:
12+
only: [master]
13+
14+
cache:
15+
directories:
16+
- $HOME/.pub-cache

json_annotation/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.2.0
2+
3+
- Moved annotation classes for `JsonSerializable` and `JsonLiteral`.

json_annotation/LICENSE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright 2017, the Dart project authors. All rights reserved.
2+
Redistribution and use in source and binary forms, with or without
3+
modification, are permitted provided that the following conditions are
4+
met:
5+
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above
9+
copyright notice, this list of conditions and the following
10+
disclaimer in the documentation and/or other materials provided
11+
with the distribution.
12+
* Neither the name of Google Inc. nor the names of its
13+
contributors may be used to endorse or promote products derived
14+
from this software without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

json_annotation/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Annotations for [json_serializable]. Use these to eliminate a production
2+
dependency on `json_serializable` and the associated transitive dependencies.
3+
4+
## Features and bugs
5+
6+
Please file feature requests and bugs at the [issue tracker][tracker].
7+
8+
[tracker]: https://github.com/dart-lang/json_serializable/issues
9+
[json_serializable]: https://pub.dartlang.org/packages/json_serializable
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
/// Use these annotations on members you'd like to enable source generation on.
6+
7+
export 'src/json_literal.dart';
8+
export 'src/json_serializable.dart';

json_annotation/pubspec.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: json_annotation
2+
version: 0.2.0
3+
description: Annotations for the json_serializable package
4+
homepage: https://github.com/dart-lang/json_serializable
5+
author: Dart Team <misc@dartlang.org>
6+
environment:
7+
sdk: '>=1.24.0 <2.0.0'

json_serializable/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 0.2.4
2+
3+
* Moved the annotations in `annotations.dart` to `package:json_annotations`.
4+
* Allows package authors to release code that has the corresponding
5+
annotations without requiring package users to inherit all of the transitive
6+
dependencies.
7+
8+
* Deprecated `annotations.dart`.
9+
110
## 0.2.3
211

312
* Write out `toJson` methods more efficiently when the first fields written are

json_serializable/example/example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// ignore_for_file: annotate_overrides
66
library json_serializable.example;
77

8-
import 'package:json_serializable/annotations.dart';
8+
import 'package:json_annotation/json_annotation.dart';
99
part 'example.g.dart';
1010

1111
@JsonSerializable()

json_serializable/lib/annotations.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
/// Use these annotations on members you'd like to enable source generation on.
5+
@Deprecated('Use `package:json_annotation` instead.')
6+
library json_serializable.annotations;
67

7-
export 'src/json_literal.dart';
8-
export 'src/json_serializable.dart';
8+
export 'package:json_annotation/json_annotation.dart';

json_serializable/lib/src/json_literal_generator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'package:build/build.dart';
1010
import 'package:path/path.dart' as p;
1111
import 'package:source_gen/source_gen.dart';
1212

13-
import 'json_literal.dart';
13+
import 'package:json_annotation/json_annotation.dart';
1414

1515
class JsonLiteralGenerator extends GeneratorForAnnotation<JsonLiteral> {
1616
const JsonLiteralGenerator();

json_serializable/lib/src/json_serializable_generator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import 'dart:collection';
88
import 'package:analyzer/dart/element/element.dart';
99
import 'package:analyzer/dart/element/type.dart';
1010
import 'package:analyzer/analyzer.dart';
11+
import 'package:json_annotation/json_annotation.dart';
1112
import 'package:source_gen/source_gen.dart';
1213

13-
import 'json_serializable.dart';
1414
import 'type_helper.dart';
1515
import 'type_helpers/date_time_helper.dart';
1616
import 'type_helpers/enum_helper.dart';

json_serializable/pubspec.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies:
99
analyzer: '>=0.29.10 <0.31.0'
1010
build: '>=0.9.0 <0.11.0'
1111
cli_util: ^0.1.0
12+
json_annotation: any
1213
path: ^1.3.2
1314
source_gen: ^0.7.0
1415
dev_dependencies:
@@ -17,3 +18,7 @@ dev_dependencies:
1718
collection: ^1.14.0
1819
dart_style: ^1.0.0
1920
test: ^0.12.3
21+
22+
dependency_overrides:
23+
json_annotation:
24+
path: ../json_annotation

json_serializable/test/test_files/bathtub.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// ignore_for_file: annotate_overrides, hash_and_equals
66
library json_serializable.test.bathtub;
77

8-
import 'package:json_serializable/annotations.dart';
8+
import 'package:json_annotation/json_annotation.dart';
99

1010
import 'kitchen_sink.dart';
1111

json_serializable/test/test_files/json_literal.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
library json_serializable.example;
66

7-
import 'package:json_serializable/annotations.dart';
7+
import 'package:json_annotation/json_annotation.dart';
88
part 'json_literal.g.dart';
99

1010
@JsonLiteral('data.json')

json_serializable/test/test_files/json_test_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ library json_serializable.test.example;
88
import 'dart:collection';
99

1010
import 'package:collection/collection.dart';
11-
import 'package:json_serializable/annotations.dart';
11+
import 'package:json_annotation/json_annotation.dart';
1212

1313
part 'json_test_example.g.dart';
1414

json_serializable/test/test_files/kitchen_sink.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
library json_serializable.test.kitche_sink;
77

88
import 'package:collection/collection.dart';
9-
import 'package:json_serializable/annotations.dart';
9+
import 'package:json_annotation/json_annotation.dart';
1010

1111
part 'kitchen_sink.g.dart';
1212

0 commit comments

Comments
 (0)