Skip to content
Draft

wip #497

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
22 changes: 11 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created with package:mono_repo v6.6.2
# Created with package:mono_repo v6.6.3
name: Dart Lint CI
on:
push:
Expand All @@ -16,23 +16,23 @@ permissions: read-all

jobs:
job_001:
name: "analyze_format; Dart 3.6.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.8.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@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.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.8.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.6.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.6.0
os:ubuntu-latest;pub-cache-hosted;sdk:3.8.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.8.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: "3.6.0"
sdk: "3.8.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;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-integration_test;commands:format-analyze_0"
Expand Down Expand Up @@ -361,7 +361,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:integration_test;commands:analyze_1"
Expand Down Expand Up @@ -391,7 +391,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:examples/fullstack/frontend;commands:format-analyze_2"
Expand All @@ -401,7 +401,7 @@ jobs:
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Flutter SDK
uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e
uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
with:
channel: stable
- id: checkout
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created with package:mono_repo v6.6.2
# Created with package:mono_repo v6.6.3
name: Dart Unit CI
on:
push:
Expand All @@ -16,23 +16,23 @@ permissions: read-all

jobs:
job_001:
name: "unit_test; linux; Dart 3.6.0; PKGS: dartfn, functions_framework_builder, google_cloud, integration_test; `dart test`"
name: "unit_test; linux; Dart 3.8.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@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:dartfn-functions_framework_builder-google_cloud-integration_test;commands:test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.8.0;packages:dartfn-functions_framework_builder-google_cloud-integration_test;commands:test_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:dartfn-functions_framework_builder-google_cloud-integration_test
os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0
os:ubuntu-latest;pub-cache-hosted;sdk:3.8.0;packages:dartfn-functions_framework_builder-google_cloud-integration_test
os:ubuntu-latest;pub-cache-hosted;sdk:3.8.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: "3.6.0"
sdk: "3.8.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
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.6.0; PKG: google_cloud; `./tool/docker_test_script.sh`"
name: "unit_test; linux; Dart 3.8.0; PKG: google_cloud; `./tool/docker_test_script.sh`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:google_cloud;commands:command"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.8.0;packages:google_cloud;commands:command"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:google_cloud
os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0
os:ubuntu-latest;pub-cache-hosted;sdk:3.8.0;packages:google_cloud
os:ubuntu-latest;pub-cache-hosted;sdk:3.8.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: "3.6.0"
sdk: "3.8.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
Expand All @@ -107,7 +107,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dartfn-dartfn/templates/cloudevent-dartfn/templates/helloworld-dartfn/templates/json-examples/fullstack/backend-examples/hello-examples/json-examples/protobuf_firestore-examples/raw_cloudevent-functions_framework_builder-google_cloud-integration_test;commands:test_0"
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dartfn-functions_framework-integration_test;commands:test_1"
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.6.0; PKG: google_cloud; `dart test`"
name: "unit_test; macos; Dart 3.8.0; PKG: google_cloud; `dart test`"
runs-on: macos-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:macos-latest;pub-cache-hosted;sdk:3.6.0;packages:google_cloud;commands:test_0"
key: "os:macos-latest;pub-cache-hosted;sdk:3.8.0;packages:google_cloud;commands:test_0"
restore-keys: |
os:macos-latest;pub-cache-hosted;sdk:3.6.0;packages:google_cloud
os:macos-latest;pub-cache-hosted;sdk:3.6.0
os:macos-latest;pub-cache-hosted;sdk:3.8.0;packages:google_cloud
os:macos-latest;pub-cache-hosted;sdk:3.8.0
os:macos-latest;pub-cache-hosted
os:macos-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: "3.6.0"
sdk: "3.8.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
Expand All @@ -314,7 +314,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf
with:
path: "~/.pub-cache/hosted"
key: "os:macos-latest;pub-cache-hosted;sdk:dev;packages:google_cloud;commands:test_0"
Expand Down
2 changes: 1 addition & 1 deletion dartfn/lib/src/cli/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class App extends Console {
late final CommandRunner<void> _runner;

App(List<Generator> generators, [Printer? out, GeneratorTarget? target])
: super(out) {
: super(out) {
generators.sort();

_context = CommandContext(
Expand Down
14 changes: 7 additions & 7 deletions dartfn/lib/src/cli/command/generate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ class GenerateCommand extends Command {
GenerateCommand(super.context) {
argParser
..addFlag('list', negatable: false, help: 'List available generators.')

// Hidden option to list available projects as JSON to stdout.
// This is useful for tools that don't want to have to parse the output of
// `--help`.
..addFlag('machine', negatable: false, hide: true)

// Hidden option to generate into the current directory.
..addFlag('force', abbr: 'f', negatable: false, hide: true);
}
Expand Down Expand Up @@ -72,10 +70,11 @@ class GenerateCommand extends Command {
final generatorName = options.rest.first;
if (!(options['force'] as bool) && !await context.generator.cwd.isEmpty()) {
return error(
'The current directory is not empty. Overwritting an exising project '
'is NOT recommended.\n'
'Create a new (empty) project directory, or use --force to override '
"this safeguard if you know what you're doing.");
'The current directory is not empty. Overwritting an exising project '
'is NOT recommended.\n'
'Create a new (empty) project directory, or use --force to override '
"this safeguard if you know what you're doing.",
);
}

return await _generate(generatorName);
Expand All @@ -92,7 +91,8 @@ class GenerateCommand extends Command {

write('project: $projectName');

final target = context.generator.target ??
final target =
context.generator.target ??
DirectoryGeneratorTarget(context.console.out, context.generator.cwd);

write('Creating $generatorName application `$projectName`:');
Expand Down
10 changes: 6 additions & 4 deletions dartfn/lib/src/cli/command/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ Future<void> printVersion(
return context.console.write(version);
}

context.console
.write('Functions Framework for Dart CLI ($name) version: $version');
context.console.write(
'Functions Framework for Dart CLI ($name) version: $version',
);

if (!checkUpdates) return;

Expand All @@ -71,8 +72,9 @@ Future<void> printVersion(
final latest = await checkPubForLaterVersion(name, version);
if (latest != null) {
context.console.write(
'Version $latest is available! To update to this version, run: '
'`pub global activate $name`.');
'Version $latest is available! To update to this version, run: '
'`pub global activate $name`.',
);
}
});
}
10 changes: 5 additions & 5 deletions dartfn/lib/src/generators/cloudevent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ part 'cloudevent.g.dart';
/// A generator for a pub library.
class CloudEventFunctionGenerator extends common.DefaultGenerator {
CloudEventFunctionGenerator()
: super(
'cloudevent',
'A sample Functions Framework project for handling a cloudevent.',
_data,
);
: super(
'cloudevent',
'A sample Functions Framework project for handling a cloudevent.',
_data,
);
}
4 changes: 2 additions & 2 deletions dartfn/lib/src/generators/cloudevent.g.dart

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

10 changes: 5 additions & 5 deletions dartfn/lib/src/generators/helloworld.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ part 'helloworld.g.dart';
/// A generator for a pub library.
class HelloWorldGenerator extends common.DefaultGenerator {
HelloWorldGenerator()
: super(
'helloworld',
'A sample "Hello, World!" Functions Framework project.',
_data,
);
: super(
'helloworld',
'A sample "Hello, World!" Functions Framework project.',
_data,
);
}
4 changes: 2 additions & 2 deletions dartfn/lib/src/generators/helloworld.g.dart

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

10 changes: 5 additions & 5 deletions dartfn/lib/src/generators/json.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ part 'json.g.dart';
/// A generator for a pub library.
class JsonFunctionGenerator extends common.DefaultGenerator {
JsonFunctionGenerator()
: super(
'json',
'A sample Functions Framework project for handling JSON.',
_data,
);
: super(
'json',
'A sample Functions Framework project for handling JSON.',
_data,
);
}
4 changes: 2 additions & 2 deletions dartfn/lib/src/generators/json.g.dart

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

8 changes: 4 additions & 4 deletions dartfn/lib/src/printer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class Printer {
final PrintFunc stderr;

Printer([PrintFunc? stdout, PrintFunc? stderr])
: stdout = stdout ?? print,
stderr = stderr ?? stdout ?? print;
: stdout = stdout ?? print,
stderr = stderr ?? stdout ?? print;

Printer.fromPrinter(Printer printer)
: stdout = printer.stdout,
stderr = printer.stderr;
: stdout = printer.stdout,
stderr = printer.stderr;

void write([Object? obj]) {
stdout(obj ?? '');
Expand Down
Loading
Loading