mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
[infra] Extend 3head patching to apply patches for flutter/flutter depending on pinned engine commit
This also adds a patch to flutter/flutter to fix head-head-head configuration (until engine is rolled into framework again). Change-Id: I6dae0983126a6664337834d3c93f1369139f1ac1 Reviewed-on: https://dart-review.googlesource.com/c/91922 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Jonas Termansen <sortie@google.com>
This commit is contained in:
parent
e4b809f0e6
commit
1bfc3816d8
7 changed files with 168 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -12,11 +12,14 @@
|
|||
# (run inside the root of a flutter engine checkout)
|
||||
|
||||
set -e
|
||||
if [ ! -e src/third_party/dart ]; then
|
||||
echo "$0: error: "\
|
||||
"This script must be run from the root of a flutter engine checkout" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR=$(dirname -- "$(which -- "$0")")
|
||||
. $DIR/patches/utils.sh
|
||||
|
||||
ensure_in_checkout_root
|
||||
|
||||
# Apply patches to the Flutter Framework if needed.
|
||||
src/third_party/dart/tools/patches/flutter-flutter/apply.sh
|
||||
|
||||
# Apply patches to the Flutter Engine if needed.
|
||||
src/third_party/dart/tools/patches/flutter-engine/apply.sh
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
# (run inside the root of a flutter engine checkout)
|
||||
|
||||
set -e
|
||||
if [ ! -e src/third_party/dart ]; then
|
||||
echo "$0: error: "\
|
||||
"This script must be run from the root of a flutter engine checkout" >&2
|
||||
exit 1
|
||||
fi
|
||||
pinned_dart_sdk=$(grep -E "'dart_revision':.*" src/flutter/DEPS |
|
||||
sed -E "s/.*'([^']*)',/\1/")
|
||||
|
||||
DIR=$(dirname -- "$(which -- "$0")")
|
||||
. $DIR/../utils.sh
|
||||
|
||||
ensure_in_checkout_root
|
||||
|
||||
pinned_dart_sdk=$(get_pinned_dart_version)
|
||||
need_runhooks=false
|
||||
patch=src/third_party/dart/tools/patches/flutter-engine/${pinned_dart_sdk}.flutter.patch
|
||||
if [ -e "$patch" ]; then
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
|
@ -15,13 +15,13 @@
|
|||
# (run inside the root of a flutter engine checkout)
|
||||
|
||||
set -e
|
||||
if [ ! -e src/third_party/dart ]; then
|
||||
echo "$0: error: "\
|
||||
"This script must be run from the root of a flutter engine checkout" >&2
|
||||
exit 1
|
||||
fi
|
||||
pinned_dart_sdk=$(grep -E "'dart_revision':.*" src/flutter/DEPS |
|
||||
sed -E "s/.*'([^']*)',/\1/")
|
||||
|
||||
DIR=$(dirname -- "$(which -- "$0")")
|
||||
. $DIR/../utils.sh
|
||||
|
||||
ensure_in_checkout_root
|
||||
|
||||
pinned_dart_sdk=$(get_pinned_dart_version)
|
||||
patch=src/third_party/dart/tools/patches/flutter-engine/$pinned_dart_sdk.patch
|
||||
rm -f src/third_party/dart/tools/patches/flutter-engine/*.patch
|
||||
(cd src/flutter && git diff) > $patch
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart
|
||||
index 821cb475b..c85da65b7 100644
|
||||
--- a/packages/flutter/lib/src/painting/text_style.dart
|
||||
+++ b/packages/flutter/lib/src/painting/text_style.dart
|
||||
@@ -822,7 +822,7 @@ class TextStyle extends Diagnosticable {
|
||||
fontStyle: fontStyle,
|
||||
fontFamily: fontFamily,
|
||||
fontSize: (fontSize ?? _defaultFontSize) * textScaleFactor,
|
||||
- lineHeight: height,
|
||||
+ height: height,
|
||||
maxLines: maxLines,
|
||||
ellipsis: ellipsis,
|
||||
locale: locale,
|
||||
diff --git a/packages/flutter/lib/src/rendering/error.dart b/packages/flutter/lib/src/rendering/error.dart
|
||||
index 03ab64749..a8552b37b 100644
|
||||
--- a/packages/flutter/lib/src/rendering/error.dart
|
||||
+++ b/packages/flutter/lib/src/rendering/error.dart
|
||||
@@ -95,7 +95,7 @@ class RenderErrorBox extends RenderBox {
|
||||
|
||||
/// The paragraph style to use when painting [RenderErrorBox] objects.
|
||||
static ui.ParagraphStyle paragraphStyle = ui.ParagraphStyle(
|
||||
- lineHeight: 1.0,
|
||||
+ height: 1.0,
|
||||
);
|
||||
|
||||
@override
|
||||
diff --git a/packages/flutter/test/painting/text_style_test.dart b/packages/flutter/test/painting/text_style_test.dart
|
||||
index 4d65194e9..f26570aec 100644
|
||||
--- a/packages/flutter/test/painting/text_style_test.dart
|
||||
+++ b/packages/flutter/test/painting/text_style_test.dart
|
||||
@@ -169,22 +169,22 @@ void main() {
|
||||
expect(ts2.toString(), 'TextStyle(color: Color(0xff00ff00), decoration: unspecified, decorationColor: unspecified, decorationStyle: unspecified, fontWeight: FontWeight.w800, fontStyle: unspecified, textBaseline: unspecified, fontFamily: unspecified, fontFamilyFallback: unspecified, fontSize: 10.0, letterSpacing: unspecified, wordSpacing: unspecified, height: 100.0x, locale: unspecified, background: unspecified, foreground: unspecified, shadows: unspecified)');
|
||||
|
||||
final ui.ParagraphStyle ps2 = s2.getParagraphStyle(textAlign: TextAlign.center);
|
||||
- expect(ps2, equals(ui.ParagraphStyle(textAlign: TextAlign.center, fontWeight: FontWeight.w800, fontSize: 10.0, lineHeight: 100.0)));
|
||||
- expect(ps2.toString(), 'ParagraphStyle(textAlign: TextAlign.center, textDirection: unspecified, fontWeight: FontWeight.w800, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 10.0, lineHeight: 100.0x, ellipsis: unspecified, locale: unspecified)');
|
||||
+ expect(ps2, equals(ui.ParagraphStyle(textAlign: TextAlign.center, fontWeight: FontWeight.w800, fontSize: 10.0, height: 100.0)));
|
||||
+ expect(ps2.toString(), 'ParagraphStyle(textAlign: TextAlign.center, textDirection: unspecified, fontWeight: FontWeight.w800, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 10.0, height: 100.0x, ellipsis: unspecified, locale: unspecified)');
|
||||
final ui.ParagraphStyle ps5 = s5.getParagraphStyle();
|
||||
- expect(ps5, equals(ui.ParagraphStyle(fontWeight: FontWeight.w700, fontSize: 12.0, lineHeight: 123.0)));
|
||||
- expect(ps5.toString(), 'ParagraphStyle(textAlign: unspecified, textDirection: unspecified, fontWeight: FontWeight.w700, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 12.0, lineHeight: 123.0x, ellipsis: unspecified, locale: unspecified)');
|
||||
+ expect(ps5, equals(ui.ParagraphStyle(fontWeight: FontWeight.w700, fontSize: 12.0, height: 123.0)));
|
||||
+ expect(ps5.toString(), 'ParagraphStyle(textAlign: unspecified, textDirection: unspecified, fontWeight: FontWeight.w700, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 12.0, height: 123.0x, ellipsis: unspecified, locale: unspecified)');
|
||||
});
|
||||
|
||||
|
||||
test('TextStyle with text direction', () {
|
||||
final ui.ParagraphStyle ps6 = const TextStyle().getParagraphStyle(textDirection: TextDirection.ltr);
|
||||
expect(ps6, equals(ui.ParagraphStyle(textDirection: TextDirection.ltr, fontSize: 14.0)));
|
||||
- expect(ps6.toString(), 'ParagraphStyle(textAlign: unspecified, textDirection: TextDirection.ltr, fontWeight: unspecified, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 14.0, lineHeight: unspecified, ellipsis: unspecified, locale: unspecified)');
|
||||
+ expect(ps6.toString(), 'ParagraphStyle(textAlign: unspecified, textDirection: TextDirection.ltr, fontWeight: unspecified, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 14.0, height: unspecified, ellipsis: unspecified, locale: unspecified)');
|
||||
|
||||
final ui.ParagraphStyle ps7 = const TextStyle().getParagraphStyle(textDirection: TextDirection.rtl);
|
||||
expect(ps7, equals(ui.ParagraphStyle(textDirection: TextDirection.rtl, fontSize: 14.0)));
|
||||
- expect(ps7.toString(), 'ParagraphStyle(textAlign: unspecified, textDirection: TextDirection.rtl, fontWeight: unspecified, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 14.0, lineHeight: unspecified, ellipsis: unspecified, locale: unspecified)');
|
||||
+ expect(ps7.toString(), 'ParagraphStyle(textAlign: unspecified, textDirection: TextDirection.rtl, fontWeight: unspecified, fontStyle: unspecified, maxLines: unspecified, fontFamily: unspecified, fontSize: 14.0, height: unspecified, ellipsis: unspecified, locale: unspecified)');
|
||||
});
|
||||
|
||||
test('TextStyle using package font', () {
|
25
tools/patches/flutter-flutter/apply.sh
Executable file
25
tools/patches/flutter-flutter/apply.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019, 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.
|
||||
#
|
||||
# This script applies a patch, if available, to the Flutter Framework. Only a
|
||||
# patch is applied for the particular engine.version the flutter framework is
|
||||
# using.
|
||||
#
|
||||
# Usage: src/third_party/dart/tools/patches/flutter-flutter/apply.sh
|
||||
# (run inside the root of a flutter checkout)
|
||||
|
||||
set -e
|
||||
|
||||
DIR=$(dirname -- "$(which -- "$0")")
|
||||
. $DIR/../utils.sh
|
||||
|
||||
ensure_in_checkout_root
|
||||
|
||||
pinned_engine_version=$(get_pinned_flutter_engine_version)
|
||||
patch=src/third_party/dart/tools/patches/flutter-flutter/${pinned_engine_version}.patch
|
||||
if [ -e "$patch" ]; then
|
||||
(cd flutter && git apply ../$patch)
|
||||
fi
|
26
tools/patches/flutter-flutter/create.sh
Executable file
26
tools/patches/flutter-flutter/create.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019, 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.
|
||||
#
|
||||
# This script produces a patch to the Flutter Framework from the local
|
||||
# uncommitted changes in the current engine checkout.
|
||||
#
|
||||
# Usage: src/third_party/dart/tools/patches/flutter-flutter/create.sh
|
||||
# (run inside the root of a flutter engine checkout)
|
||||
|
||||
set -e
|
||||
|
||||
DIR=$(dirname -- "$(which -- "$0")")
|
||||
. $DIR/../utils.sh
|
||||
|
||||
ensure_in_checkout_root
|
||||
|
||||
pinned_engine_version=$(get_pinned_flutter_engine_version)
|
||||
patch=src/third_party/dart/tools/patches/flutter-flutter/$pinned_engine_version.patch
|
||||
rm -f src/third_party/dart/tools/patches/flutter-flutter/*.patch
|
||||
(cd flutter && git diff) > $patch
|
||||
if [ ! -s $patch ]; then
|
||||
rm $patch
|
||||
fi
|
34
tools/patches/utils.sh
Normal file
34
tools/patches/utils.sh
Normal file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2019, 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.
|
||||
|
||||
die {
|
||||
echo "$0: error: "\
|
||||
"This script must be run from the root of a flutter engine checkout "\
|
||||
"(containing src/flutter/ and flutter/)" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
ensure_in_checkout_root {
|
||||
set -e
|
||||
if [ ! -e src/third_party/dart ]; then
|
||||
die
|
||||
fi
|
||||
|
||||
if [ ! -e flutter ]; then
|
||||
die
|
||||
fi
|
||||
}
|
||||
|
||||
get_pinned_dart_version {
|
||||
pinned_dart_sdk=$(grep -E "'dart_revision':.*" src/flutter/DEPS |
|
||||
sed -E "s/.*'([^']*)',/\1/")
|
||||
echo -n $pinned_dart_sdk
|
||||
}
|
||||
|
||||
get_pinned_flutter_engine_version {
|
||||
pinned_engine_version=$(cat flutter/bin/internal/engine.version | sed 's/[[:space:]]//')
|
||||
echo -n $pinned_engine_version
|
||||
}
|
Loading…
Reference in a new issue