Skip to content

Move annotations into json_annotation package #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ dart:
- stable

env:
- PKG=json_annotation TASK=dartanalyzer
- PKG=json_annotation TASK=dartfmt
- PKG=json_serializable TASK=dartanalyzer
- PKG=json_serializable TASK=dartfmt
- PKG=json_serializable TASK=test
Expand Down
4 changes: 4 additions & 0 deletions json_annotation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Files and directories created by pub
.packages
.pub/
pubspec.lock
16 changes: 16 additions & 0 deletions json_annotation/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: dart
dart:
- dev
- stable

dart_task:
- dartfmt
- dartanalyzer

# Only building master means that we don't run two builds for each pull request.
branches:
only: [master]

cache:
directories:
- $HOME/.pub-cache
3 changes: 3 additions & 0 deletions json_annotation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.2.0

- Moved annotation classes for `JsonSerializable` and `JsonLiteral`.
26 changes: 26 additions & 0 deletions json_annotation/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright 2017, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9 changes: 9 additions & 0 deletions json_annotation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Annotations for [json_serializable]. Use these to eliminate a production
dependency on `json_serializable` and the associated transitive dependencies.

## Features and bugs

Please file feature requests and bugs at the [issue tracker][tracker].

[tracker]: https://github.com/dart-lang/json_serializable/issues
[json_serializable]: https://pub.dartlang.org/packages/json_serializable
8 changes: 8 additions & 0 deletions json_annotation/lib/json_annotation.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// Use these annotations on members you'd like to enable source generation on.

export 'src/json_literal.dart';
export 'src/json_serializable.dart';
7 changes: 7 additions & 0 deletions json_annotation/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: json_annotation
version: 0.2.0
description: Annotations for the json_serializable package
homepage: https://github.com/dart-lang/json_serializable
author: Dart Team <misc@dartlang.org>
environment:
sdk: '>=1.24.0 <2.0.0'
9 changes: 9 additions & 0 deletions json_serializable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 0.2.4

* Moved the annotations in `annotations.dart` to `package:json_annotations`.
* Allows package authors to release code that has the corresponding
annotations without requiring package users to inherit all of the transitive
dependencies.

* Deprecated `annotations.dart`.

## 0.2.3

* Write out `toJson` methods more efficiently when the first fields written are
Expand Down
2 changes: 1 addition & 1 deletion json_serializable/example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// ignore_for_file: annotate_overrides
library json_serializable.example;

import 'package:json_serializable/annotations.dart';
import 'package:json_annotation/json_annotation.dart';
part 'example.g.dart';

@JsonSerializable()
Expand Down
6 changes: 3 additions & 3 deletions json_serializable/lib/annotations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

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

export 'src/json_literal.dart';
export 'src/json_serializable.dart';
export 'package:json_annotation/json_annotation.dart';
2 changes: 1 addition & 1 deletion json_serializable/lib/src/json_literal_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:build/build.dart';
import 'package:path/path.dart' as p;
import 'package:source_gen/source_gen.dart';

import 'json_literal.dart';
import 'package:json_annotation/json_annotation.dart';

class JsonLiteralGenerator extends GeneratorForAnnotation<JsonLiteral> {
const JsonLiteralGenerator();
Expand Down
2 changes: 1 addition & 1 deletion json_serializable/lib/src/json_serializable_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import 'dart:collection';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/analyzer.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:source_gen/source_gen.dart';

import 'json_serializable.dart';
import 'type_helper.dart';
import 'type_helpers/date_time_helper.dart';
import 'type_helpers/enum_helper.dart';
Expand Down
5 changes: 5 additions & 0 deletions json_serializable/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
analyzer: '>=0.29.10 <0.31.0'
build: '>=0.9.0 <0.11.0'
cli_util: ^0.1.0
json_annotation: any
path: ^1.3.2
source_gen: ^0.7.0
dev_dependencies:
Expand All @@ -17,3 +18,7 @@ dev_dependencies:
collection: ^1.14.0
dart_style: ^1.0.0
test: ^0.12.3

dependency_overrides:
json_annotation:
path: ../json_annotation
2 changes: 1 addition & 1 deletion json_serializable/test/test_files/bathtub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// ignore_for_file: annotate_overrides, hash_and_equals
library json_serializable.test.bathtub;

import 'package:json_serializable/annotations.dart';
import 'package:json_annotation/json_annotation.dart';

import 'kitchen_sink.dart';

Expand Down
2 changes: 1 addition & 1 deletion json_serializable/test/test_files/json_literal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

library json_serializable.example;

import 'package:json_serializable/annotations.dart';
import 'package:json_annotation/json_annotation.dart';
part 'json_literal.g.dart';

@JsonLiteral('data.json')
Expand Down
2 changes: 1 addition & 1 deletion json_serializable/test/test_files/json_test_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ library json_serializable.test.example;
import 'dart:collection';

import 'package:collection/collection.dart';
import 'package:json_serializable/annotations.dart';
import 'package:json_annotation/json_annotation.dart';

part 'json_test_example.g.dart';

Expand Down
2 changes: 1 addition & 1 deletion json_serializable/test/test_files/kitchen_sink.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
library json_serializable.test.kitche_sink;

import 'package:collection/collection.dart';
import 'package:json_serializable/annotations.dart';
import 'package:json_annotation/json_annotation.dart';

part 'kitchen_sink.g.dart';

Expand Down