Skip to content

Commit

Permalink
chore: require Dart 3.5, move to workspaces (#479)
Browse files Browse the repository at this point in the history
Work-around for dart-lang/pub#4357
  • Loading branch information
kevmoo authored Aug 19, 2024
1 parent 128ccec commit 1a8e219
Show file tree
Hide file tree
Showing 28 changed files with 94 additions and 58 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,23 @@ jobs:
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
name: "analyze_format; Dart 3.4.0; PKGS: dartfn, dartfn/templates/cloudevent, dartfn/templates/helloworld, dartfn/templates/json, examples/fullstack/backend, examples/fullstack/frontend-cli, examples/hello, examples/json, examples/protobuf_firestore, examples/raw_cloudevent, functions_framework, functions_framework_builder, google_cloud; `dart analyze`"
name: "analyze_format; Dart 3.5.0; PKGS: dartfn, dartfn/templates/cloudevent, dartfn/templates/helloworld, dartfn/templates/json, examples/fullstack/backend, examples/fullstack/frontend-cli, examples/hello, examples/json, examples/protobuf_firestore, examples/raw_cloudevent, functions_framework, functions_framework_builder, google_cloud; `dart analyze`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:dartfn-dartfn/templates/cloudevent-dartfn/templates/helloworld-dartfn/templates/json-examples/fullstack/backend-examples/fullstack/frontend-cli-examples/hello-examples/json-examples/protobuf_firestore-examples/raw_cloudevent-functions_framework-functions_framework_builder-google_cloud;commands:analyze_1"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:dartfn-dartfn/templates/cloudevent-dartfn/templates/helloworld-dartfn/templates/json-examples/fullstack/backend-examples/fullstack/frontend-cli-examples/hello-examples/json-examples/protobuf_firestore-examples/raw_cloudevent-functions_framework-functions_framework_builder-google_cloud;commands:analyze_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:dartfn-dartfn/templates/cloudevent-dartfn/templates/helloworld-dartfn/templates/json-examples/fullstack/backend-examples/fullstack/frontend-cli-examples/hello-examples/json-examples/protobuf_firestore-examples/raw_cloudevent-functions_framework-functions_framework_builder-google_cloud
os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0
os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:dartfn-dartfn/templates/cloudevent-dartfn/templates/helloworld-dartfn/templates/json-examples/fullstack/backend-examples/fullstack/frontend-cli-examples/hello-examples/json-examples/protobuf_firestore-examples/raw_cloudevent-functions_framework-functions_framework_builder-google_cloud
os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: "3.4.0"
sdk: "3.5.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ permissions: read-all

jobs:
job_001:
name: "unit_test; linux; Dart 3.4.0; PKGS: dartfn, functions_framework_builder, google_cloud, integration_test; `dart test`"
name: "unit_test; linux; Dart 3.5.0; PKGS: dartfn, functions_framework_builder, google_cloud, integration_test; `dart test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:dartfn-functions_framework_builder-google_cloud-integration_test;commands:test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:dartfn-functions_framework_builder-google_cloud-integration_test;commands:test_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:dartfn-functions_framework_builder-google_cloud-integration_test
os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0
os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:dartfn-functions_framework_builder-google_cloud-integration_test
os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: "3.4.0"
sdk: "3.5.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
Expand Down Expand Up @@ -73,23 +73,23 @@ jobs:
if: "always() && steps.integration_test_pub_upgrade.conclusion == 'success'"
working-directory: integration_test
job_002:
name: "unit_test; linux; Dart 3.4.0; PKG: google_cloud; `./tool/docker_test_script.sh`"
name: "unit_test; linux; Dart 3.5.0; PKG: google_cloud; `./tool/docker_test_script.sh`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:google_cloud;commands:command"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:google_cloud;commands:command"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:google_cloud
os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0
os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:google_cloud
os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: "3.4.0"
sdk: "3.5.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
Expand Down Expand Up @@ -280,23 +280,23 @@ jobs:
if: "always() && steps.integration_test_pub_upgrade.conclusion == 'success'"
working-directory: integration_test
job_005:
name: "unit_test; macos; Dart 3.4.0; PKG: google_cloud; `dart test`"
name: "unit_test; macos; Dart 3.5.0; PKG: google_cloud; `dart test`"
runs-on: macos-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: "~/.pub-cache/hosted"
key: "os:macos-latest;pub-cache-hosted;sdk:3.4.0;packages:google_cloud;commands:test_0"
key: "os:macos-latest;pub-cache-hosted;sdk:3.5.0;packages:google_cloud;commands:test_0"
restore-keys: |
os:macos-latest;pub-cache-hosted;sdk:3.4.0;packages:google_cloud
os:macos-latest;pub-cache-hosted;sdk:3.4.0
os:macos-latest;pub-cache-hosted;sdk:3.5.0;packages:google_cloud
os:macos-latest;pub-cache-hosted;sdk:3.5.0
os:macos-latest;pub-cache-hosted
os:macos-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: "3.4.0"
sdk: "3.5.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.dart_tool
pubspec.lock
2 changes: 1 addition & 1 deletion dartfn/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 0.4.7-wip

- Use latest `dart_flutter_team_lints` version.
- Require Dart 3.4
- Require Dart 3.5

## 0.4.6

Expand Down
2 changes: 1 addition & 1 deletion dartfn/lib/src/generators/cloudevent.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dartfn/lib/src/generators/helloworld.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dartfn/lib/src/generators/json.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dartfn/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ description: >
version: 0.4.7-wip
homepage: https://github.com/GoogleCloudPlatform/functions-framework-dart

resolution: workspace
environment:
sdk: ^3.4.0
sdk: ^3.5.0

executables:
dartfn:
Expand Down
2 changes: 1 addition & 1 deletion dartfn/templates/cloudevent/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: A sample Functions Framework project for handling a cloudevent.
publish_to: none

environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
functions_framework: ^0.4.0
Expand Down
2 changes: 1 addition & 1 deletion dartfn/templates/helloworld/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: A sample "Hello, World!" Functions Framework project.
publish_to: none

environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
functions_framework: ^0.4.0
Expand Down
2 changes: 1 addition & 1 deletion dartfn/templates/json/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: A sample Functions Framework project for handling JSON.
publish_to: none

environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
functions_framework: ^0.4.0
Expand Down
3 changes: 2 additions & 1 deletion examples/fullstack/backend/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: backend
publish_to: none

resolution: workspace
environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
functions_framework: ^0.4.0
Expand Down
4 changes: 2 additions & 2 deletions examples/fullstack/frontend-cli/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: frontend_cli
publish_to: none

environment:
sdk: ^3.4.0
sdk: ^3.5.0

executables:
greet:

dependencies:
http: '>=0.13.1 <2.0.0'
http: ^1.0.0
io: ^1.0.0
json_annotation: ^4.9.0

Expand Down
4 changes: 1 addition & 3 deletions examples/fullstack/frontend/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: fullstack_demo_frontend
description: Flutter frontend for Dart full-stack demo
version: 1.0.0
publish_to: 'none'

environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
cupertino_icons: ^1.0.2
Expand Down
3 changes: 2 additions & 1 deletion examples/hello/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ description: Dart Functions Framework simple function example.
repository: https://github.com/GoogleCloudPlatform/functions-framework-dart
publish_to: none

resolution: workspace
environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
functions_framework: ^0.4.0
Expand Down
6 changes: 2 additions & 4 deletions examples/json/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: example_json_function
version: 0.4.0
description: Dart Functions Framework simple JSON function example.
repository: https://github.com/GoogleCloudPlatform/functions-framework-dart
publish_to: none

resolution: workspace
environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
functions_framework: ^0.4.0
Expand Down
5 changes: 3 additions & 2 deletions examples/protobuf_firestore/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: example_protobuf_firestore
publish_to: none

resolution: workspace
environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
functions_framework: ^0.4.3
Expand All @@ -13,6 +14,6 @@ dev_dependencies:
build_runner: ^2.2.1
dart_flutter_team_lints: ^3.0.0
functions_framework_builder: ^0.4.10
http: ">=0.13.5 <2.0.0"
http: ^1.0.0
test: ^1.21.6
test_process: ^2.0.0
3 changes: 2 additions & 1 deletion examples/raw_cloudevent/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: example_raw_cloudevent_function
publish_to: none

resolution: workspace
environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
functions_framework: ^0.4.0
Expand Down
2 changes: 1 addition & 1 deletion functions_framework/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.4.4-wip

- Require Dart 3.4
- Require Dart 3.5

## 0.4.3+1

Expand Down
3 changes: 2 additions & 1 deletion functions_framework/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ description: >-
FaaS (Function as a service) framework for writing portable Dart functions
repository: https://github.com/GoogleCloudPlatform/functions-framework-dart

resolution: workspace
environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
args: ^2.0.0
Expand Down
2 changes: 1 addition & 1 deletion functions_framework_builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.4.11-wip

- Require Dart 3.4
- Require Dart 3.5

## 0.4.10

Expand Down
5 changes: 3 additions & 2 deletions functions_framework_builder/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ version: 0.4.11-wip
description: Builder for package:functions_framework
repository: https://github.com/GoogleCloudPlatform/functions-framework-dart

resolution: workspace
environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
analyzer: '>=5.12.0 <7.0.0'
Expand All @@ -14,7 +15,7 @@ dependencies:
dart_style: ^2.2.4
# There is a tight version constraint because the builder has a strict
# dependency on all features exposed.
functions_framework: '>=0.4.0 <0.4.4'
functions_framework: '>=0.4.0 <0.4.5'
glob: ^2.0.0
meta: ^1.7.0
path: ^1.8.0
Expand Down
2 changes: 1 addition & 1 deletion google_cloud/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 0.2.1-wip

- Require `package:http` `^1.0.0`.
- Require Dart 3.4
- Require Dart 3.5

## 0.2.0

Expand Down
3 changes: 2 additions & 1 deletion google_cloud/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ description: >-
version: 0.2.1-wip
repository: https://github.com/GoogleCloudPlatform/functions-framework-dart/tree/main/google_cloud

resolution: workspace
environment:
sdk: ^3.4.0
sdk: ^3.5.0

dependencies:
collection: ^1.17.0
Expand Down
3 changes: 3 additions & 0 deletions google_cloud/tool/docker_test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

set -e

__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
${__dir}/fix_pubspec.dart

image="$(docker build -q .)"
echo Image created: "$image"
container=$(docker run -d -p 8080:8080 --rm "$image")
Expand Down
15 changes: 15 additions & 0 deletions google_cloud/tool/fix_pubspec.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env dart

import 'dart:io';

// Removes the `workspace` property from the pubspec so it can be used via
// Docker.
// Work-around for https://github.com/dart-lang/pub/issues/4357
void main(List<String> args) {
final file = File('pubspec.yaml');
final content = file.readAsStringSync().replaceAll(_content, '');
file.writeAsStringSync(content);
}

const _content = r'''resolution: workspace
''';
Loading

0 comments on commit 1a8e219

Please sign in to comment.