Skip to content

Commit

Permalink
Set up a shared pub workspace (#3151)
Browse files Browse the repository at this point in the history
* Set up a shared pub workspace

* Use flutter pub get for now
  • Loading branch information
parlough authored Feb 20, 2025
1 parent d0b00b1 commit 95d442b
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dart_services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- run: flutter --version

- name: Install dart dependencies
run: dart pub get
run: flutter pub get

- name: Analyze project source
run: dart analyze --fatal-infos
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/dartpad_shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ jobs:
defaults:
run:
working-directory: pkgs/dartpad_shared/

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94

- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
- name: Install dart dependencies
run: dart pub get
run: flutter pub get

- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/dartpad_ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ jobs:
defaults:
run:
working-directory: pkgs/dartpad_ui/
strategy:
fail-fast: false
matrix:
sdk: [ beta, main ]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: main
channel: ${{ matrix.sdk }}
- run: flutter --version
- run: flutter pub get
- run: flutter analyze
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: workspace

permissions: read-all

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * 0' # weekly

jobs:
validate:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [ stable, beta, main ]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: ${{ matrix.sdk }}
- run: dart --version
- name: Validate cross-workspace resolution
run: flutter pub get
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
build/
.buildlog
.dart_tool/
.packages
.flutter-plugins
.flutter-plugins-dependencies
pubspec.lock

# Or the files created by dart2js.
*.dart.js
Expand Down
8 changes: 3 additions & 5 deletions pkgs/dart_services/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: dart_services
description: The backend service for DartPad.
publish_to: none

resolution: workspace
environment:
sdk: ^3.6.1

Expand All @@ -10,7 +11,8 @@ dependencies:
analyzer: ^7.1.0
args: ^2.5.0
bazel_worker: ^1.1.1
dartpad_shared: ^0.0.0
dartpad_shared:
path: ../dartpad_shared
encrypt: ^5.0.3
http: ^1.2.1
json_annotation: ^4.9.0
Expand All @@ -32,7 +34,3 @@ dev_dependencies:
synchronized: ^3.1.0+1
test: ^1.25.9
test_descriptor: ^2.0.1

dependency_overrides:
dartpad_shared:
path: ../dartpad_shared
1 change: 1 addition & 0 deletions pkgs/dartpad_shared/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: dartpad_shared
description: Shared code between the DartPad frontend and backend.
publish_to: none

resolution: workspace
environment:
sdk: ^3.6.1

Expand Down
8 changes: 3 additions & 5 deletions pkgs/dartpad_ui/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ name: dartpad_ui
description: The front-end UI of DartPad.
publish_to: none

resolution: workspace
environment:
sdk: ^3.6.1

dependencies:
collection: ^1.19.0
dartpad_shared: any
dartpad_shared:
path: ../dartpad_shared
flutter:
sdk: flutter
flutter_markdown: ^0.7.2
Expand Down Expand Up @@ -40,7 +42,3 @@ flutter:
- assets/idx_192.png
- assets/RobotoMono-Bold.ttf
- assets/RobotoMono-Regular.ttf

dependency_overrides:
dartpad_shared:
path: ../dartpad_shared
1 change: 1 addition & 0 deletions pkgs/samples/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: samples
description: Sample code snippets for DartPad.
publish_to: none

resolution: workspace
environment:
sdk: ^3.6.1

Expand Down
11 changes: 11 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: dartpad_workspace
publish_to: none

workspace:
- pkgs/dart_services
- pkgs/dartpad_shared
- pkgs/dartpad_ui
- pkgs/samples

environment:
sdk: ^3.6.1

0 comments on commit 95d442b

Please sign in to comment.