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

Use pub workspace for the dart-pad monorepo #3041

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

johnpryan
Copy link
Contributor

This sets up a pub workspace for each of the packages in this monorepo. This lets us run dart pub get from the root of the project and take advantage of a shared analysis server.

@johnpryan johnpryan requested a review from devoncarew August 13, 2024 18:41
Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good generally - good to experiment with this feature. I don't know how this will interact with creating the docker images to run the backend, but I imagine we'll find that out.

In order to get this to work on the CI I think we'll need to provision using the flutter sdk instead of the dart one, given that some of the packages need flutter.

Run dart pub get
Resolving dependencies in `/home/runner/work/dart-pad/dart-pad`...
Because samples depends on flutter from sdk which doesn't exist (the Flutter SDK is not available), version solving failed.

dependency_overrides:
dartpad_shared:
path: ../dartpad_shared
# This package is managed as part of the dart-pad workspace.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a nit in these files, perhaps move the resolution info to before the dependencies section?

@johnpryan
Copy link
Contributor Author

The pub did not create .dart_tools/package_config.json file. error is likely due to the fact that we have not finished adding support for workspaces to the flutter tool.

Copy link

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Coverage ✔️
File Coverage

This check for test coverage is informational (issues shown here will not fail the PR).

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, 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.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/samples/lib/brick_breaker.dart
pkgs/samples/lib/fibonacci.dart
pkgs/samples/lib/google_ai.dart
pkgs/samples/lib/hello_world.dart
pkgs/samples/lib/main.dart
pkgs/samples/lib/sunflower.dart

@johnpryan
Copy link
Contributor Author

johnpryan commented Jan 15, 2025

Some of our GitHub Actions are using the Dart SDK (not the Flutter SDK), so when, for example, we dart pub get in dart_services, we get this warning:

Flutter users should use `flutter pub` instead of `dart pub`.

This seems like it should be a warning, since this is running in a Dart package, not a Flutter package. But since the workspace contains Flutter and Dart packages, our CI tools need to run flutter pub get on every individual package.

We could try to work around this by using the Flutter SDK everywhere, but that seems unnecessary. @devoncarew WDYT?

@devoncarew
Copy link
Member

We could try to work around this by using the Flutter SDK everywhere, but that seems unnecessary. @devoncarew WDYT?

I haven't parsed everything that's going on here, but dart pub get should work everywhere? It'll work with dart packages, and if the dart cli is from a Dart sdk hosted in a flutter sdk, then that dart command will be able to resolve the flutter sdk packages, so dart pub get should work there as well.

@johnpryan
Copy link
Contributor Author

if the dart cli is from a Dart sdk hosted in a flutter sdk, then that dart command will be able to resolve the flutter sdk packages

Is this true for workspaces too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants