Skip to content
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

Bump min SDK to Dart 2.18.0 / Flutter 3.3.0 & fix CI #2176

Merged
merged 16 commits into from
Apr 18, 2024
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
31 changes: 31 additions & 0 deletions .github/workflows/coverage_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'coverage_comment'

# This workflow runs after the 'Verify packages abilities' workflow is completed for a pull request.
# The workflow downloads the coverage report if the 'Verify packages abilities' workflow was successful.
# The workflow then adds a comment to the PR with the coverage report.

on:
workflow_run:
workflows: ['Verify packages abilities']
types:
- completed

jobs:
download_coverage:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
steps:
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow: tests.yml
workflow_conclusion: success
run_id: ${{ github.event.workflow_run.id }}
name: code-coverage-results.md
- name: Add PR comment
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ github.event.workflow_run.pull_requests[0].number }}
recreate: true
path: code-coverage-results.md
20 changes: 8 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '6.0.0'
paths-ignore:
- "**.md"
pull_request_target:
pull_request:
branches:
- main
- '6.0.0'
Expand All @@ -19,9 +19,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write

defaults:
run:
shell: bash -leo pipefail {0}
Expand All @@ -40,7 +37,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: ${{ matrix.sdk == 'min' && '2.8.0' || '' }}
flutter-version: ${{ matrix.sdk == 'min' && '3.3.0' || '' }}
channel: ${{ matrix.sdk == 'min' && '' || matrix.channel }}
- run: dart pub get
- uses: bluefireteam/melos-action@v3
Expand Down Expand Up @@ -99,17 +96,16 @@ jobs:
- name: '[Coverage] Format & print test coverage'
if: ${{ matrix.sdk == 'stable' }}
run: melos run coverage:show
- name: '[Coverage] Coverage Report'
- name: '[Coverage] Create Report'
uses: clearlyip/code-coverage-report-action@v4
id: code_coverage_report
if: ${{ matrix.sdk == 'stable' && github.actor != 'dependabot[bot]'}}
with:
artifact_download_workflow_names: 'Verify packages abilities,coverage_baseline'
filename: 'coverage/cobertura.xml'
- name: '[Coverage] Add PR comment'
uses: marocchino/sticky-pull-request-comment@v2
#Make sure the report was generated and that the event is actually a pull request, run if failed or success
if: ${{ matrix.sdk == 'stable' && github.actor != 'dependabot[bot]' && steps.code_coverage_report.outputs.file != '' && (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && (success() || failure()) }}
- name: '[Coverage] Upload'
if: ${{ matrix.sdk == 'stable' && github.actor != 'dependabot[bot]'}}
uses: actions/upload-artifact@v4
with:
recreate: true
path: code-coverage-results.md
name: code-coverage-results.md
path: code-coverage-results.md
15 changes: 10 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ doc/api/

.vscode/

# FVM
.fvm
.fvmrc

# Miscellaneous
.DS_Store
.melos*packages

# IDEA configurations
/.idea/*
!/.idea/dio.iml
!/.idea/modules.xml

# Coverage
coverage

# Melos
**/.melos_package
.melos_packages
melos_overrides.yaml

# FVM Version Cache
.fvm/
.fvmrc
21 changes: 21 additions & 0 deletions COMPATIBILITY_POLICY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Compatibility Policy

As an open-source project, all activities happened when the maintainers have spare time and energy.
The support range is limited due to the above condition.
Therefore, we have a general compatibility policy to help people
that are not actively adapting SDK updates or intended to use any old SDKs to acknowledge the support range.

## Policy Details

For all packages, the oldest Dart SDK we typically support
is one that was **released less than 2 years ago**.

### Exceptions

- The minimum SDK version will follow the dependencies' requirement.
For example: `http2: ^2.1.0` requires Dart SDK >=3.0.0.
- The implementation can no longer compatible between the latest and previous SDKs.
- Previous SDKs have security issues that require to use a new version.

To raise your suggestions and reports, use the issue tracker
or contact [email protected] if you want to do this privately.
15 changes: 11 additions & 4 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@ Language: [English](README.md) | 简体中文
> [#dio](https://pub.flutter-io.cn/packages?q=topic%3Adio) 分类标签!
> 了解更多:https://dart.cn/tools/pub/pubspec#topics

### dio

- dio: [链接](dio)
[![Pub](https://img.shields.io/pub/v/dio.svg?label=dev&include_prereleases)](https://pub.flutter-io.cn/packages/dio)
## 版本问题

**在你更新之前:大版本和次要版本可能会包含不兼容的重大改动。<br/>
请阅读 [迁移指南][] 了解完整的重大变更内容。**

想要了解我们的兼容性政策,请参阅 [兼容性政策][]文档。

[迁移指南]: https://pub.flutter-io.cn/documentation/dio/latest/topics/Migration%20Guide-topic.html
[兼容性政策]: COMPATIBILITY_POLICY.md

## 所有依赖

### dio

- dio: [链接](dio)
[![Pub](https://img.shields.io/pub/v/dio.svg?label=dev&include_prereleases)](https://pub.flutter-io.cn/packages/dio)

### 插件

Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ Please move specific paths for project instructions.
> topic to your published dio related packages!
> See more: https://dart.dev/tools/pub/pubspec#topics

### dio

- dio: [link](dio)
[![Pub](https://img.shields.io/pub/v/dio.svg?label=dev&include_prereleases)](https://pub.dev/packages/dio)
## Versioning

**Before you upgrade: Breaking changes might happen in major and minor versions of packages.<br/>
See the [Migration Guide][] for the complete breaking changes list.**

To know about our compatibility policy, see the [Compatibility Policy][] doc.

[Migration Guide]: https://pub.dev/documentation/dio/latest/topics/Migration%20Guide-topic.html
[Compatibility Policy]: COMPATIBILITY_POLICY.md

## All Packages

### dio

- dio: [link](dio)
[![Pub](https://img.shields.io/pub/v/dio.svg?label=dev&include_prereleases)](https://pub.dev/packages/dio)

### Plugins

Expand Down
9 changes: 4 additions & 5 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

## Supported Versions


| Version | Supported |
| ------- | ------------------ |
| >=5.0 | :white_check_mark: |
| < 5.0 | :x: |
| Version | Supported |
|---------|-----------|
| >=5.0 | ✅ |
| < 5.0 | ❌ |

## Reporting a Vulnerability

Expand Down
2 changes: 1 addition & 1 deletion dio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ See the [Migration Guide][] for the complete breaking changes list.**

## Unreleased

*None.*
- Raise the min Dart SDK version to 2.18.0.

## 5.4.3+1

Expand Down
103 changes: 34 additions & 69 deletions dio/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,43 +136,26 @@ mixin OptionsMixin {
/// The base config for the Dio instance, used by [Dio.options].
class BaseOptions extends _RequestConfig with OptionsMixin {
BaseOptions({
String? method,
super.method,
Duration? connectTimeout,
Duration? receiveTimeout,
Duration? sendTimeout,
super.receiveTimeout,
super.sendTimeout,
String baseUrl = '',
Map<String, dynamic>? queryParameters,
Map<String, dynamic>? extra,
Map<String, dynamic>? headers,
bool preserveHeaderCase = false,
ResponseType? responseType = ResponseType.json,
String? contentType,
ValidateStatus? validateStatus,
bool? receiveDataWhenStatusError,
bool? followRedirects,
int? maxRedirects,
bool? persistentConnection,
RequestEncoder? requestEncoder,
ResponseDecoder? responseDecoder,
ListFormat? listFormat,
}) : super(
method: method,
receiveTimeout: receiveTimeout,
sendTimeout: sendTimeout,
extra: extra,
headers: headers,
preserveHeaderCase: preserveHeaderCase,
responseType: responseType,
contentType: contentType,
validateStatus: validateStatus,
receiveDataWhenStatusError: receiveDataWhenStatusError,
followRedirects: followRedirects,
maxRedirects: maxRedirects,
persistentConnection: persistentConnection,
requestEncoder: requestEncoder,
responseDecoder: responseDecoder,
listFormat: listFormat,
) {
super.extra,
super.headers,
super.preserveHeaderCase = false,
super.responseType = ResponseType.json,
super.contentType,
super.validateStatus,
super.receiveDataWhenStatusError,
super.followRedirects,
super.maxRedirects,
super.persistentConnection,
super.requestEncoder,
super.responseDecoder,
super.listFormat,
}) {
this.baseUrl = baseUrl;
this.queryParameters = queryParameters ?? {};
this.connectTimeout = connectTimeout;
Expand Down Expand Up @@ -500,46 +483,28 @@ class RequestOptions extends _RequestConfig with OptionsMixin {
this.onReceiveProgress,
this.onSendProgress,
this.cancelToken,
String? method,
Duration? sendTimeout,
Duration? receiveTimeout,
super.method,
super.sendTimeout,
super.receiveTimeout,
Duration? connectTimeout,
Map<String, dynamic>? queryParameters,
String? baseUrl,
Map<String, dynamic>? extra,
Map<String, dynamic>? headers,
bool? preserveHeaderCase,
ResponseType? responseType,
String? contentType,
ValidateStatus? validateStatus,
bool? receiveDataWhenStatusError,
bool? followRedirects,
int? maxRedirects,
bool? persistentConnection,
RequestEncoder? requestEncoder,
ResponseDecoder? responseDecoder,
ListFormat? listFormat,
super.extra,
super.headers,
super.preserveHeaderCase,
super.responseType,
super.contentType,
super.validateStatus,
super.receiveDataWhenStatusError,
super.followRedirects,
super.maxRedirects,
super.persistentConnection,
super.requestEncoder,
super.responseDecoder,
super.listFormat,
bool? setRequestContentTypeWhenNoPayload,
StackTrace? sourceStackTrace,
}) : assert(connectTimeout == null || !connectTimeout.isNegative),
super(
method: method,
sendTimeout: sendTimeout,
receiveTimeout: receiveTimeout,
extra: extra,
headers: headers,
preserveHeaderCase: preserveHeaderCase,
responseType: responseType,
contentType: contentType,
validateStatus: validateStatus,
receiveDataWhenStatusError: receiveDataWhenStatusError,
followRedirects: followRedirects,
maxRedirects: maxRedirects,
persistentConnection: persistentConnection,
requestEncoder: requestEncoder,
responseDecoder: responseDecoder,
listFormat: listFormat,
) {
}) : assert(connectTimeout == null || !connectTimeout.isNegative) {
this.sourceStackTrace = sourceStackTrace ?? StackTrace.current;
this.queryParameters = queryParameters ?? {};
this.baseUrl = baseUrl ?? '';
Expand Down
2 changes: 1 addition & 1 deletion dio/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repository: https://github.com/cfug/dio/blob/main/dio
issue_tracker: https://github.com/cfug/dio/issues

environment:
sdk: '>=2.15.0 <4.0.0'
sdk: '>=2.18.0 <4.0.0'

dependencies:
async: ^2.8.2
Expand Down
2 changes: 1 addition & 1 deletion dio/test/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ final Matcher throwsDioExceptionConnectionError = throwsA(

/// A stream of chunks of bytes representing a single piece of data.
class ByteStream extends StreamView<List<int>> {
ByteStream(Stream<List<int>> stream) : super(stream);
ByteStream(super.stream);

/// Returns a single-subscription byte stream that will emit the given bytes
/// in a single chunk.
Expand Down
Loading
Loading