Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions packages/pigeon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 23.0.0

* Relocates `lib` files to `src` directory.

## 22.7.4

* [dart] Fixes bug with multi-instance event channel support.
Expand Down
20 changes: 10 additions & 10 deletions packages/pigeon/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ generators with that AST.

## Source Index

* [ast.dart](./lib/ast.dart) - The data structure for representing the Abstract Syntax Tree.
* [dart_generator.dart](./lib/dart_generator.dart) - The Dart code generator.
* [java_generator.dart](./lib/java_generator.dart) - The Java code generator.
* [kotlin_generator.dart](./lib/kotlin_generator.dart) - The Kotlin code generator.
* [objc_generator.dart](./lib/objc_generator.dart) - The Objective-C code
* [ast.dart](./lib/src/ast.dart) - The data structure for representing the Abstract Syntax Tree.
* [dart_generator.dart](./lib/src/dart_generator.dart) - The Dart code generator.
* [java_generator.dart](./lib/src/java_generator.dart) - The Java code generator.
* [kotlin_generator.dart](./lib/src/kotlin_generator.dart) - The Kotlin code generator.
* [objc_generator.dart](./lib/src/objc_generator.dart) - The Objective-C code
generator (header and source files).
* [swift_generator.dart](./lib/swift_generator.dart) - The Swift code generator.
* [cpp_generator.dart](./lib/cpp_generator.dart) - The C++ code generator.
* [generator_tools.dart](./lib/generator_tools.dart) - Shared code between generators.
* [pigeon_cl.dart](./lib/pigeon_cl.dart) - The top-level function executed by
* [swift_generator.dart](./lib/src/swift_generator.dart) - The Swift code generator.
* [cpp_generator.dart](./lib/src/cpp_generator.dart) - The C++ code generator.
* [generator_tools.dart](./lib/src/generator_tools.dart) - Shared code between generators.
* [pigeon_cl.dart](./lib/src/pigeon_cl.dart) - The top-level function executed by
the command line tool in [bin/][./bin].
* [pigeon_lib.dart](./lib/pigeon_lib.dart) - The top-level function for the
* [pigeon_lib.dart](./lib/src/pigeon_lib.dart) - The top-level function for the
PigeonIsolate and the AST generation code.
* [pigeon.dart](./lib/pigeon.dart) - A file of exported modules, the intended
import for users of Pigeon.
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/bin/pigeon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import 'dart:io' show exit;

import 'package:pigeon/pigeon_cl.dart';
import 'package:pigeon/src/pigeon_cl.dart';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I guess bin/ has special-case allowance in the analyzer to import from the same package's src even if it's using a package: import?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised it was allowed as well, since the pigeon_cl.dart file is used outside of lib and tests, should I move it back out of src?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I found a reference later on the page I had linked to, it's explicitly allowed:

You are free to import libraries that live in lib/src from within other Dart code in the same package (like other libraries in lib, scripts in bin, and tests) but you should never import from another package's lib/src directory.

And that's the preferred format for such an include:

How you import libraries from within your own package depends on the locations of the libraries:

When reaching inside or outside lib/ (lint: avoid_relative_lib_imports), use package:.


