Skip to content

Commit

Permalink
Merge pull request #598 from dart-lang/merge-file-package
Browse files Browse the repository at this point in the history
transfer package:file, package:file_testing
  • Loading branch information
devoncarew authored Oct 4, 2024
2 parents d4995d4 + 79ef391 commit acc440e
Show file tree
Hide file tree
Showing 76 changed files with 10,630 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:file"
about: "Create a bug or file a feature request against package:file."
labels: "package:file"
---
8 changes: 8 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
- changed-files:
- any-glob-to-any-file: 'pkgs/extension_discovery/**'

'package:file':
- changed-files:
- any-glob-to-any-file: 'pkgs/file/**'

'package:file_testing':
- changed-files:
- any-glob-to-any-file: 'pkgs/file_testing/**'

'package:graphs':
- changed-files:
- any-glob-to-any-file: 'pkgs/graphs/**'
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: package:file
permissions: read-all

on:
# Run on PRs and pushes to the default branch.
push:
branches: [ main ]
paths:
- '.github/workflows/file.yml'
- 'pkgs/file/**'
- 'pkgs/file_testing/**'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/file.yml'
- 'pkgs/file/**'
- 'pkgs/file_testing/**'
schedule:
- cron: "0 0 * * 0"

jobs:
correctness:
runs-on: ubuntu-latest
strategy:
matrix:
package: [file, file_testing]

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: dev

- name: Install ${{ matrix.package }} dependencies
working-directory: pkgs/${{ matrix.package }}
run: dart pub get

- name: Verify formatting in ${{ matrix.package }}
working-directory: pkgs/${{ matrix.package }}
run: dart format --output=none --set-exit-if-changed .

- name: Analyze package ${{ matrix.package }} source
working-directory: pkgs/${{ matrix.package }}
run: dart analyze --fatal-infos

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
package: [file]
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [stable, dev]

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: ${{ matrix.sdk }}

- name: Install ${{ matrix.package }} dependencies
working-directory: pkgs/${{ matrix.package }}
run: dart pub get

