Skip to content

Commit eef7fdc

Browse files
update dart patches again
1 parent 99be2e2 commit eef7fdc

3 files changed

Lines changed: 61 additions & 38 deletions

File tree

patches/dart.new.patch

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
diff --git a/pkg/_fe_analyzer_shared/lib/src/util/colors.dart b/pkg/_fe_analyzer_shared/lib/src/util/colors.dart
2-
index fe4437e2..dc658b7b 100644
2+
index 81d66b11..00000000 100644
33
--- a/pkg/_fe_analyzer_shared/lib/src/util/colors.dart
44
+++ b/pkg/_fe_analyzer_shared/lib/src/util/colors.dart
5-
@@ -141,7 +141,7 @@ bool _computeEnableColors() {
5+
@@ -147,8 +147,8 @@ bool _computeEnableColors() {
66
// The `-S` option of `tput` allows us to query multiple capabilities at
77
// once.
8-
ProcessResult result = Process.runSync(
9-
- "/bin/sh", ["-c", "printf '%s' '$TERMINAL_CAPABILITIES' | tput -S"]);
10-
+ "/data/data/com.termux/files/usr/bin/sh", ["-c", "printf '%s' '$TERMINAL_CAPABILITIES' | tput -S"]);
8+
- ProcessResult result = Process.runSync("/bin/sh", [
9+
+ ProcessResult result = Process.runSync("/data/data/com.termux/files/usr/bin/sh", [
10+
"-c",
11+
"printf '%s' '$TERMINAL_CAPABILITIES' | tput -S",
12+
]);
1113

1214
if (result.exitCode != 0) {
13-
printEnableColorsReason("Not enabling colors, running tput failed.");
1415
diff --git a/runtime/bin/directory_linux.cc b/runtime/bin/directory_linux.cc
15-
index ddfed623..c8e1ac0e 100644
16+
index ddfed623..00000000 100644
1617
--- a/runtime/bin/directory_linux.cc
1718
+++ b/runtime/bin/directory_linux.cc
1819
@@ -425,7 +425,7 @@ const char* Directory::SystemTemp(Namespace* namespc) {
@@ -25,12 +26,11 @@ index ddfed623..c8e1ac0e 100644
2526
temp_dir = "/tmp";
2627
#endif
2728
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
28-
index 124b85be..4e513a6c 100644
29+
index 66c3f273..00000000 100644
2930
--- a/runtime/platform/globals.h
3031
+++ b/runtime/platform/globals.h
31-
@@ -737,7 +737,9 @@ DART_FORCE_INLINE D bit_copy(const S& source) {
32-
#define DART_ENABLE_HEAP_SNAPSHOT_WRITER 1
33-
#endif
32+
@@ -708,6 +708,8 @@
33+
#undef OVERFLOW
3434

3535
-#if defined(DART_HOST_OS_ANDROID)
3636
+#if defined(DART_HOST_OS_ANDROID) && defined(__TERMUX__)
@@ -40,10 +40,10 @@ index 124b85be..4e513a6c 100644
4040
#elif defined(DART_HOST_OS_FUCHSIA)
4141
#define kHostOperatingSystemName "fuchsia"
4242
diff --git a/runtime/vm/os_android.cc b/runtime/vm/os_android.cc
43-
index b60658c4..aa0dcb8d 100644
43+
index a5cf6b52..00000000 100644
4444
--- a/runtime/vm/os_android.cc
4545
+++ b/runtime/vm/os_android.cc
46-
@@ -32,7 +32,7 @@ namespace dart {
46+
@@ -30,7 +30,7 @@ namespace dart {
4747

4848
DEFINE_FLAG(bool,
4949
android_log_to_stderr,
@@ -52,7 +52,8 @@ index b60658c4..aa0dcb8d 100644
5252
"Send Dart VM logs to stdout and stderr instead of the Android "
5353
"system logs.");
5454

55-
@@ -53,7 +53,7 @@ class PerfCodeObserver : public CodeObserver {
55+
@@ -49,7 +49,7 @@ class PerfCodeObserver : public CodeObserver {
56+
if (file_open == nullptr) {
5657
return;
5758
}
5859
intptr_t pid = getpid();
@@ -62,15 +63,18 @@ index b60658c4..aa0dcb8d 100644
6263
free(filename);
6364
}
6465
diff --git a/sdk/lib/_internal/vm/bin/process_patch.dart b/sdk/lib/_internal/vm/bin/process_patch.dart
65-
index a43770f6..208b4894 100644
66+
index 7c458430..00000000 100644
6667
--- a/sdk/lib/_internal/vm/bin/process_patch.dart
6768
+++ b/sdk/lib/_internal/vm/bin/process_patch.dart
68-
@@ -331,7 +331,7 @@ base class _ProcessImpl extends _ProcessImplNativeWrapper implements _Process {
69+
@@ -287,10 +287,10 @@ base class _ProcessImpl extends _ProcessImplNativeWrapper implements _Process {
70+
static String _getShellCommand() {
6971
if (Platform.isWindows) {
7072
return 'cmd.exe';
7173
}
72-
- return '/bin/sh';
73-
+ return '/data/data/com.termux/files/usr/bin/sh';
74+
if (Platform.isAndroid) {
75+
- return '/system/bin/sh';
76+
+ return '/data/data/com.termux/files/usr/bin/sh';
77+
}
78+
return '/bin/sh';
7479
}
7580

76-
static List<String> _getShellArguments(

patches/dart.patch

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
diff --git a/pkg/_fe_analyzer_shared/lib/src/util/colors.dart b/pkg/_fe_analyzer_shared/lib/src/util/colors.dart
2-
index fe4437e2..dc658b7b 100644
2+
index 81d66b11..00000000 100644
33
--- a/pkg/_fe_analyzer_shared/lib/src/util/colors.dart
44
+++ b/pkg/_fe_analyzer_shared/lib/src/util/colors.dart
5-
@@ -141,7 +141,7 @@ bool _computeEnableColors() {
5+
@@ -147,8 +147,8 @@ bool _computeEnableColors() {
66
// The `-S` option of `tput` allows us to query multiple capabilities at
77
// once.
8-
ProcessResult result = Process.runSync(
9-
- "/bin/sh", ["-c", "printf '%s' '$TERMINAL_CAPABILITIES' | tput -S"]);
10-
+ "/data/data/com.termux/files/usr/bin/sh", ["-c", "printf '%s' '$TERMINAL_CAPABILITIES' | tput -S"]);
8+
- ProcessResult result = Process.runSync("/bin/sh", [
9+
+ ProcessResult result = Process.runSync("/data/data/com.termux/files/usr/bin/sh", [
10+
"-c",
11+
"printf '%s' '$TERMINAL_CAPABILITIES' | tput -S",
12+
]);
1113

1214
if (result.exitCode != 0) {
13-
printEnableColorsReason("Not enabling colors, running tput failed.");
1415
diff --git a/runtime/bin/directory_linux.cc b/runtime/bin/directory_linux.cc
15-
index ddfed623..c8e1ac0e 100644
16+
index ddfed623..00000000 100644
1617
--- a/runtime/bin/directory_linux.cc
1718
+++ b/runtime/bin/directory_linux.cc
1819
@@ -425,7 +425,7 @@ const char* Directory::SystemTemp(Namespace* namespc) {
@@ -25,12 +26,11 @@ index ddfed623..c8e1ac0e 100644
2526
temp_dir = "/tmp";
2627
#endif
2728
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
28-
index 124b85be..4e513a6c 100644
29+
index 66c3f273..00000000 100644
2930
--- a/runtime/platform/globals.h
3031
+++ b/runtime/platform/globals.h
31-
@@ -737,7 +737,9 @@ DART_FORCE_INLINE D bit_copy(const S& source) {
32-
#define DART_ENABLE_HEAP_SNAPSHOT_WRITER 1
33-
#endif
32+
@@ -708,6 +708,8 @@
33+
#undef OVERFLOW
3434

3535
-#if defined(DART_HOST_OS_ANDROID)
3636
+#if defined(DART_HOST_OS_ANDROID) && defined(__TERMUX__)
@@ -40,10 +40,10 @@ index 124b85be..4e513a6c 100644
4040
#elif defined(DART_HOST_OS_FUCHSIA)
4141
#define kHostOperatingSystemName "fuchsia"
4242
diff --git a/runtime/vm/os_android.cc b/runtime/vm/os_android.cc
43-
index b60658c4..aa0dcb8d 100644
43+
index a5cf6b52..00000000 100644
4444
--- a/runtime/vm/os_android.cc
4545
+++ b/runtime/vm/os_android.cc
46-
@@ -32,7 +32,7 @@ namespace dart {
46+
@@ -30,7 +30,7 @@ namespace dart {
4747

4848
DEFINE_FLAG(bool,
4949
android_log_to_stderr,
@@ -52,7 +52,8 @@ index b60658c4..aa0dcb8d 100644
5252
"Send Dart VM logs to stdout and stderr instead of the Android "
5353
"system logs.");
5454

55-
@@ -53,7 +53,7 @@ class PerfCodeObserver : public CodeObserver {
55+
@@ -49,7 +49,7 @@ class PerfCodeObserver : public CodeObserver {
56+
if (file_open == nullptr) {
5657
return;
5758
}
5859
intptr_t pid = getpid();
@@ -62,15 +63,18 @@ index b60658c4..aa0dcb8d 100644
6263
free(filename);
6364
}
6465
diff --git a/sdk/lib/_internal/vm/bin/process_patch.dart b/sdk/lib/_internal/vm/bin/process_patch.dart
65-
index a43770f6..208b4894 100644
66+
index 7c458430..00000000 100644
6667
--- a/sdk/lib/_internal/vm/bin/process_patch.dart
6768
+++ b/sdk/lib/_internal/vm/bin/process_patch.dart
68-
@@ -331,7 +331,7 @@ base class _ProcessImpl extends _ProcessImplNativeWrapper implements _Process {
69+
@@ -287,10 +287,10 @@ base class _ProcessImpl extends _ProcessImplNativeWrapper implements _Process {
70+
static String _getShellCommand() {
6971
if (Platform.isWindows) {
7072
return 'cmd.exe';
7173
}
72-
- return '/bin/sh';
73-
+ return '/data/data/com.termux/files/usr/bin/sh';
74+
if (Platform.isAndroid) {
75+
- return '/system/bin/sh';
76+
+ return '/data/data/com.termux/files/usr/bin/sh';
77+
}
78+
return '/bin/sh';
7479
}
7580

76-
static List<String> _getShellArguments(

test_build.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ def test_configure_uses_configured_api_and_termux_stub_includes(self, run):
5757
def test_default_build_modes_cover_packaged_variants(self):
5858
self.assertEqual(self.instance.mode, ['debug'])
5959

60+
def test_dart_patches_are_kept_in_sync_for_flutter_3_44_0(self):
61+
patch_dir = os.path.join(os.path.dirname(__file__), 'patches')
62+
with open(os.path.join(patch_dir, 'dart.patch'), encoding='utf-8') as f:
63+
dart_patch = f.read()
64+
with open(os.path.join(patch_dir, 'dart.new.patch'), encoding='utf-8') as f:
65+
dart_new_patch = f.read()
66+
67+
self.assertEqual(dart_patch, dart_new_patch)
68+
self.assertIn(
69+
'+ ProcessResult result = Process.runSync("/data/data/com.termux/files/usr/bin/sh", [',
70+
dart_patch,
71+
)
72+
self.assertIn('+#if defined(DART_HOST_OS_ANDROID) && defined(__TERMUX__)', dart_patch)
73+
self.assertIn("+ return '/data/data/com.termux/files/usr/bin/sh';", dart_patch)
74+
6075
def test_engine_patch_contains_termux_build_fixes(self):
6176
patch_file = os.path.join(os.path.dirname(__file__), 'patches', 'engine.patch')
6277
with open(patch_file, encoding='utf-8') as f:

0 commit comments

Comments
 (0)