From 8b8acf02324d499e6b190d28835932edc7633c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=81=A5=E8=8E=B9?= Date: Wed, 31 May 2023 23:41:02 +0800 Subject: [PATCH] Supports custom `FLUTTER_ROOT` environment variable. --- README-ZH.md | 2 +- README.md | 2 +- docs/en/distribute-options.md | 2 +- docs/en/getting-started.md | 4 +- docs/en/publishers/appcenter.md | 2 +- docs/en/publishers/appstore.md | 2 +- docs/en/publishers/firebase.md | 2 +- docs/en/publishers/github.md | 2 +- docs/en/publishers/qiniu.md | 2 +- docs/zh/distribute-options.md | 2 +- docs/zh/getting-started.md | 4 +- docs/zh/publishers/appcenter.md | 2 +- docs/zh/publishers/appstore.md | 2 +- docs/zh/publishers/firebase.md | 2 +- docs/zh/publishers/github.md | 2 +- docs/zh/publishers/qiniu.md | 2 +- examples/hello_world/distribute_options.yaml | 7 ++- .../ios/Runner.xcodeproj/project.pbxproj | 7 ++- examples/hello_world/release.sh | 2 +- examples/multiple_flavors/pubspec.lock | 12 ++--- packages/app_package_maker/CHANGELOG.md | 4 ++ packages/app_package_maker/pubspec.lock | 2 +- packages/app_package_maker/pubspec.yaml | 4 +- packages/app_package_publisher/CHANGELOG.md | 4 ++ packages/app_package_publisher/pubspec.lock | 2 +- packages/app_package_publisher/pubspec.yaml | 5 ++- packages/flutter_app_builder/CHANGELOG.md | 4 ++ .../lib/src/builders/app_builder.dart | 8 ++-- .../lib/src/builders/ios/app_builder_ios.dart | 6 ++- .../lib/src/commands/flutter.dart | 44 +++++++++++++++++++ .../lib/src/flutter_app_builder.dart | 14 ++++-- packages/flutter_app_builder/pubspec.lock | 4 +- packages/flutter_app_builder/pubspec.yaml | 6 ++- packages/flutter_app_packager/CHANGELOG.md | 4 ++ packages/flutter_app_packager/pubspec.lock | 12 ++--- packages/flutter_app_packager/pubspec.yaml | 6 +-- packages/flutter_app_publisher/CHANGELOG.md | 4 ++ packages/flutter_app_publisher/pubspec.lock | 6 +-- packages/flutter_app_publisher/pubspec.yaml | 8 ++-- packages/flutter_distributor/CHANGELOG.md | 6 +++ .../lib/src/distribute_options.dart | 17 ++++--- .../lib/src/flutter_distributor.dart | 29 +++++++----- .../flutter_distributor/lib/src/release.dart | 8 ++++ .../lib/src/release_job.dart | 9 ++++ packages/flutter_distributor/pubspec.lock | 18 ++++---- packages/flutter_distributor/pubspec.yaml | 14 +++--- packages/parse_app_package/CHANGELOG.md | 4 ++ packages/parse_app_package/README.md | 2 +- packages/parse_app_package/pubspec.lock | 2 +- packages/parse_app_package/pubspec.yaml | 2 +- 50 files changed, 220 insertions(+), 102 deletions(-) create mode 100644 packages/flutter_app_builder/lib/src/commands/flutter.dart diff --git a/README-ZH.md b/README-ZH.md index 5e652c32..1e664e0e 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -62,7 +62,7 @@ dart pub global activate flutter_distributor 将 `distribute_options.yaml` 添加到你的项目根目录。 ```yaml -env: +variables: PGYER_API_KEY: "your api key" output: dist/ releases: diff --git a/README.md b/README.md index ebe79b84..e4dded0d 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ dart pub global activate flutter_distributor Add `distribute_options.yaml` to your project root directory. ```yaml -env: +variables: PGYER_API_KEY: "your api key" output: dist/ releases: diff --git a/docs/en/distribute-options.md b/docs/en/distribute-options.md index 0e3e69ae..8c9ce746 100644 --- a/docs/en/distribute-options.md +++ b/docs/en/distribute-options.md @@ -5,7 +5,7 @@ title: Distribute Options ## Example ```yaml -env: +variables: PGYER_API_KEY: "your api key" output: dist/ releases: diff --git a/docs/en/getting-started.md b/docs/en/getting-started.md index a30a0bad..6a9cd0c3 100644 --- a/docs/en/getting-started.md +++ b/docs/en/getting-started.md @@ -24,7 +24,7 @@ output: dist/ Let's take `pgyer` as an example, after logging in, click the user avatar on the right side to go to the [API information](https://www.pgyer.com/account/api) page from the menu, copy the `API Key` and add it to the env node. ```yaml -env: +variables: PGYER_API_KEY: "your api key" ``` @@ -67,7 +67,7 @@ releases: ### Full Example Configuration ```yaml -env: +variables: PGYER_API_KEY: "your api key" output: dist/ releases: diff --git a/docs/en/publishers/appcenter.md b/docs/en/publishers/appcenter.md index f9692fc3..3c1bef75 100644 --- a/docs/en/publishers/appcenter.md +++ b/docs/en/publishers/appcenter.md @@ -30,7 +30,7 @@ flutter_distributor publish \ ### Configure `distribute_options.yaml` ```yaml -env: +variables: # See: https://appcenter.ms/settings/apitokens APPCENTER_API_TOKEN: output: dist/ diff --git a/docs/en/publishers/appstore.md b/docs/en/publishers/appstore.md index 1e0fc02e..14d1ece7 100644 --- a/docs/en/publishers/appstore.md +++ b/docs/en/publishers/appstore.md @@ -39,7 +39,7 @@ flutter_distributor publish \ ### Configure `distribute_options.yaml` ```yaml -env: +variables: APPSTORE_USERNAME: "xxx" APPSTORE_PASSWORD: "xxx" # or diff --git a/docs/en/publishers/firebase.md b/docs/en/publishers/firebase.md index 751f355f..eca09614 100644 --- a/docs/en/publishers/firebase.md +++ b/docs/en/publishers/firebase.md @@ -42,7 +42,7 @@ flutter_distributor publish \ ### Configure `distribute_options.yaml` ```yaml -env: +variables: FIREBASE_TOKEN: your token, See[https://firebase.google.com/docs/cli?authuser=0#cli-ci-systems] output: dist/ releases: diff --git a/docs/en/publishers/github.md b/docs/en/publishers/github.md index fed00252..dcaaea99 100644 --- a/docs/en/publishers/github.md +++ b/docs/en/publishers/github.md @@ -29,7 +29,7 @@ flutter_distributor publish \ ### Configure `distribute_options.yaml` ```yaml -env: +variables: GITHUB_TOKEN: your personal access token, See[https://docs.github.com/cn/enterprise-server@3.2/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token] output: dist/ releases: diff --git a/docs/en/publishers/qiniu.md b/docs/en/publishers/qiniu.md index d3a9d888..f7724011 100644 --- a/docs/en/publishers/qiniu.md +++ b/docs/en/publishers/qiniu.md @@ -29,7 +29,7 @@ flutter_distributor publish \ ### Configure `distribute_options.yaml` ```yaml -env: +variables: QINIU_ACCESS_KEY: your access key QINIU_SECRET_KEY: your secret key output: dist/ diff --git a/docs/zh/distribute-options.md b/docs/zh/distribute-options.md index ca13c95d..f7c5d7a9 100644 --- a/docs/zh/distribute-options.md +++ b/docs/zh/distribute-options.md @@ -5,7 +5,7 @@ title: 分发选项 ## 示例 ```yaml -env: +variables: PGYER_API_KEY: "your api key" output: dist/ releases: diff --git a/docs/zh/getting-started.md b/docs/zh/getting-started.md index 41a8a300..382a5fc5 100644 --- a/docs/zh/getting-started.md +++ b/docs/zh/getting-started.md @@ -22,7 +22,7 @@ output: dist/ 以 `pgyer` 为例,登录后,点击右侧的用户头像,从菜单中进入[API 信息](https://www.pgyer.com/account/api)页面,复制 `API Key` 并将其添加到 `env` 节点。 ```yaml -env: +variables: PGYER_API_KEY: "your api key" ``` @@ -65,7 +65,7 @@ releases: ### 完整的示例配置 ```yaml -env: +variables: PGYER_API_KEY: "your api key" output: dist/ releases: diff --git a/docs/zh/publishers/appcenter.md b/docs/zh/publishers/appcenter.md index 111a908e..49d9f605 100644 --- a/docs/zh/publishers/appcenter.md +++ b/docs/zh/publishers/appcenter.md @@ -30,7 +30,7 @@ flutter_distributor publish \ ### 配置 `distribute_options.yaml` ```yaml -env: +variables: # See: https://appcenter.ms/settings/apitokens APPCENTER_API_TOKEN: output: dist/ diff --git a/docs/zh/publishers/appstore.md b/docs/zh/publishers/appstore.md index f3b6aba1..b5e21211 100644 --- a/docs/zh/publishers/appstore.md +++ b/docs/zh/publishers/appstore.md @@ -39,7 +39,7 @@ flutter_distributor publish \ ### 配置 `distribute_options.yaml` ```yaml -env: +variables: APPSTORE_USERNAME: "xxx" APPSTORE_PASSWORD: "xxx" # or diff --git a/docs/zh/publishers/firebase.md b/docs/zh/publishers/firebase.md index ff90868c..be5ec587 100644 --- a/docs/zh/publishers/firebase.md +++ b/docs/zh/publishers/firebase.md @@ -42,7 +42,7 @@ flutter_distributor publish \ ### 配置 `distribute_options.yaml` ```yaml -env: +variables: FIREBASE_TOKEN: your token, See[https://firebase.google.com/docs/cli?authuser=0#cli-ci-systems] output: dist/ releases: diff --git a/docs/zh/publishers/github.md b/docs/zh/publishers/github.md index f615170d..c75168cb 100644 --- a/docs/zh/publishers/github.md +++ b/docs/zh/publishers/github.md @@ -29,7 +29,7 @@ flutter_distributor publish \ ### 配置 `distribute_options.yaml` ```yaml -env: +variables: GITHUB_TOKEN: your personal access token, See[https://docs.github.com/cn/enterprise-server@3.2/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token] output: dist/ releases: diff --git a/docs/zh/publishers/qiniu.md b/docs/zh/publishers/qiniu.md index f5f3db92..22ca5c11 100644 --- a/docs/zh/publishers/qiniu.md +++ b/docs/zh/publishers/qiniu.md @@ -29,7 +29,7 @@ flutter_distributor publish \ ### 配置 `distribute_options.yaml` ```yaml -env: +variables: QINIU_ACCESS_KEY: your access key QINIU_SECRET_KEY: your secret key output: dist/ diff --git a/examples/hello_world/distribute_options.yaml b/examples/hello_world/distribute_options.yaml index 49c29325..86a7f30d 100644 --- a/examples/hello_world/distribute_options.yaml +++ b/examples/hello_world/distribute_options.yaml @@ -1,6 +1,7 @@ -env: -# PGYER_API_KEY: your api key output: dist/ +variables: + FLUTTER_ROOT: ~/fvm/versions/3.10.0 + # PGYER_API_KEY: your api key releases: - name: dev-profile jobs: @@ -77,6 +78,8 @@ releases: - name: dev-release jobs: - name: android-aab + variables: + FLUTTER_ROOT: ~/fvm/versions/3.10.2 package: platform: android target: aab diff --git a/examples/hello_world/ios/Runner.xcodeproj/project.pbxproj b/examples/hello_world/ios/Runner.xcodeproj/project.pbxproj index 6b6ba417..fd237cb5 100644 --- a/examples/hello_world/ios/Runner.xcodeproj/project.pbxproj +++ b/examples/hello_world/ios/Runner.xcodeproj/project.pbxproj @@ -68,7 +68,6 @@ 0722C86F52094B5AFA9D74C3 /* Pods-Runner.release.xcconfig */, F420089D2E1AFAF26E3F1A48 /* Pods-Runner.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -341,7 +340,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = G83H824X6L; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -470,7 +469,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = G83H824X6L; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -493,7 +492,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = G83H824X6L; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/examples/hello_world/release.sh b/examples/hello_world/release.sh index 0a027f55..68496619 100755 --- a/examples/hello_world/release.sh +++ b/examples/hello_world/release.sh @@ -1,3 +1,3 @@ #!/bin/bash -dart ../../packages/flutter_distributor/bin/main.dart release --name $1 --skip-clean \ No newline at end of file +dart ../../packages/flutter_distributor/bin/main.dart release --name $1 --skip-clean --no-version-check \ No newline at end of file diff --git a/examples/multiple_flavors/pubspec.lock b/examples/multiple_flavors/pubspec.lock index b10fec6b..a1e966ad 100644 --- a/examples/multiple_flavors/pubspec.lock +++ b/examples/multiple_flavors/pubspec.lock @@ -140,10 +140,10 @@ packages: dependency: transitive description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: "4c3f04bfb64d3efd508d06b41b825542f08122d30bda4933fb95c069d22a4fa3" url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.0.0" http_parser: dependency: transitive description: @@ -220,10 +220,10 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: "28386bbe89ab5a7919a47cea99cdd1128e5a6e0bbd7eaafe20440ead84a15de3" + sha256: ceb027f6bc6a60674a233b4a90a7658af1aebdea833da0b5b53c1e9821a78c7b url: "https://pub.dev" source: hosted - version: "4.0.1" + version: "4.0.2" package_info_plus_platform_interface: dependency: transitive description: @@ -345,10 +345,10 @@ packages: dependency: transitive description: name: win32 - sha256: "6ca3aaab1790eeb1f5cad232e33d9c53ba66e884dd3e7686c4e730bffc45f1a3" + sha256: "7dacfda1edcca378031db9905ad7d7bd56b29fd1a90b0908b71a52a12c41e36b" url: "https://pub.dev" source: hosted - version: "5.0.2" + version: "5.0.3" xml: dependency: transitive description: diff --git a/packages/app_package_maker/CHANGELOG.md b/packages/app_package_maker/CHANGELOG.md index c206a367..67197512 100644 --- a/packages/app_package_maker/CHANGELOG.md +++ b/packages/app_package_maker/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.4 + +* bump `shell_executor` to 0.1.4 + ## 0.3.2 * Update dart sdk version to ">=2.16.0 <4.0.0" diff --git a/packages/app_package_maker/pubspec.lock b/packages/app_package_maker/pubspec.lock index 9fcb3c2b..fa11a3e0 100644 --- a/packages/app_package_maker/pubspec.lock +++ b/packages/app_package_maker/pubspec.lock @@ -143,7 +143,7 @@ packages: path: "../shell_executor" relative: true source: path - version: "0.1.3" + version: "0.1.4" source_span: dependency: transitive description: diff --git a/packages/app_package_maker/pubspec.yaml b/packages/app_package_maker/pubspec.yaml index e21a9dd3..bad37477 100644 --- a/packages/app_package_maker/pubspec.yaml +++ b/packages/app_package_maker/pubspec.yaml @@ -1,6 +1,6 @@ name: app_package_maker description: App package maker -version: 0.3.2 +version: 0.3.4 homepage: https://distributor.leanflutter.org repository: https://github.com/leanflutter/flutter_distributor/tree/main/packages/app_package_maker @@ -11,7 +11,7 @@ dependencies: mustache_template: ^2.0.0 pub_semver: ^2.1.0 pubspec_parse: ^1.1.0 - shell_executor: ^0.1.3 + shell_executor: ^0.1.4 yaml: ^3.1.0 dev_dependencies: diff --git a/packages/app_package_publisher/CHANGELOG.md b/packages/app_package_publisher/CHANGELOG.md index 29ff1f66..f43a0661 100644 --- a/packages/app_package_publisher/CHANGELOG.md +++ b/packages/app_package_publisher/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.4 + +* bump `shell_executor` to 0.1.4 + ## 0.3.2 * Update dart sdk version to ">=2.16.0 <4.0.0" diff --git a/packages/app_package_publisher/pubspec.lock b/packages/app_package_publisher/pubspec.lock index b2940bc6..18533188 100644 --- a/packages/app_package_publisher/pubspec.lock +++ b/packages/app_package_publisher/pubspec.lock @@ -135,7 +135,7 @@ packages: path: "../shell_executor" relative: true source: path - version: "0.1.3" + version: "0.1.4" source_span: dependency: transitive description: diff --git a/packages/app_package_publisher/pubspec.yaml b/packages/app_package_publisher/pubspec.yaml index c5af7f49..f66d9b86 100644 --- a/packages/app_package_publisher/pubspec.yaml +++ b/packages/app_package_publisher/pubspec.yaml @@ -1,6 +1,6 @@ name: app_package_publisher description: App package publisher -version: 0.3.2 +version: 0.3.4 homepage: https://distributor.leanflutter.org repository: https://github.com/leanflutter/flutter_distributor/tree/main/packages/app_package_publisher @@ -9,6 +9,7 @@ environment: dependencies: pubspec_parse: ^1.1.0 - shell_executor: ^0.1.3 + shell_executor: ^0.1.4 + dev_dependencies: dependency_validator: ^3.0.0 diff --git a/packages/flutter_app_builder/CHANGELOG.md b/packages/flutter_app_builder/CHANGELOG.md index 7797a456..84126414 100644 --- a/packages/flutter_app_builder/CHANGELOG.md +++ b/packages/flutter_app_builder/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.4 + +* bump `shell_executor` to 0.1.4 + ## 0.3.3 * [apk-builer] fix apk not found diff --git a/packages/flutter_app_builder/lib/src/builders/app_builder.dart b/packages/flutter_app_builder/lib/src/builders/app_builder.dart index 7a2b216e..f1555513 100644 --- a/packages/flutter_app_builder/lib/src/builders/app_builder.dart +++ b/packages/flutter_app_builder/lib/src/builders/app_builder.dart @@ -3,9 +3,9 @@ import 'dart:io'; import 'package:flutter_app_builder/src/build_config.dart'; import 'package:flutter_app_builder/src/build_error.dart'; import 'package:flutter_app_builder/src/build_result.dart'; +import 'package:flutter_app_builder/src/commands/flutter.dart'; import 'package:pub_semver/pub_semver.dart'; import 'package:pubspec_parse/pubspec_parse.dart'; -import 'package:shell_executor/shell_executor.dart'; abstract class AppBuilder { String get platform => throw UnimplementedError(); @@ -34,6 +34,7 @@ abstract class AppBuilder { Future build({ required Map arguments, + Map? environment, }) async { final time = Stopwatch()..start(); @@ -59,9 +60,8 @@ abstract class AppBuilder { 'FLUTTER_BUILD_NUMBER=$appBuildNumber', ]); - ProcessResult processResult = await $( - 'flutter', - ['build', buildSubcommand, ...buildArguments], + ProcessResult processResult = await flutter.withEnv(environment).build( + [buildSubcommand, ...buildArguments], ); if (processResult.exitCode != 0) { diff --git a/packages/flutter_app_builder/lib/src/builders/ios/app_builder_ios.dart b/packages/flutter_app_builder/lib/src/builders/ios/app_builder_ios.dart index de76ba32..8069af37 100644 --- a/packages/flutter_app_builder/lib/src/builders/ios/app_builder_ios.dart +++ b/packages/flutter_app_builder/lib/src/builders/ios/app_builder_ios.dart @@ -21,6 +21,7 @@ class AppBuilderIos extends AppBuilder { @override Future build({ required Map arguments, + Map? environment, }) { if (!arguments.containsKey('export-options-plist') && !arguments.containsKey('export-method')) { @@ -28,6 +29,9 @@ class AppBuilderIos extends AppBuilder { 'Missing `export-options-plist` or `export-method` build argument.', ); } - return super.build(arguments: arguments); + return super.build( + arguments: arguments, + environment: environment, + ); } } diff --git a/packages/flutter_app_builder/lib/src/commands/flutter.dart b/packages/flutter_app_builder/lib/src/commands/flutter.dart new file mode 100644 index 00000000..62fd51c4 --- /dev/null +++ b/packages/flutter_app_builder/lib/src/commands/flutter.dart @@ -0,0 +1,44 @@ +import 'dart:io'; + +import 'package:path/path.dart' as p; +import 'package:shell_executor/shell_executor.dart'; + +class _Flutter extends Command { + @override + String get executable { + String flutterRoot = environment?['FLUTTER_ROOT'] ?? ''; + if (flutterRoot.isNotEmpty) { + flutterRoot = pathExpansion(flutterRoot, environment ?? {}); + return p.join(flutterRoot, 'bin', 'flutter'); + } + return 'flutter'; + } + + Map? environment; + + withEnv(Map? environment) { + this.environment = environment; + return this; + } + + Future clean() { + return exec( + ['clean'], + environment: environment, + ); + } + + Future build(List arguments) { + return exec( + ['build', ...arguments], + environment: environment, + ); + } + + @override + Future install() { + throw UnimplementedError(); + } +} + +final flutter = _Flutter(); diff --git a/packages/flutter_app_builder/lib/src/flutter_app_builder.dart b/packages/flutter_app_builder/lib/src/flutter_app_builder.dart index 72f6df2b..b6a2e3a9 100644 --- a/packages/flutter_app_builder/lib/src/flutter_app_builder.dart +++ b/packages/flutter_app_builder/lib/src/flutter_app_builder.dart @@ -1,6 +1,6 @@ import 'package:flutter_app_builder/src/build_result.dart'; import 'package:flutter_app_builder/src/builders/builders.dart'; -import 'package:shell_executor/shell_executor.dart'; +import 'package:flutter_app_builder/src/commands/flutter.dart'; class FlutterAppBuilder { final List _builders = [ @@ -13,14 +13,17 @@ class FlutterAppBuilder { AppBuilderWindows(), ]; - Future clean() async { - await $('flutter', ['clean']); + Future clean({ + Map? environment, + }) async { + await flutter.withEnv(environment).clean(); } Future build( String platform, { String? target, required Map arguments, + Map? environment, }) { final builder = _builders.firstWhere((e) => e.match(platform, target)); if (!builder.isSupportedOnCurrentPlatform) { @@ -28,6 +31,9 @@ class FlutterAppBuilder { '${builder.runtimeType} is not supported on the current platform', ); } - return builder.build(arguments: arguments); + return builder.build( + arguments: arguments, + environment: environment, + ); } } diff --git a/packages/flutter_app_builder/pubspec.lock b/packages/flutter_app_builder/pubspec.lock index e0b552ab..3165e921 100644 --- a/packages/flutter_app_builder/pubspec.lock +++ b/packages/flutter_app_builder/pubspec.lock @@ -210,7 +210,7 @@ packages: source: hosted version: "2.1.0" path: - dependency: transitive + dependency: "direct main" description: name: path sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" @@ -287,7 +287,7 @@ packages: path: "../shell_executor" relative: true source: path - version: "0.1.3" + version: "0.1.4" source_map_stack_trace: dependency: transitive description: diff --git a/packages/flutter_app_builder/pubspec.yaml b/packages/flutter_app_builder/pubspec.yaml index f8b5e43e..a4fa1509 100644 --- a/packages/flutter_app_builder/pubspec.yaml +++ b/packages/flutter_app_builder/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_app_builder description: Build your Flutter app via Dart. -version: 0.3.3 +version: 0.3.4 homepage: https://distributor.leanflutter.org repository: https://github.com/leanflutter/flutter_distributor/tree/main/packages/flutter_app_builder @@ -9,10 +9,12 @@ environment: dependencies: glob: ^2.1.1 + path: ^1.8.1 pub_semver: ^2.1.0 pubspec_parse: ^1.1.0 recase: ^4.1.0 - shell_executor: ^0.1.3 + shell_executor: ^0.1.4 + dev_dependencies: dependency_validator: ^3.0.0 test: ^1.23.1 diff --git a/packages/flutter_app_packager/CHANGELOG.md b/packages/flutter_app_packager/CHANGELOG.md index a0263794..7c7e26d1 100644 --- a/packages/flutter_app_packager/CHANGELOG.md +++ b/packages/flutter_app_packager/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.4 + +* bump `shell_executor` to 0.1.4 + ## 0.3.2 * Update dart sdk version to ">=2.16.0 <4.0.0" diff --git a/packages/flutter_app_packager/pubspec.lock b/packages/flutter_app_packager/pubspec.lock index 7c81643e..77c3c3bf 100644 --- a/packages/flutter_app_packager/pubspec.lock +++ b/packages/flutter_app_packager/pubspec.lock @@ -7,7 +7,7 @@ packages: path: "../app_package_maker" relative: true source: path - version: "0.3.2" + version: "0.3.4" archive: dependency: "direct main" description: @@ -164,10 +164,10 @@ packages: dependency: transitive description: name: logging - sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" meta: dependency: transitive description: @@ -180,10 +180,10 @@ packages: dependency: "direct main" description: name: msix - sha256: "5dbf26361fbff0e74abd06c80f0b446476c739eea017d833d15e093c3c778fdd" + sha256: ecb192bc47aa9de177e954761b2e90e4b6f1370abe1d298975e56d894ca75bc6 url: "https://pub.dev" source: hosted - version: "3.13.2" + version: "3.13.3" mustache_template: dependency: transitive description: @@ -246,7 +246,7 @@ packages: path: "../shell_executor" relative: true source: path - version: "0.1.3" + version: "0.1.4" source_span: dependency: transitive description: diff --git a/packages/flutter_app_packager/pubspec.yaml b/packages/flutter_app_packager/pubspec.yaml index ea937a5e..8c248469 100644 --- a/packages/flutter_app_packager/pubspec.yaml +++ b/packages/flutter_app_packager/pubspec.yaml @@ -1,19 +1,19 @@ name: flutter_app_packager description: Package your Flutter app into OS-specific bundles (.dmg, .exe, etc.) via Dart or the command line. -version: 0.3.2 +version: 0.3.4 homepage: https://github.com/leanflutter/flutter_distributor environment: sdk: ">=2.16.0 <4.0.0" dependencies: - app_package_maker: ^0.3.2 + app_package_maker: ^0.3.4 archive: ^3.1.5 io: ^1.0.3 liquid_engine: ^0.2.2 msix: ^3.13.2 path: ^1.8.1 - shell_executor: ^0.1.3 + shell_executor: ^0.1.4 dev_dependencies: dependency_validator: ^3.0.0 diff --git a/packages/flutter_app_publisher/CHANGELOG.md b/packages/flutter_app_publisher/CHANGELOG.md index c6155ad0..07ff9c23 100644 --- a/packages/flutter_app_publisher/CHANGELOG.md +++ b/packages/flutter_app_publisher/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.4 + +* bump `shell_executor` to 0.1.4 + ## 0.3.2 * Update dart sdk version to ">=2.16.0 <4.0.0" diff --git a/packages/flutter_app_publisher/pubspec.lock b/packages/flutter_app_publisher/pubspec.lock index fcc6f207..b2234b82 100644 --- a/packages/flutter_app_publisher/pubspec.lock +++ b/packages/flutter_app_publisher/pubspec.lock @@ -22,7 +22,7 @@ packages: path: "../app_package_publisher" relative: true source: path - version: "0.3.2" + version: "0.3.4" archive: dependency: transitive description: @@ -205,7 +205,7 @@ packages: path: "../parse_app_package" relative: true source: path - version: "0.3.2" + version: "0.3.4" path: dependency: transitive description: @@ -260,7 +260,7 @@ packages: path: "../shell_executor" relative: true source: path - version: "0.1.3" + version: "0.1.4" source_span: dependency: transitive description: diff --git a/packages/flutter_app_publisher/pubspec.yaml b/packages/flutter_app_publisher/pubspec.yaml index 9f6fc1c3..be07afa0 100644 --- a/packages/flutter_app_publisher/pubspec.yaml +++ b/packages/flutter_app_publisher/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_app_publisher description: Flutter app publisher -version: 0.3.2 +version: 0.3.4 homepage: https://distributor.leanflutter.org repository: https://github.com/leanflutter/flutter_distributor/tree/main/packages/flutter_app_publisher @@ -8,12 +8,12 @@ environment: sdk: ">=2.16.0 <4.0.0" dependencies: - app_package_publisher: ^0.3.2 + app_package_publisher: ^0.3.4 dio: ^5.1.2 googleapis: ^8.1.0 googleapis_auth: ^1.3.0 - parse_app_package: ^0.3.2 + parse_app_package: ^0.3.4 qiniu_sdk_base: ^0.5.0 - shell_executor: ^0.1.3 + shell_executor: ^0.1.4 dev_dependencies: dependency_validator: ^3.0.0 diff --git a/packages/flutter_distributor/CHANGELOG.md b/packages/flutter_distributor/CHANGELOG.md index 83551261..a3b2349f 100644 --- a/packages/flutter_distributor/CHANGELOG.md +++ b/packages/flutter_distributor/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.3.4 + +* bump `shell_executor` to 0.1.4 +* Supports custom `FLUTTER_ROOT` environment variable. +* Support defining environment variables in releases and jobs. + ## 0.3.3 * [apk-builer] fix apk not found diff --git a/packages/flutter_distributor/lib/src/distribute_options.dart b/packages/flutter_distributor/lib/src/distribute_options.dart index 987168c2..f87b2e62 100644 --- a/packages/flutter_distributor/lib/src/distribute_options.dart +++ b/packages/flutter_distributor/lib/src/distribute_options.dart @@ -4,30 +4,33 @@ import 'package:flutter_distributor/src/release.dart'; class DistributeOptions { DistributeOptions({ - this.env, required this.output, + this.variables, this.artifactName, required this.releases, }); factory DistributeOptions.fromJson(Map json) { - Map env = {}; - if (json.containsKey('env') && json['env'] != null) { - env = Map.from(json['env']); + Map variables = {}; + if (json.containsKey('variables') && json['variables'] != null) { + variables = Map.from(json['variables']); + // 兼容老版本 + } else if (json.containsKey('env') && json['env'] != null) { + variables = Map.from(json['env']); } List releases = ((json['releases'] ?? []) as List) .map((item) => Release.fromJson(item)) .toList(); return DistributeOptions( - env: env, output: json['output'], + variables: variables, artifactName: json['artifact_name'], releases: releases, ); } - final Map? env; final String output; + final Map? variables; final String? artifactName; final List releases; @@ -35,8 +38,8 @@ class DistributeOptions { Map toJson() { return { - 'env': env, 'output': output, + 'variables': variables, 'artifact_name': artifactName, 'releases': releases.map((e) => e.toJson()).toList(), }..removeWhere((key, value) => value == null); diff --git a/packages/flutter_distributor/lib/src/flutter_distributor.dart b/packages/flutter_distributor/lib/src/flutter_distributor.dart index 8f2a9743..d5a098b0 100644 --- a/packages/flutter_distributor/lib/src/flutter_distributor.dart +++ b/packages/flutter_distributor/lib/src/flutter_distributor.dart @@ -35,25 +35,24 @@ class FlutterDistributor { return _pubspec!; } - final Map _environment = {}; - Map get environment { - if (_environment.keys.isEmpty) { + final Map _globalVariables = {}; + Map get globalVariables { + if (_globalVariables.keys.isEmpty) { for (String key in Platform.environment.keys) { String? value = Platform.environment[key]; if ((value ?? '').isNotEmpty) { - _environment[key] = value!; + _globalVariables[key] = value!; } } - List keys = distributeOptions.env?.keys.toList() ?? []; + List keys = distributeOptions.variables?.keys.toList() ?? []; for (String key in keys) { - String? value = distributeOptions.env?[key]; - + String? value = distributeOptions.variables?[key]; if ((value ?? '').isNotEmpty) { - _environment[key] = value!; + _globalVariables[key] = value!; } } } - return _environment; + return _globalVariables; } DistributeOptions? _distributeOptions; @@ -131,6 +130,7 @@ class FlutterDistributor { String? artifactName, required bool cleanBeforeBuild, required Map buildArguments, + Map? variables, }) async { List makeResultList = []; @@ -155,6 +155,7 @@ class FlutterDistributor { platform, target: target, arguments: buildArguments, + environment: variables ?? globalVariables, ); print(JsonEncoder.withIndent(' ').convert(buildResult.toJson())); logger.info( @@ -209,6 +210,7 @@ class FlutterDistributor { FileSystemEntity fileSystemEntity, List targets, { Map? publishArguments, + Map? variables, }) async { List publishResultList = []; try { @@ -247,7 +249,7 @@ class FlutterDistributor { PublishResult publishResult = await _publisher.publish( fileSystemEntity, target: target, - environment: environment, + environment: variables ?? globalVariables, publishArguments: newPublishArguments, onPublishProgress: (sent, total) { if (!progressBar.isActive) { @@ -317,6 +319,11 @@ class FlutterDistributor { '${'===>'.blue()} ${'Releasing'.white(bold: true)} $name:${job.name.green(bold: true)}', ); + Map variables = {} + ..addAll(globalVariables) + ..addAll(release.variables ?? {}) + ..addAll(job.variables ?? {}); + List makeResultList = await package( job.package.platform, [job.package.target], @@ -324,6 +331,7 @@ class FlutterDistributor { artifactName: distributeOptions.artifactName, cleanBeforeBuild: needCleanBeforeBuild, buildArguments: job.package.buildArgs ?? {}, + variables: variables, ); // Clean only once needCleanBeforeBuild = false; @@ -336,6 +344,7 @@ class FlutterDistributor { artifact, [publishTarget!], publishArguments: job.publish?.args, + variables: variables, ); } } diff --git a/packages/flutter_distributor/lib/src/release.dart b/packages/flutter_distributor/lib/src/release.dart index d173f468..f99b9ce9 100644 --- a/packages/flutter_distributor/lib/src/release.dart +++ b/packages/flutter_distributor/lib/src/release.dart @@ -2,25 +2,33 @@ import 'package:flutter_distributor/src/release_job.dart'; class Release { Release({ + this.variables, required this.name, required this.jobs, }); factory Release.fromJson(Map json) { + Map variables = {}; + if (json.containsKey('variables') && json['variables'] != null) { + variables = Map.from(json['variables']); + } List jobs = (json['jobs'] as List) .map((item) => ReleaseJob.fromJson(item)) .toList(); return Release( + variables: variables, name: json['name'], jobs: jobs, ); } + final Map? variables; final String name; final List jobs; Map toJson() { return { + 'variables': variables, 'name': name, 'jobs': jobs.map((e) => e.toJson()).toList(), }..removeWhere((key, value) => value == null); diff --git a/packages/flutter_distributor/lib/src/release_job.dart b/packages/flutter_distributor/lib/src/release_job.dart index c18cff78..55980e31 100644 --- a/packages/flutter_distributor/lib/src/release_job.dart +++ b/packages/flutter_distributor/lib/src/release_job.dart @@ -14,6 +14,7 @@ class ReleaseJobPackage { buildArgs: json['build_args'], ); } + final String platform; final String target; final String? channel; @@ -54,6 +55,7 @@ class ReleaseJobPublish { class ReleaseJob { ReleaseJob({ + this.variables, required this.name, required this.package, this.publish, @@ -61,7 +63,12 @@ class ReleaseJob { }); factory ReleaseJob.fromJson(Map json) { + Map variables = {}; + if (json.containsKey('variables') && json['variables'] != null) { + variables = Map.from(json['variables']); + } return ReleaseJob( + variables: variables, name: json['name'], package: ReleaseJobPackage.fromJson(json['package']), publish: json['publish'] != null @@ -71,6 +78,7 @@ class ReleaseJob { ); } + final Map? variables; final String name; final ReleaseJobPackage package; final ReleaseJobPublish? publish; @@ -78,6 +86,7 @@ class ReleaseJob { Map toJson() { return { + 'variables': variables, 'name': name, 'package': package.toJson(), 'publish': publish?.toJson(), diff --git a/packages/flutter_distributor/pubspec.lock b/packages/flutter_distributor/pubspec.lock index 11633489..d6515cb7 100644 --- a/packages/flutter_distributor/pubspec.lock +++ b/packages/flutter_distributor/pubspec.lock @@ -23,7 +23,7 @@ packages: path: "../app_package_maker" relative: true source: path - version: "0.3.2" + version: "0.3.4" app_package_parser: dependency: "direct overridden" description: @@ -37,7 +37,7 @@ packages: path: "../app_package_publisher" relative: true source: path - version: "0.3.2" + version: "0.3.4" archive: dependency: transitive description: @@ -148,21 +148,21 @@ packages: path: "../flutter_app_builder" relative: true source: path - version: "0.3.3" + version: "0.3.4" flutter_app_packager: dependency: "direct main" description: path: "../flutter_app_packager" relative: true source: path - version: "0.3.2" + version: "0.3.4" flutter_app_publisher: dependency: "direct main" description: path: "../flutter_app_publisher" relative: true source: path - version: "0.3.2" + version: "0.3.4" get_it: dependency: transitive description: @@ -271,10 +271,10 @@ packages: dependency: transitive description: name: msix - sha256: "5dbf26361fbff0e74abd06c80f0b446476c739eea017d833d15e093c3c778fdd" + sha256: ecb192bc47aa9de177e954761b2e90e4b6f1370abe1d298975e56d894ca75bc6 url: "https://pub.dev" source: hosted - version: "3.13.2" + version: "3.13.3" mustache_template: dependency: transitive description: @@ -297,7 +297,7 @@ packages: path: "../parse_app_package" relative: true source: path - version: "0.3.2" + version: "0.3.4" path: dependency: "direct main" description: @@ -360,7 +360,7 @@ packages: path: "../shell_executor" relative: true source: path - version: "0.1.3" + version: "0.1.4" shell_uikit: dependency: "direct main" description: diff --git a/packages/flutter_distributor/pubspec.yaml b/packages/flutter_distributor/pubspec.yaml index 3cc54575..314a13bf 100644 --- a/packages/flutter_distributor/pubspec.yaml +++ b/packages/flutter_distributor/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_distributor description: A complete tool for packaging and publishing your Flutter apps. -version: 0.3.3 +version: 0.3.4 homepage: https://distributor.leanflutter.org repository: https://github.com/leanflutter/flutter_distributor/tree/main/packages/flutter_distributor issue_tracker: https://github.com/leanflutter/flutter_distributor/issues @@ -15,17 +15,17 @@ environment: dependencies: ansicolor: ^2.0.1 - app_package_maker: ^0.3.2 - app_package_publisher: ^0.3.2 + app_package_maker: ^0.3.4 + app_package_publisher: ^0.3.4 args: ^2.2.0 dio: ^5.1.2 - flutter_app_builder: ^0.3.3 - flutter_app_packager: ^0.3.2 - flutter_app_publisher: ^0.3.2 + flutter_app_builder: ^0.3.4 + flutter_app_packager: ^0.3.4 + flutter_app_publisher: ^0.3.4 logging: ^1.0.2 path: ^1.8.1 pubspec_parse: ^1.1.0 - shell_executor: ^0.1.3 + shell_executor: ^0.1.4 shell_uikit: ^0.1.1 yaml: ^3.1.0 diff --git a/packages/parse_app_package/CHANGELOG.md b/packages/parse_app_package/CHANGELOG.md index 4aa91ae1..71c382c1 100644 --- a/packages/parse_app_package/CHANGELOG.md +++ b/packages/parse_app_package/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.4 + +* bump `shell_executor` to 0.1.4 + ## 0.3.2 * Update dart sdk version to ">=2.16.0 <4.0.0" diff --git a/packages/parse_app_package/README.md b/packages/parse_app_package/README.md index 169073d3..f2232857 100644 --- a/packages/parse_app_package/README.md +++ b/packages/parse_app_package/README.md @@ -11,7 +11,7 @@ ```yaml dependencies: - parse_app_package: ^0.3.2 + parse_app_package: ^0.3.4 ``` ## Usage diff --git a/packages/parse_app_package/pubspec.lock b/packages/parse_app_package/pubspec.lock index f239be43..59bd0c22 100644 --- a/packages/parse_app_package/pubspec.lock +++ b/packages/parse_app_package/pubspec.lock @@ -190,7 +190,7 @@ packages: path: "../shell_executor" relative: true source: path - version: "0.1.3" + version: "0.1.4" source_span: dependency: transitive description: diff --git a/packages/parse_app_package/pubspec.yaml b/packages/parse_app_package/pubspec.yaml index c037dd66..4350b6a8 100644 --- a/packages/parse_app_package/pubspec.yaml +++ b/packages/parse_app_package/pubspec.yaml @@ -1,6 +1,6 @@ name: parse_app_package description: Parse app package -version: 0.3.2 +version: 0.3.4 homepage: https://distributor.leanflutter.org repository: https://github.com/leanflutter/flutter_distributor/tree/main/packages/parse_app_package