- name: Run ${{ matrix.package }} Tests
working-directory: pkgs/${{ matrix.package }}
run: dart pub run test -j1
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ don't naturally belong to other topic monorepos (like
| [cli_config](pkgs/cli_config/) | A library to take config values from configuration files, CLI arguments, and environment variables. | [![pub package](https://img.shields.io/pub/v/cli_config.svg)](https://pub.dev/packages/cli_config) |
| [coverage](pkgs/coverage/) | Coverage data manipulation and formatting. | [![pub package](https://img.shields.io/pub/v/coverage.svg)](https://pub.dev/packages/coverage) |
| [extension_discovery](pkgs/extension_discovery/) | A convention and utilities for package extension discovery. | [![pub package](https://img.shields.io/pub/v/extension_discovery.svg)](https://pub.dev/packages/extension_discovery) |
| [file](pkgs/file/) | A pluggable, mockable file system abstraction for Dart. | [![pub package](https://img.shields.io/pub/v/file.svg)](https://pub.dev/packages/file) |
| [file_testing](pkgs/file_testing/) | Testing utilities for package:file (published but unlisted). | [![pub package](https://img.shields.io/pub/v/file_testing.svg)](https://pub.dev/packages/file_testing) |
| [graphs](pkgs/graphs/) | Graph algorithms that operate on graphs in any representation | [![pub package](https://img.shields.io/pub/v/graphs.svg)](https://pub.dev/packages/graphs) |
| [mime](pkgs/mime/) | Utilities for handling media (MIME) types. | [![pub package](https://img.shields.io/pub/v/mime.svg)](https://pub.dev/packages/mime) |
| [oauth2](pkgs/oauth2/) | A client library for authenticatingand making requests via OAuth2. | [![pub package](https://img.shields.io/pub/v/oauth2.svg)](https://pub.dev/packages/oauth2) |
Expand Down
5 changes: 5 additions & 0 deletions pkgs/file/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dart_tool/
.packages
.pub/
build/
pubspec.lock
239 changes: 239 additions & 0 deletions pkgs/file/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
## 7.0.1-wip

## 7.0.0

* Dart 3 fixes for class modifiers.
* `MemoryFileSystem` now treats empty paths as non-existent.
* Fix `FileSystem.isLink`/`FileSystem.isLinkSync` to not follow symbolic links.
* Make the return type of `MemoryFile.openRead` and `_ChrootFile.openRead` again
match the return type from `dart:io`.

## 6.1.4

* Populate the pubspec `repository` field.

## 6.1.3

* In classes that implement `File` methods `create`, `createSync` now take `bool exclusive = true` parameter. No functional changes.

## 6.1.2

* `MemoryFileSystem` now provides `opHandle`s for exists operations.

## 6.1.1

* `MemoryFile` now provides `opHandle`s for copy and open operations.

## 6.1.0

* Reading invalid UTF8 with the `MemoryFileSystem` now correctly throws a `FileSystemException` instead of a `FormatError`.
* `MemoryFileSystem` now provides an `opHandle` to inspect read/write operations.
* `MemoryFileSystem` now creates the temporary directory before returning in `createTemp`/`createTempSync`.

## 6.0.1

* Fix sound type error in memory backend when reading non-existent `MemoryDirectory`.

## 6.0.0

* First stable null safe release.

## 6.0.0-nullsafety.4

* Update upper bound of SDK constraint.

## 6.0.0-nullsafety.3

* Update upper bound of SDK constraint.

## 6.0.0-nullsafety.2

* Make `ForwardingFile.openRead`'s return type again match the return type from
`dart:io`.
* Remove some unnecessary `Uint8List` conversions in `ForwardingFile`.

## 6.0.0-nullsafety.1

* Update to null safety.
* Remove record/replay functionality.
* Made `MemoryRandomAccessFile` and `MemoryFile.openWrite` handle the file
being removed or renamed while open.
* Fixed incorrect formatting in `NoMatchingInvocationError.toString()`.
* Fixed more test flakiness.
* Enabled more tests.
* Internal cleanup.
* Remove implicit dynamic in preparation for null safety.
* Remove dependency on Intl.

## 5.2.1

* systemTemp directories created by `MemoryFileSystem` will allot names
based on the file system instance instead of globally.
* `MemoryFile.readAsLines()`/`readAsLinesSync()` no longer treat a final newline
in the file as the start of a new, empty line.
* `RecordingFile.readAsLine()`/`readAsLinesSync()` now always record a final
newline.
* `MemoryFile.flush()` now returns `Future<void>` instead of `Future<dynamic>`.
* Fixed some test flakiness.
* Enabled more tests.
* Internal cleanup.

## 5.2.0

* Added a `MemoryRandomAccessFile` class and implemented
`MemoryFile.open()`/`openSync()`.

## 5.1.0

* Added a new `MemoryFileSystem` constructor to use a test clock

## 5.0.10

* Added example

## 5.0.9

* Fix lints for project health

## 5.0.8

* Return `Uint8List` rather than `List<int>`.

## 5.0.7

* Dart 2 fixes for `RecordingProxyMixin` and `ReplayProxyMixin`.

## 5.0.6

* Dart 2 fixes for `RecordingFile.open()`

## 5.0.5

* Dart 2 fixes

## 5.0.4

* Update SDK constraint to 2.0.0-dev.67.0, remove workaround in
recording_proxy_mixin.dart.
* Fix usage within Dart 2 runtime mode in Dart 2.0.0-dev.61.0 and later.
* Relax constraints on `package:test`

## 5.0.3

* Update `package:test` dependency to 1.0

## 5.0.2

* Declare compatibility with Dart 2 stable

## 5.0.1

* Remove upper case constants
* Update SDK constraint to 2.0.0-dev.54.0.

## 5.0.0

* Moved `testing` library into a dedicated `package:file_testing` so that
libraries don't need to take on a transitive dependency on `package:test`
in order to use `package:file`.

## 4.0.1

* General library cleanup
* Add `style` support in `MemoryFileSystem`, so that callers can choose to
have a memory file system with windows-like paths. [#68]
(https://github.com/google/file.dart/issues/68)

## 4.0.0

* Change method signature for `RecordingRandomAccessFile._close` to return a
`Future<void>` instead of `Future<RandomAccessFile>`. This follows a change in
dart:io, Dart SDK `2.0.0-dev.40`.

## 3.0.0

* Import `dart:io` unconditionally. More recent Dart SDK revisions allow
`dart:io` to be imported in a browser context, though if methods are actually
invoked, they will fail. This matches well with `package:file`, where users
can use the `memory` library and get in-memory implementations of the
`dart:io` interfaces.
* Bump minimum Dart SDK to `1.24.0`

## 2.3.7

* Fix Dart 2 error.

## 2.3.6

* Relax sdk upper bound constraint to '<2.0.0' to allow 'edge' dart sdk use.

## 2.3.5

* Fix internal use of a cast which fails on Dart 2.0 .

## 2.3.4

* Bumped maximum Dart SDK version to 2.0.0-dev.infinity

## 2.3.3

* Relaxes version requirements on `package:intl`

## 2.3.2

* Fixed `FileSystem.directory(Uri)`, `FileSystem.file(Uri)`, and
`FileSystem.link(Uri)` to consult the file system's path context when
converting the URI to a file path rather than using `Uri.toFilePath()`.

## 2.3.1

* Fixed `MemoryFileSystem` to make `File.writeAs...()` update the last modified
time of the file.

## 2.3.0

* Added the following convenience methods in `Directory`:
* `Directory.childDirectory(String basename)`
* `Directory.childFile(String basename)`
* `Directory.childLink(String basename)`

## 2.2.0

* Added `ErrorCodes` class, which holds errno values.

## 2.1.0

* Add support for new `dart:io` API methods added in Dart SDK 1.23

## 2.0.1

* Minor doc updates

## 2.0.0

* Improved `toString` implementations in file system entity classes
* Added `ForwardingFileSystem` and associated forwarding classes to the
main `file` library
* Removed `FileSystem.pathSeparator`, and added a more comprehensive
`FileSystem.path` property
* Added `FileSystemEntity.basename` and `FileSystemEntity.dirname`
* Added the `record_replay` library
* Added the `testing` library

## 1.0.1

* Added `FileSystem.systemTempDirectory`
* Added the ability to pass `Uri` and `FileSystemEntity` types to
`FileSystem.directory()`, `FileSystem.file()`, and `FileSystem.link()`
* Added `FileSystem.pathSeparator`

## 1.0.0

* Unified interface to match dart:io API
* Local file system implementation
* In-memory file system implementation
* Chroot file system implementation

## 0.1.0

* Initial version
26 changes: 26 additions & 0 deletions pkgs/file/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.
Loading

0 comments on commit acc440e

Please sign in to comment.