diff --git a/.github/ISSUE_TEMPLATE/c_compiler.md b/.github/ISSUE_TEMPLATE/c_compiler.md new file mode 100644 index 0000000000..2b952a03b3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/c_compiler.md @@ -0,0 +1,5 @@ +--- +name: "package:c_compiler" +about: "Create a bug or file a feature request against package:c_compiler." +labels: "package:c_compiler" +--- \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/native_assets_cli.md b/.github/ISSUE_TEMPLATE/native_assets_cli.md new file mode 100644 index 0000000000..d6a22a8a03 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/native_assets_cli.md @@ -0,0 +1,5 @@ +--- +name: "package:native_assets_cli" +about: "Create a bug or file a feature request against package:native_assets_cli." +labels: "package:native_assets_cli" +--- \ No newline at end of file diff --git a/.github/workflows/c_compiler.yaml b/.github/workflows/c_compiler.yaml new file mode 100644 index 0000000000..79f15624f2 --- /dev/null +++ b/.github/workflows/c_compiler.yaml @@ -0,0 +1,58 @@ +name: package:c_compiler +permissions: read-all + +on: + pull_request: + branches: [main] + paths: + - ".github/workflows/c_compiler.yml" + - "pkgs/c_compiler/**" + push: + branches: [main] + paths: + - ".github/workflows/c_compiler.yml" + - "pkgs/c_compiler/**" + schedule: + - cron: "0 0 * * 0" # weekly + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: pkgs/c_compiler + strategy: + matrix: + sdk: [stable, dev] # {pkgs.versions} + include: + - sdk: stable + run-tests: true + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + with: + sdk: ${{matrix.sdk}} + + - run: dart pub get + + - run: dart analyze --fatal-infos + + - run: dart format --output=none --set-exit-if-changed . + if: ${{matrix.run-tests}} + + - run: dart test + if: ${{matrix.run-tests}} + + - name: Install coverage + run: dart pub global activate coverage + if: ${{ matrix.sdk == 'stable' }} + - name: Collect coverage + run: dart pub global run coverage:test_with_coverage + if: ${{ matrix.sdk == 'stable' }} + - name: Upload coverage + uses: coverallsapp/github-action@50c33ad324a9902697adbf2f92c22cf5023eacf1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: c_compiler + path-to-lcov: ./pkgs/c_compiler/coverage/lcov.info + if: ${{ matrix.sdk == 'stable' }} diff --git a/.github/workflows/native_assets_cli.yaml b/.github/workflows/native_assets_cli.yaml new file mode 100644 index 0000000000..78614b1cd5 --- /dev/null +++ b/.github/workflows/native_assets_cli.yaml @@ -0,0 +1,58 @@ +name: package:native_assets_cli +permissions: read-all + +on: + pull_request: + branches: [main] + paths: + - ".github/workflows/native_assets_cli.yml" + - "pkgs/native_assets_cli/**" + push: + branches: [main] + paths: + - ".github/workflows/native_assets_cli.yml" + - "pkgs/native_assets_cli/**" + schedule: + - cron: "0 0 * * 0" # weekly + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: pkgs/native_assets_cli + strategy: + matrix: + sdk: [stable, dev] # {pkgs.versions} + include: + - sdk: stable + run-tests: true + steps: + - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c + - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f + with: + sdk: ${{matrix.sdk}} + + - run: dart pub get + + - run: dart analyze --fatal-infos + + - run: dart format --output=none --set-exit-if-changed . + if: ${{matrix.run-tests}} + + - run: dart test + if: ${{matrix.run-tests}} + + - name: Install coverage + run: dart pub global activate coverage + if: ${{ matrix.sdk == 'stable' }} + - name: Collect coverage + run: dart pub global run coverage:test_with_coverage + if: ${{ matrix.sdk == 'stable' }} + - name: Upload coverage + uses: coverallsapp/github-action@50c33ad324a9902697adbf2f92c22cf5023eacf1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: native_assets_cli + path-to-lcov: ./pkgs/native_assets_cli/coverage/lcov.info + if: ${{ matrix.sdk == 'stable' }} diff --git a/README.md b/README.md index b5242b785c..ca78ab426b 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,10 @@ bundling. ## Packages -| Package | Description | Version | -| --- | --- | --- | +| Package | Description | Version | +| -------------------------------------------- | ------------------------------------------------------------------------------------------- | ------- | +| [c_compiler](pkgs/c_compiler/) | A library to invoke the native C compiler installed on the host machine. | | +| [native_assets_cli](pkgs/native_assets_cli/) | A library that contains the argument and file formats for implementing a native assets CLI. | | + +A library to invoke the native C compiler installed on the host machine. diff --git a/pkgs/c_compiler/analysis_options.yaml b/pkgs/c_compiler/analysis_options.yaml new file mode 100644 index 0000000000..2d557097c7 --- /dev/null +++ b/pkgs/c_compiler/analysis_options.yaml @@ -0,0 +1,22 @@ +include: package:dart_flutter_team_lints/analysis_options.yaml + +analyzer: + language: + strict-raw-types: true + strict-inference: true + +linter: + rules: + - always_declare_return_types + - avoid_dynamic_calls + - camel_case_types + - depend_on_referenced_packages + - directives_ordering + - prefer_const_declarations + - prefer_expression_function_bodies + - prefer_final_in_for_each + - prefer_final_locals + - prefer_relative_imports + - prefer_single_quotes + - sort_pub_dependencies + - unawaited_futures diff --git a/pkgs/c_compiler/lib/c_compiler.dart b/pkgs/c_compiler/lib/c_compiler.dart new file mode 100644 index 0000000000..dcdff2381d --- /dev/null +++ b/pkgs/c_compiler/lib/c_compiler.dart @@ -0,0 +1,8 @@ +// Copyright (c) 2023, 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. + +/// A library to invoke the native C compiler installed on the host machine. +library; + +export 'src/c_compiler_base.dart'; diff --git a/pkgs/c_compiler/lib/src/c_compiler_base.dart b/pkgs/c_compiler/lib/src/c_compiler_base.dart new file mode 100644 index 0000000000..57ba552dc1 --- /dev/null +++ b/pkgs/c_compiler/lib/src/c_compiler_base.dart @@ -0,0 +1,8 @@ +// Copyright (c) 2023, 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. + +/// Checks if you are awesome. Spoiler: you are. +class Awesome { + bool get isAwesome => true; +} diff --git a/pkgs/c_compiler/pubspec.yaml b/pkgs/c_compiler/pubspec.yaml new file mode 100644 index 0000000000..b224592db8 --- /dev/null +++ b/pkgs/c_compiler/pubspec.yaml @@ -0,0 +1,11 @@ +name: c_compiler +description: A library to invoke the native C compiler installed on the host machine. +version: 0.1.0-dev +repository: https://github.com/dart-lang/native/c_compiler + +environment: + sdk: ">=2.19.3 <4.0.0" + +dev_dependencies: + dart_flutter_team_lints: ^1.0.0 + test: ^1.21.0 diff --git a/pkgs/c_compiler/test/c_compiler_test.dart b/pkgs/c_compiler/test/c_compiler_test.dart new file mode 100644 index 0000000000..65006b3499 --- /dev/null +++ b/pkgs/c_compiler/test/c_compiler_test.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2023, 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. + +import 'package:c_compiler/c_compiler.dart'; +import 'package:test/test.dart'; + +void main() { + group('A group of tests', () { + final awesome = Awesome(); + + setUp(() { + // Additional setup goes here. + }); + + test('First Test', () { + expect(awesome.isAwesome, isTrue); + }); + }); +} diff --git a/pkgs/native_assets_cli/.gitignore b/pkgs/native_assets_cli/.gitignore new file mode 100644 index 0000000000..58e48f35d3 --- /dev/null +++ b/pkgs/native_assets_cli/.gitignore @@ -0,0 +1,9 @@ +# https://dart.dev/guides/libraries/private-files +# Created by `dart pub` +.dart_tool/ + +# Avoid committing pubspec.lock for library packages; see +# https://dart.dev/guides/libraries/private-files#pubspeclock. +pubspec.lock + +coverage/ diff --git a/pkgs/native_assets_cli/CHANGELOG.md b/pkgs/native_assets_cli/CHANGELOG.md new file mode 100644 index 0000000000..3249beabd8 --- /dev/null +++ b/pkgs/native_assets_cli/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0-dev + +- Initial version. diff --git a/pkgs/native_assets_cli/README.md b/pkgs/native_assets_cli/README.md new file mode 100644 index 0000000000..7ca67f0876 --- /dev/null +++ b/pkgs/native_assets_cli/README.md @@ -0,0 +1,6 @@ +[![package:native_assets_cli](https://github.com/dart-lang/native/actions/workflows/native_assets_cli.yml/badge.svg)](https://github.com/dart-lang/native/actions/workflows/native_assets_cli.yml) +[![pub package](https://img.shields.io/pub/v/native_assets_cli.svg)](https://pub.dev/packages/native_assets_cli) +[![Coverage Status](https://coveralls.io/repos/github/dart-lang/native/badge.svg?branch=main)](https://coveralls.io/github/dart-lang/tools?branch=main) + + +A library that contains the argument and file formats for implementing a native assets CLI. diff --git a/pkgs/native_assets_cli/analysis_options.yaml b/pkgs/native_assets_cli/analysis_options.yaml new file mode 100644 index 0000000000..2d557097c7 --- /dev/null +++ b/pkgs/native_assets_cli/analysis_options.yaml @@ -0,0 +1,22 @@ +include: package:dart_flutter_team_lints/analysis_options.yaml + +analyzer: + language: + strict-raw-types: true + strict-inference: true + +linter: + rules: + - always_declare_return_types + - avoid_dynamic_calls + - camel_case_types + - depend_on_referenced_packages + - directives_ordering + - prefer_const_declarations + - prefer_expression_function_bodies + - prefer_final_in_for_each + - prefer_final_locals + - prefer_relative_imports + - prefer_single_quotes + - sort_pub_dependencies + - unawaited_futures diff --git a/pkgs/native_assets_cli/lib/native_assets_cli.dart b/pkgs/native_assets_cli/lib/native_assets_cli.dart new file mode 100644 index 0000000000..e440c38a74 --- /dev/null +++ b/pkgs/native_assets_cli/lib/native_assets_cli.dart @@ -0,0 +1,9 @@ +// Copyright (c) 2023, 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. + +/// A library that contains the argument and file formats for implementing a +/// native assets CLI. +library; + +export 'src/native_assets_cli_base.dart'; diff --git a/pkgs/native_assets_cli/lib/src/native_assets_cli_base.dart b/pkgs/native_assets_cli/lib/src/native_assets_cli_base.dart new file mode 100644 index 0000000000..57ba552dc1 --- /dev/null +++ b/pkgs/native_assets_cli/lib/src/native_assets_cli_base.dart @@ -0,0 +1,8 @@ +// Copyright (c) 2023, 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. + +/// Checks if you are awesome. Spoiler: you are. +class Awesome { + bool get isAwesome => true; +} diff --git a/pkgs/native_assets_cli/pubspec.yaml b/pkgs/native_assets_cli/pubspec.yaml new file mode 100644 index 0000000000..5039b5984f --- /dev/null +++ b/pkgs/native_assets_cli/pubspec.yaml @@ -0,0 +1,11 @@ +name: native_assets_cli +description: A library that contains the argument and file formats for implementing a native assets CLI. +version: 0.1.0-dev +repository: https://github.com/dart-lang/native/native_assets_cli + +environment: + sdk: ">=2.19.3 <4.0.0" + +dev_dependencies: + dart_flutter_team_lints: ^1.0.0 + test: ^1.21.0 diff --git a/pkgs/native_assets_cli/test/native_assets_cli_test.dart b/pkgs/native_assets_cli/test/native_assets_cli_test.dart new file mode 100644 index 0000000000..a0de8d3ea3 --- /dev/null +++ b/pkgs/native_assets_cli/test/native_assets_cli_test.dart @@ -0,0 +1,20 @@ +// Copyright (c) 2023, 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. + +import 'package:native_assets_cli/native_assets_cli.dart'; +import 'package:test/test.dart'; + +void main() { + group('A group of tests', () { + final awesome = Awesome(); + + setUp(() { + // Additional setup goes here. + }); + + test('First Test', () { + expect(awesome.isAwesome, isTrue); + }); + }); +} diff --git a/pkgs/placeholder.txt b/pkgs/placeholder.txt deleted file mode 100644 index e3f0cac93c..0000000000 --- a/pkgs/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -remove once we have one package here