Future<void> main(List<String> args) async {
exit(await runCommandLine(args));
Expand Down
17 changes: 9 additions & 8 deletions packages/pigeon/lib/pigeon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

export 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;

export 'cpp_generator.dart' show CppOptions;
export 'dart_generator.dart' show DartOptions;
export 'gobject_generator.dart' show GObjectOptions;
export 'java_generator.dart' show JavaOptions;
export 'kotlin_generator.dart' show KotlinOptions, KotlinProxyApiOptions;
export 'objc_generator.dart' show ObjcOptions;
export 'pigeon_lib.dart';
export 'swift_generator.dart' show SwiftOptions, SwiftProxyApiOptions;
export 'src/cpp/cpp_generator.dart' show CppOptions;
export 'src/dart/dart_generator.dart' show DartOptions;
export 'src/gobject/gobject_generator.dart' show GObjectOptions;
export 'src/java/java_generator.dart' show JavaOptions;
export 'src/kotlin/kotlin_generator.dart'
show KotlinOptions, KotlinProxyApiOptions;
export 'src/objc/objc_generator.dart' show ObjcOptions;
export 'src/pigeon_lib.dart';
export 'src/swift/swift_generator.dart' show SwiftOptions, SwiftProxyApiOptions;
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import 'package:collection/collection.dart' show ListEquality;
import 'package:meta/meta.dart';

import 'generator_tools.dart';
import 'kotlin_generator.dart' show KotlinProxyApiOptions;
import 'kotlin/kotlin_generator.dart' show KotlinProxyApiOptions;
import 'pigeon_lib.dart';
import 'swift_generator.dart' show SwiftProxyApiOptions;
import 'swift/swift_generator.dart' show SwiftProxyApiOptions;

typedef _ListEquals = bool Function(List<Object?>, List<Object?>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'ast.dart';
import 'functional.dart';
import 'generator.dart';
import 'generator_tools.dart';
import 'pigeon_lib.dart' show Error;
import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import '../pigeon_lib.dart' show Error;

/// General comment opening token.
const String _commentPrefix = '//';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import 'package:dart_style/dart_style.dart';
import 'package:path/path.dart' as path;
import 'package:pub_semver/pub_semver.dart';

import 'ast.dart';
import 'dart/templates.dart';
import 'functional.dart';
import 'generator.dart';
import 'generator_tools.dart';
import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import 'templates.dart';

/// Documentation comment open symbol.
const String _docCommentPrefix = '///';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'ast.dart';
/// The current version of pigeon.
///
/// This must match the version in pubspec.yaml.
const String pigeonVersion = '22.7.4';
const String pigeonVersion = '23.0.0';

/// Read all the content from [stdin] to a String.
String readStdin() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'ast.dart';
import 'generator.dart';
import 'generator_tools.dart';
import '../ast.dart';
import '../generator.dart';
import '../generator_tools.dart';

/// Documentation comment spec.
const DocumentCommentSpecification _docCommentSpec =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'ast.dart';
import 'functional.dart';
import 'generator.dart';
import 'generator_tools.dart';
import 'pigeon_lib.dart' show TaskQueueType;
import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import '../pigeon_lib.dart' show TaskQueueType;

/// Documentation open symbol.
const String _docCommentPrefix = '/**';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import 'package:graphs/graphs.dart';

import 'ast.dart';
import 'functional.dart';
import 'generator.dart';
import 'generator_tools.dart';
import 'kotlin/templates.dart';
import 'pigeon_lib.dart' show TaskQueueType;
import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import '../pigeon_lib.dart' show TaskQueueType;
import 'templates.dart';

/// Documentation open symbol.
const String _docCommentPrefix = '/**';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// found in the LICENSE file.

import '../generator_tools.dart';
import '../kotlin_generator.dart';
import 'kotlin_generator.dart';

/// Name of the Kotlin `InstanceManager`.
String kotlinInstanceManagerClassName(KotlinOptions options) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'ast.dart';
import 'functional.dart';
import 'generator.dart';
import 'generator_tools.dart';
import 'pigeon_lib.dart' show Error, TaskQueueType;
import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import '../pigeon_lib.dart' show Error, TaskQueueType;

/// Documentation comment open symbol.
const String _docCommentPrefix = '///';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ import 'package:pub_semver/pub_semver.dart';

import 'ast.dart';
import 'ast_generator.dart';
import 'cpp_generator.dart';
import 'dart_generator.dart';
import 'cpp/cpp_generator.dart';
import 'dart/dart_generator.dart';
import 'generator_tools.dart';
import 'generator_tools.dart' as generator_tools;
import 'gobject_generator.dart';
import 'java_generator.dart';
import 'kotlin_generator.dart';
import 'objc_generator.dart';
import 'swift_generator.dart';
import 'gobject/gobject_generator.dart';
import 'java/java_generator.dart';
import 'kotlin/kotlin_generator.dart';
import 'objc/objc_generator.dart';
import 'swift/swift_generator.dart';

class _Asynchronous {
const _Asynchronous();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import 'package:graphs/graphs.dart';
import 'package:pub_semver/pub_semver.dart';

import 'ast.dart';
import 'functional.dart';
import 'generator.dart';
import 'generator_tools.dart';
import 'swift/templates.dart';
import '../ast.dart';
import '../functional.dart';
import '../generator.dart';
import '../generator_tools.dart';
import 'templates.dart';

/// Documentation comment open symbol.
const String _docCommentPrefix = '///';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import '../../pigeon.dart';
import '../generator_tools.dart';
import '../pigeon.dart';

/// Name of delegate that handles the callback when an object is deallocated
/// in an `InstanceManager`.
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pigeon
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pigeon%22
version: 22.7.4 # This must match the version in lib/generator_tools.dart
version: 23.0.0 # This must match the version in lib/src/generator_tools.dart

environment:
sdk: ^3.4.0
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/test/ast_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/ast_generator.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/ast_generator.dart';
import 'package:test/test.dart';

void main() {
Expand Down
6 changes: 3 additions & 3 deletions packages/pigeon/test/cpp_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/cpp_generator.dart';
import 'package:pigeon/generator_tools.dart';
import 'package:pigeon/pigeon.dart' show Error;
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/cpp/cpp_generator.dart';
import 'package:pigeon/src/generator_tools.dart';
import 'package:test/test.dart';

const String DEFAULT_PACKAGE_NAME = 'test_package';
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/test/dart/proxy_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/dart_generator.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/dart/dart_generator.dart';
import 'package:test/test.dart';

const String DEFAULT_PACKAGE_NAME = 'test_package';
Expand Down
6 changes: 3 additions & 3 deletions packages/pigeon/test/dart_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import 'dart:io' show Directory, File;

import 'package:path/path.dart' as path;
import 'package:pigeon/ast.dart';
import 'package:pigeon/dart_generator.dart';
import 'package:pigeon/generator_tools.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/dart/dart_generator.dart';
import 'package:pigeon/src/generator_tools.dart';
import 'package:test/test.dart';

const String DEFAULT_PACKAGE_NAME = 'test_package';
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/test/functional_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/functional.dart';
import 'package:pigeon/src/functional.dart';
import 'package:test/test.dart';

void main() {
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/test/generator_tools_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/generator_tools.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/generator_tools.dart';
import 'package:test/test.dart';

bool _equalSet<T>(Set<T> x, Set<T> y) {
Expand Down
6 changes: 3 additions & 3 deletions packages/pigeon/test/gobject_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/generator_tools.dart';
import 'package:pigeon/gobject_generator.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/generator_tools.dart';
import 'package:pigeon/src/gobject/gobject_generator.dart';
import 'package:test/test.dart';

const String DEFAULT_PACKAGE_NAME = 'test_package';
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/test/java_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/java_generator.dart';
import 'package:pigeon/pigeon.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/java/java_generator.dart';
import 'package:test/test.dart';

const String DEFAULT_PACKAGE_NAME = 'test_package';
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/test/kotlin/proxy_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/kotlin_generator.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/kotlin/kotlin_generator.dart';
import 'package:test/test.dart';

const String DEFAULT_PACKAGE_NAME = 'test_package';
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/test/kotlin_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/kotlin_generator.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/kotlin/kotlin_generator.dart';
import 'package:test/test.dart';

const String DEFAULT_PACKAGE_NAME = 'test_package';
Expand Down
8 changes: 4 additions & 4 deletions packages/pigeon/test/objc_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:pigeon/ast.dart';
import 'package:pigeon/generator_tools.dart';
import 'package:pigeon/objc_generator.dart';
import 'package:pigeon/pigeon_lib.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/generator_tools.dart';
import 'package:pigeon/src/objc/objc_generator.dart';
import 'package:pigeon/src/pigeon_lib.dart';
import 'package:test/test.dart';

const String DEFAULT_PACKAGE_NAME = 'test_package';
Expand Down
6 changes: 3 additions & 3 deletions packages/pigeon/test/pigeon_lib_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import 'dart:async';
import 'dart:io';

import 'package:pigeon/ast.dart';
import 'package:pigeon/generator_tools.dart';
import 'package:pigeon/pigeon_lib.dart';
import 'package:pigeon/src/ast.dart';
import 'package:pigeon/src/generator_tools.dart';
import 'package:pigeon/src/pigeon_lib.dart';
import 'package:test/test.dart';

class _ValidatorGeneratorAdapter implements GeneratorAdapter {
Expand Down
Loading