-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[macros] Copy
macros
and _macros
into package:json
as a workaro…
…und. Change-Id: I3e9ce2c21b55661eb25f6523e1912fba6d364a4b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366380 Commit-Queue: Morgan :) <davidmorgan@google.com> Reviewed-by: Jake Macdonald <jakemac@google.com>
- Loading branch information
1 parent
6824371
commit e4c1985
Showing
71 changed files
with
15,467 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!lib/.dart_tool/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 0.20.1 | ||
|
||
- Vendor macro packages as workaround for analyzer issue. | ||
|
||
# 0.20.0 | ||
|
||
- Initial preview of JSON encoding and decoding with a JsonCodable macro. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
include: package:lints/recommended.yaml | ||
|
||
analyzer: | ||
errors: | ||
deprecated_member_use_from_same_package: ignore | ||
enable-experiment: | ||
- macros |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## 0.1.5 | ||
|
||
- Handle ParallelWaitError with DiagnosticException errors nicely. | ||
- Fix a bug where we weren't reporting diagnostics for nested builders. | ||
|
||
## 0.1.4 | ||
|
||
- Improve formatting of constructor initializer augmentations. | ||
|
||
## 0.1.3 | ||
|
||
- Validate parts in `Code.fromParts()`. | ||
|
||
## 0.1.2 | ||
|
||
- Add caching for `typeDeclarationOf` results. | ||
|
||
## 0.1.1 | ||
|
||
- Add caching for `TypeDeclaration` related introspection results. | ||
|
||
## 0.1.0 | ||
|
||
Initial release, copied from `_fe_analyzer_shared/lib/src/macros`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
## Required steps when updating this package | ||
|
||
Whenever any change to the `lib` directory of this package is made, the | ||
following procedure **must** be followed. | ||
|
||
### Update pubspec/changelog for each release. | ||
|
||
Because this is an SDK vendored package, every change is treated as a release, | ||
and must have a stable version number and CHANGELOG.md entry. | ||
|
||
### Update and publish `package:macros` | ||
|
||
Additionally, the pub package `macros`, which lives at `pkg/macros`, must have | ||
a corresponding release on pub for each version of this package. | ||
|
||
The version of the `_macros` dependency in its pubspec must be updated to match | ||
the new version of this package, and the pubspec version and changelog should be | ||
updated. The changelog should have the same information as the associated | ||
versions of this package. | ||
|
||
These changes to the `macros` package should be landed in the same CL as the | ||
changes to this package, and it should be immediately published when the CL is | ||
merged. These should be marked as pre-release versions (with the `-main.x` | ||
suffix), and stable versions will only be published when the beta SDK has been | ||
released (exact process is TBD, possibly could do it as a hotfix, or publish | ||
from a branch). | ||
|
||
It is possible that multiple breaking changes can land within the same major | ||
version of this package, during the pre-release period. Version compatibility is | ||
thus **not** guaranteed on the dev or main channels, only the beta and stable | ||
channels. | ||
|
||
## Special considerations for this package | ||
|
||
This package should generally be treated like a `dart:` library, since only | ||
exactly one version of it ships with any SDK. That has several implications. | ||
|
||
### Must follow breaking change process | ||
|
||
Any breaking change to this package should follow the same breaking change | ||
process as any change to the `dart:` libraries. | ||
|
||
In general any breaking change made here can result in users not being able to | ||
get a version solve on the newest SDK, if their macro dependencies have not yet | ||
updated to the latest version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright 2024, the Dart project authors. | ||
|
||
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 LLC 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
file:/tools/OWNERS_FOUNDATION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) 2024, 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. | ||
"""_macros package presubmit python script. | ||
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | ||
for more details about the presubmit API built into gcl. | ||
""" | ||
|
||
PRESUBMIT_VERSION = '2.0.0' | ||
USE_PYTHON3 = True | ||
|
||
|
||
# Ensures that the pubspec of `package_name` has been altered. | ||
# | ||
# Returns a list of errors if not. | ||
# | ||
# TODO(jakemac): Ensure the version was bumped as well. | ||
def EnsurePubspecAndChangelogAltered(input_api, package_name): | ||
errors = [] | ||
package_path = 'pkg/%s' % package_name | ||
pubspec_path = '%s/pubspec.yaml' % package_path | ||
pubspec_changed = any(file.LocalPath() == pubspec_path | ||
for file in input_api.change.AffectedFiles()) | ||
if not pubspec_changed: | ||
errors.append( | ||
('The pkg/_macros/lib dir was altered but the version of %s was ' | ||
'not bumped. See pkg/_macros/CONTRIBUTING.md' % package_path)) | ||
|
||
changelog_path = '%s/CHANGELOG.md' % package_path | ||
changelog_changed = any(file.LocalPath() == changelog_path | ||
for file in input_api.change.AffectedFiles()) | ||
if not changelog_changed: | ||
errors.append( | ||
('The pkg/_macros/lib dir was altered but the CHANGELOG.md of %s ' | ||
'was not edited. See pkg/_macros/CONTRIBUTING.md' % package_path)) | ||
return errors | ||
|
||
# Invoked on upload and commit. | ||
def CheckChange(input_api, output_api): | ||
errors = [] | ||
|
||
# If the `lib` dir is altered, we also require a change to the pubspec.yaml | ||
# of both this package and the `macros` package. | ||
lib_changed = any(file.LocalPath().startswith('pkg/_macros/lib') | ||
for file in input_api.AffectedFiles()) | ||
if lib_changed: | ||
errors += EnsurePubspecAndChangelogAltered(input_api, '_macros') | ||
errors += EnsurePubspecAndChangelogAltered(input_api, 'macros') | ||
|
||
if errors: | ||
return [ | ||
output_api.PresubmitError( | ||
'pkg/_macros presubmit/PRESUBMIT.py failure(s):', | ||
long_text='\n\n'.join(errors)) | ||
] | ||
|
||
return [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Package `_macros` contains a private API for authoring macros. | ||
It is exposed as a public API by [`package:macros`](./macros/README.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include: package:lints/recommended.yaml | ||
|
||
analyzer: | ||
language: | ||
strict-casts: true |
Oops, something went wrong.