Skip to content

Commit

Permalink
Split repository into a few workspaces (#6152)
Browse files Browse the repository at this point in the history
Split repository into three workspaces to simplify setup before editing
Dart files and reduce analysis time.

- The root pubspec and the tooling underlying `./dash_site` in
`/tool/dart_site`.
- The packages in `/tool/get-dart` as they are rarely edited.
- All of the examples in `/examples`, mostly used for code excerpts.
  • Loading branch information
parlough authored Oct 16, 2024
1 parent 50fa98f commit 0645a2c
Show file tree
Hide file tree
Showing 55 changed files with 89 additions and 76 deletions.
4 changes: 4 additions & 0 deletions dash_site
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ if command -v pnpm &> /dev/null; then
echo "pnpm version $pnpm_version is too low. Version $REQUIRED_PNPM_VERSION or later is required."
exit 1
fi

# If using pnpm, update the dependencies silently as it is quick.
echo "Verifying npm dependencies are up to date..."
pnpm install --silent
fi

# Verify that Node packages have been installed.
Expand Down
6 changes: 2 additions & 4 deletions examples/analysis/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: examples
name: analysis
description: dart.dev example code.

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
examples_util: {path: ../util}

dev_dependencies:
lints: ^4.0.0
6 changes: 2 additions & 4 deletions examples/analysis_alt/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: examples
name: analysis_alt
description: dart.dev example code.

resolution: workspace
environment:
sdk: ^3.5.3

dev_dependencies:
lints: ^4.0.0
2 changes: 0 additions & 2 deletions examples/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ linter:
- combinators_ordering
- comment_references
- invalid_case_patterns
- library_annotations
- one_member_abstracts
- only_throw_errors
- package_api_docs
- prefer_single_quotes
- sort_child_properties_last
- sort_unnamed_constructors_first
Expand Down
1 change: 0 additions & 1 deletion examples/async_await/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/async_await/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: async_await
description: dart.dev example code.

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
examples_util: {path: ../util}

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
2 changes: 1 addition & 1 deletion examples/build_runner_usage/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: build_runner_usage
description: dart.dev build_runner example code.

resolution: workspace
environment:
sdk: ^3.5.3

dev_dependencies:
args: ^2.5.0
build_runner: ^2.4.12
build_test: ^2.2.2
lints: ^4.0.0
1 change: 0 additions & 1 deletion examples/cli/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/cli/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: cli_examples
description: Examples for CLI tutorials on dart.dev

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
args: ^2.5.0

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
1 change: 0 additions & 1 deletion examples/concurrency/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/concurrency/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ description: dart.dev concurrency examples.
version: 0.0.1
publish_to: none

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
http: any

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
1 change: 0 additions & 1 deletion examples/create_libraries/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/create_libraries/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: create_libraries
description: dart.dev example code.
version: 1.0.0

resolution: workspace
environment:
sdk: ^3.5.3

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
1 change: 0 additions & 1 deletion examples/extension_methods/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/extension_methods/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: extension_methods_examples
description: dart.dev example code.
version: 1.0.0

resolution: workspace
environment:
sdk: ^3.5.3

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
1 change: 0 additions & 1 deletion examples/fetch_data/analysis_options.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions examples/fetch_data/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: fetch_data_examples
description: Fetch data example
version: 0.0.1

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
http: ^1.2.2

dev_dependencies:
lints: ^4.0.0
1 change: 0 additions & 1 deletion examples/futures/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/futures/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ description: dart.dev futures and error handling examples.
version: 0.0.1
publish_to: none

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
examples_util: {path: ../util}

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
1 change: 0 additions & 1 deletion examples/html/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/html/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: html_library_examples
description: dart.dev example code.
version: 0.0.1

resolution: workspace
environment:
sdk: ^3.5.3

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
examples_util: {path: ../util}
1 change: 0 additions & 1 deletion examples/iterables/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/iterables/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: iterables_examples
description: dart.dev example code.

resolution: workspace
environment:
sdk: ^3.5.3

dev_dependencies:
examples_util: {path: ../util}
lints: ^4.0.0
test: ^1.25.8
1 change: 0 additions & 1 deletion examples/language/analysis_options.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions examples/language/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: examples
name: language_examples
description: dart.dev example code.

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
examples_util: { path: ../util }

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
1 change: 0 additions & 1 deletion examples/misc/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/misc/lib/language_tour/classes/employee.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: unnecessary_cast, strict_raw_type
// ignore_for_file: unnecessary_cast, strict_raw_type, use_super_parameters

Map fetchDefaultData() => {}; // stub

Expand Down
2 changes: 2 additions & 0 deletions examples/misc/lib/language_tour/tear_offs.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: avoid_function_literals_in_foreach_calls

void main() {
// #docregion full-example
// #docregion variables
Expand Down
2 changes: 1 addition & 1 deletion examples/misc/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: examples
description: dart.dev example code.

resolution: workspace
environment:
sdk: ^3.5.3

Expand All @@ -11,5 +12,4 @@ dependencies:
http: ^1.2.2

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
3 changes: 2 additions & 1 deletion examples/misc/test/language_tour/functions_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// ignore_for_file: unused_element, type_annotate_public_apis, prefer_function_declarations_over_variables
// ignore_for_file: unused_element, type_annotate_public_apis, prefer_function_declarations_over_variables, avoid_function_literals_in_foreach_calls
// ignore_for_file: always_declare_return_types

import 'package:examples/language_tour/function_equality.dart'
as function_equality;
import 'package:test/test.dart';
Expand Down
1 change: 0 additions & 1 deletion examples/non_promotion/analysis_options.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions examples/non_promotion/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: non_promotion_examples
description: dart.dev non-promotion examples.
version: 0.0.1

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
mockito: ^5.4.4

dev_dependencies:
lints: ^4.0.0
28 changes: 28 additions & 0 deletions examples/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: examples_workspace
publish_to: none

environment:
sdk: ^3.5.3

workspace:
- analysis
- analysis_alt
- async_await
- build_runner_usage
- cli
- concurrency
- create_libraries
- extension_methods
- fetch_data
- futures
- html
- iterables
- language
- misc
- non_promotion
- type_system
- util
- vector_victor

dev_dependencies:
lints: ^5.0.0
2 changes: 1 addition & 1 deletion examples/type_system/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: type_system_examples
description: dart.dev type system examples.

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
examples_util: {path: ../util}

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8
1 change: 0 additions & 1 deletion examples/util/analysis_options.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions examples/util/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ name: examples_util
description: dart.dev example utilities.
version: 0.0.2

resolution: workspace
environment:
sdk: ^3.5.3

dependencies:
test: ^1.25.8

dev_dependencies:
lints: ^4.0.0
1 change: 0 additions & 1 deletion examples/vector_victor/analysis_options.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion examples/vector_victor/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ description: A sample command-line application.
version: 1.0.0
# homepage: https://www.example.com

resolution: workspace
environment:
sdk: ^3.5.3

# dependencies:
# path: ^1.8.0

dev_dependencies:
lints: ^4.0.0
test: ^1.25.8

dependencies:
Expand Down
4 changes: 3 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ homepage: https://dart.dev
environment:
sdk: ^3.5.3

workspace:
- tool/dart_site

dev_dependencies:
dart_site:
path: tool/dart_site
lints: ^4.0.0
2 changes: 1 addition & 1 deletion src/content/tools/analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ linter:
- combinators_ordering
- comment_references
- invalid_case_patterns
- library_annotations
- one_member_abstracts
- only_throw_errors
- prefer_single_quotes
```


Expand Down
13 changes: 8 additions & 5 deletions tool/dart_site/lib/src/commands/analyze_dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ int analyzeDart({
}) {
final directoriesToAnalyze = [
path.join('tool', 'dart_site'),
...dartProjectExampleDirectories,
path.join('examples'),
path.join('tool', 'get-dart'),
];

print('Analyzing code...');
if (!verboseLogging) {
print('Analyzing code...');
}

for (final directory in directoriesToAnalyze) {
if (verboseLogging) {
print('Analyzing code in $directory...');
print("Analyzing code in '$directory' directory...");
}

if (runPubGetIfNecessary(directory) case final pubGetResult
Expand All @@ -64,11 +67,11 @@ int analyzeDart({

stderr.write(normalOutput);
stderr.write(errorOutput);
stderr.writeln('Error: Analysis on $directory failed.');
stderr.writeln("Error: Analysis on '$directory' directory failed.");
return 1;
} else {
if (verboseLogging) {
print('Successfully analyzed code in $directory!');
print("Successfully analyzed code in '$directory' directory!");
}
}
}
Expand Down
Loading

0 comments on commit 0645a2c

Please sign in to comment.