Skip to content

Commit

Permalink
Supports custom FLUTTER_ROOT environment variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 committed May 31, 2023
1 parent 4c7ce87 commit 8b8acf0
Show file tree
Hide file tree
Showing 50 changed files with 220 additions and 102 deletions.
2 changes: 1 addition & 1 deletion README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/en/distribute-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Distribute Options
## Example

```yaml
env:
variables:
PGYER_API_KEY: "your api key"
output: dist/
releases:
Expand Down
4 changes: 2 additions & 2 deletions docs/en/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```

Expand Down Expand Up @@ -67,7 +67,7 @@ releases:
### Full Example Configuration

```yaml
env:
variables:
PGYER_API_KEY: "your api key"
output: dist/
releases:
Expand Down
2 changes: 1 addition & 1 deletion docs/en/publishers/appcenter.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ flutter_distributor publish \
### Configure `distribute_options.yaml`

```yaml
env:
variables:
# See: https://appcenter.ms/settings/apitokens
APPCENTER_API_TOKEN: <api-token>
output: dist/
Expand Down
2 changes: 1 addition & 1 deletion docs/en/publishers/appstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ flutter_distributor publish \
### Configure `distribute_options.yaml`

```yaml
env:
variables:
APPSTORE_USERNAME: "xxx"
APPSTORE_PASSWORD: "xxx"
# or
Expand Down
2 changes: 1 addition & 1 deletion docs/en/publishers/firebase.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/en/publishers/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token]
output: dist/
releases:
Expand Down
2 changes: 1 addition & 1 deletion docs/en/publishers/qiniu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/distribute-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: 分发选项
## 示例

```yaml
env:
variables:
PGYER_API_KEY: "your api key"
output: dist/
releases:
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```

Expand Down Expand Up @@ -65,7 +65,7 @@ releases:
### 完整的示例配置

```yaml
env:
variables:
PGYER_API_KEY: "your api key"
output: dist/
releases:
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/publishers/appcenter.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ flutter_distributor publish \
### 配置 `distribute_options.yaml`

```yaml
env:
variables:
# See: https://appcenter.ms/settings/apitokens
APPCENTER_API_TOKEN: <api-token>
output: dist/
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/publishers/appstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ flutter_distributor publish \
### 配置 `distribute_options.yaml`

```yaml
env:
variables:
APPSTORE_USERNAME: "xxx"
APPSTORE_PASSWORD: "xxx"
# or
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/publishers/firebase.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/publishers/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token]
output: dist/
releases:
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/publishers/qiniu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
7 changes: 5 additions & 2 deletions examples/hello_world/distribute_options.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions examples/hello_world/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
0722C86F52094B5AFA9D74C3 /* Pods-Runner.release.xcconfig */,
F420089D2E1AFAF26E3F1A48 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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 = (
Expand All @@ -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 = (
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/release.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

dart ../../packages/flutter_distributor/bin/main.dart release --name $1 --skip-clean
dart ../../packages/flutter_distributor/bin/main.dart release --name $1 --skip-clean --no-version-check
12 changes: 6 additions & 6 deletions examples/multiple_flavors/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions packages/app_package_maker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/app_package_maker/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions packages/app_package_maker/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions packages/app_package_publisher/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/app_package_publisher/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions packages/app_package_publisher/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
4 changes: 4 additions & 0 deletions packages/flutter_app_builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.4

* bump `shell_executor` to 0.1.4

## 0.3.3

* [apk-builer] fix apk not found
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -34,6 +34,7 @@ abstract class AppBuilder {

Future<BuildResult> build({
required Map<String, dynamic> arguments,
Map<String, String>? environment,
}) async {
final time = Stopwatch()..start();

Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ class AppBuilderIos extends AppBuilder {
@override
Future<BuildResult> build({
required Map<String, dynamic> arguments,
Map<String, String>? environment,
}) {
if (!arguments.containsKey('export-options-plist') &&
!arguments.containsKey('export-method')) {
throw BuildError(
'Missing `export-options-plist` or `export-method` build argument.',
);
}
return super.build(arguments: arguments);
return super.build(
arguments: arguments,
environment: environment,
);
}
}
Loading

0 comments on commit 8b8acf0

Please sign in to comment.