diff --git a/ci/check_build_configs.sh b/ci/check_build_configs.sh index b1de5c5edd8f0..1c5cff9992dc4 100755 --- a/ci/check_build_configs.sh +++ b/ci/check_build_configs.sh @@ -27,10 +27,18 @@ function follow_links() ( echo "$file" ) +function dart_bin() { + dart_path="$1/flutter/third_party/dart/tools/sdks/dart-sdk/bin" + if [[ ! -e "$dart_path" ]]; then + dart_path="$1/third_party/dart/tools/sdks/dart-sdk/bin" + fi + echo "$dart_path" +} + SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")") SRC_DIR="$(cd "$SCRIPT_DIR/../.."; pwd -P)" FLUTTER_DIR="$(cd "$SCRIPT_DIR/.."; pwd -P)" -DART_BIN="${SRC_DIR}/third_party/dart/tools/sdks/dart-sdk/bin" +DART_BIN=$(dart_bin "$SRC_DIR") DART="${DART_BIN}/dart" cd "$SCRIPT_DIR" diff --git a/ci/clang_tidy.sh b/ci/clang_tidy.sh index 653256140cfa6..ec47288716acf 100755 --- a/ci/clang_tidy.sh +++ b/ci/clang_tidy.sh @@ -27,10 +27,18 @@ function follow_links() ( echo "$file" ) +function dart_bin() { + dart_path="$1/flutter/third_party/dart/tools/sdks/dart-sdk/bin" + if [[ ! -e "$dart_path" ]]; then + dart_path="$1/third_party/dart/tools/sdks/dart-sdk/bin" + fi + echo "$dart_path" +} + SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")") SRC_DIR="$(cd "$SCRIPT_DIR/../.."; pwd -P)" FLUTTER_DIR="$(cd "$SCRIPT_DIR/.."; pwd -P)" -DART_BIN="${SRC_DIR}/third_party/dart/tools/sdks/dart-sdk/bin" +DART_BIN=$(dart_bin "$SRC_DIR") DART="${DART_BIN}/dart" # FLUTTER_LINT_PRINT_FIX will make it so that fix is executed and the generated diff --git a/ci/format.sh b/ci/format.sh index 0425eb380eb7c..bb5e72a216473 100755 --- a/ci/format.sh +++ b/ci/format.sh @@ -27,10 +27,18 @@ function follow_links() ( echo "$file" ) +function dart_bin() { + dart_path="$1/flutter/third_party/dart/tools/sdks/dart-sdk/bin" + if [[ ! -e "$dart_path" ]]; then + dart_path="$1/third_party/dart/tools/sdks/dart-sdk/bin" + fi + echo "$dart_path" +} + SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")") SRC_DIR="$(cd "$SCRIPT_DIR/../.."; pwd -P)" -DART_SDK_DIR="${SRC_DIR}/third_party/dart/tools/sdks/dart-sdk" -DART="${DART_SDK_DIR}/bin/dart" +DART_BIN=$(dart_bin "$SRC_DIR") +DART="${DART_BIN}/dart" cd "$SCRIPT_DIR" "$DART" \ diff --git a/ci/licenses.sh b/ci/licenses.sh index ed817b8828b5b..57dac32ca2929 100755 --- a/ci/licenses.sh +++ b/ci/licenses.sh @@ -30,12 +30,20 @@ function follow_links() ( echo "$file" ) +function dart_bin() { + dart_path="$1/flutter/third_party/dart/tools/sdks/dart-sdk/bin" + if [[ ! -e "$dart_path" ]]; then + dart_path="$1/third_party/dart/tools/sdks/dart-sdk/bin" + fi + echo "$dart_path" +} + SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")") SRC_DIR="$( cd "$SCRIPT_DIR/../.." pwd -P )" -DART_BIN="$SRC_DIR/third_party/dart/tools/sdks/dart-sdk/bin" +DART_BIN=$(dart_bin "$SRC_DIR") PATH="$DART_BIN:$PATH" # Use: diff --git a/testing/benchmark/upload_metrics.sh b/testing/benchmark/upload_metrics.sh index e28c514d6b4e2..7d6c245736a4d 100644 --- a/testing/benchmark/upload_metrics.sh +++ b/testing/benchmark/upload_metrics.sh @@ -30,10 +30,18 @@ function follow_links() ( echo "$file" ) +function dart_bin() { + dart_path="$1/flutter/third_party/dart/tools/sdks/dart-sdk/bin" + if [[ ! -e "$dart_path" ]]; then + dart_path="$1/third_party/dart/tools/sdks/dart-sdk/bin" + fi + echo "$dart_path" +} + SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")") SRC_DIR="$(cd "$SCRIPT_DIR/../../.."; pwd -P)" -DART_SDK_DIR="${SRC_DIR}/third_party/dart/tools/sdks/dart-sdk" -DART="${DART_SDK_DIR}/bin/dart" +DART_BIN=$(dart_bin "$SRC_DIR") +DART="${DART_BIN}/dart" cd "$SCRIPT_DIR" "$DART" --disable-dart-dev bin/parse_and_send.dart \ diff --git a/tools/fuchsia/make_build_info.py b/tools/fuchsia/make_build_info.py index 6d59113df157a..ea680a043d89e 100755 --- a/tools/fuchsia/make_build_info.py +++ b/tools/fuchsia/make_build_info.py @@ -15,14 +15,21 @@ import json +def GetDartPath(buildroot): + dart_path = path.join(buildroot, 'flutter', 'third_party', 'dart') + if not path.exists(dart_path): + dart_path = path.join(buildroot, 'third_party', 'dart') + return dart_path + + def GetDartSdkGitRevision(buildroot): - project_root = path.join(buildroot, 'third_party', 'dart') - return subprocess.check_output(['git', '-C', project_root, 'rev-parse', 'HEAD']).strip() + return subprocess.check_output(['git', '-C', GetDartPath(buildroot), 'rev-parse', 'HEAD']).strip() def GetDartSdkSemanticVersion(buildroot): project_root = path.join(buildroot, 'third_party', 'dart') - return subprocess.check_output(['git', '-C', project_root, 'describe', '--abbrev=0']).strip() + return subprocess.check_output(['git', '-C', + GetDartPath(buildroot), 'describe', '--abbrev=0']).strip() def GetFlutterEngineGitRevision(buildroot): diff --git a/tools/githooks/post-checkout b/tools/githooks/post-checkout index 8858d4952b80d..a3d6654de3fca 100755 --- a/tools/githooks/post-checkout +++ b/tools/githooks/post-checkout @@ -13,7 +13,14 @@ import sys SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) FLUTTER_DIR = os.path.join(SRC_ROOT, 'flutter') -DART_BIN = os.path.join(SRC_ROOT, 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + + +def GetDartBin(): + dart_bin = os.path.join(SRC_ROOT, 'flutter', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + if not os.path.exists(dart_bin): + dart_bin = os.path.join(SRC_ROOT, 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + return dart_bin + def Main(argv): githook_args = [ @@ -22,7 +29,7 @@ def Main(argv): ] result = subprocess.run([ - os.path.join(DART_BIN, 'dart'), + os.path.join(GetDartBin(), 'dart'), '--disable-dart-dev', os.path.join(FLUTTER_DIR, 'tools', 'githooks', 'bin', 'main.dart'), ] + githook_args + [ diff --git a/tools/githooks/post-merge b/tools/githooks/post-merge index 0502091e8041d..91cbe9ee73fbe 100755 --- a/tools/githooks/post-merge +++ b/tools/githooks/post-merge @@ -13,7 +13,14 @@ import sys SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) FLUTTER_DIR = os.path.join(SRC_ROOT, 'flutter') -DART_BIN = os.path.join(SRC_ROOT, 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + + +def GetDartBin(): + dart_bin = os.path.join(SRC_ROOT, 'flutter', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + if not os.path.exists(dart_bin): + dart_bin = os.path.join(SRC_ROOT, 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + return dart_bin + def Main(argv): githook_args = [ @@ -22,7 +29,7 @@ def Main(argv): ] result = subprocess.run([ - os.path.join(DART_BIN, 'dart'), + os.path.join(GetDartBin(), 'dart'), '--disable-dart-dev', os.path.join(FLUTTER_DIR, 'tools', 'githooks', 'bin', 'main.dart'), ] + githook_args + [ diff --git a/tools/githooks/pre-push b/tools/githooks/pre-push index 7c5322d8cd6a8..5b95d51b6d445 100755 --- a/tools/githooks/pre-push +++ b/tools/githooks/pre-push @@ -14,9 +14,16 @@ import sys SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) FLUTTER_DIR = os.path.join(SRC_ROOT, 'flutter') -DART_BIN = os.path.join(SRC_ROOT, 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') ENABLE_CLANG_TIDY = os.environ.get('PRE_PUSH_CLANG_TIDY') + +def GetDartBin(): + dart_bin = os.path.join(SRC_ROOT, 'flutter', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + if not os.path.exists(dart_bin): + dart_bin = os.path.join(SRC_ROOT, 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + return dart_bin + + def Main(argv): githook_args = [ '--flutter', @@ -29,7 +36,7 @@ def Main(argv): ] result = subprocess.run([ - os.path.join(DART_BIN, 'dart'), + os.path.join(GetDartBin(), 'dart'), '--disable-dart-dev', os.path.join(FLUTTER_DIR, 'tools', 'githooks', 'bin', 'main.dart'), ] + githook_args + [ diff --git a/tools/githooks/pre-rebase b/tools/githooks/pre-rebase index 6da10a470ce42..56082c4a6aa49 100755 --- a/tools/githooks/pre-rebase +++ b/tools/githooks/pre-rebase @@ -13,7 +13,14 @@ import sys SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) FLUTTER_DIR = os.path.join(SRC_ROOT, 'flutter') -DART_BIN = os.path.join(SRC_ROOT, 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + + +def GetDartBin(): + dart_bin = os.path.join(SRC_ROOT, 'flutter', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + if not os.path.exists(dart_bin): + dart_bin = os.path.join(SRC_ROOT, 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin') + return dart_bin + def Main(argv): githook_args = [ @@ -22,7 +29,7 @@ def Main(argv): ] result = subprocess.run([ - os.path.join(DART_BIN, 'dart'), + os.path.join(GetDartBin(), 'dart'), '--disable-dart-dev', os.path.join(FLUTTER_DIR, 'tools', 'githooks', 'bin', 'main.dart'), ] + githook_args + [