Skip to content

Commit

Permalink
ci: auto-3way patches and detect changes (#23034)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Apr 8, 2020
1 parent 15c60ba commit 9a058fb
Show file tree
Hide file tree
Showing 31 changed files with 349 additions and 385 deletions.
31 changes: 26 additions & 5 deletions .circleci/config.yml
Expand Up @@ -208,11 +208,30 @@ step-gclient-sync: &step-gclient-sync
# If we did not restore a complete sync then we need to sync for realz
if [ ! -s "src/electron/.circle-sync-done" ]; then
gclient config \
--name "src/electron" \
--unmanaged \
$GCLIENT_EXTRA_ARGS \
"$CIRCLE_REPOSITORY_URL"
gclient sync --with_branch_heads --with_tags
--name "src/electron" \
--unmanaged \
$GCLIENT_EXTRA_ARGS \
"$CIRCLE_REPOSITORY_URL"
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags
# Re-export all the patches to check if there were changes.
python src/electron/script/export_all_patches.py src/electron/patches/common/config.json
cd src/electron
git update-index --refresh || true
if ! git diff-index --quiet HEAD --; then
# There are changes to the patches. Make a git commit with the updated patches
git add patches
GIT_COMMITTER_NAME="Electron Bot" GIT_COMMITTER_EMAIL="anonymous@electronjs.org" git commit -m "update patches" --author="Electron Bot <anonymous@electronjs.org>"
# Export it
mkdir -p ../../patches
git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
echo
echo "======================================================================"
echo "There were changes to the patches when applying."
echo "Check the CI artifacts for a patch you can apply to fix it."
echo "======================================================================"
exit 1
fi
fi
step-setup-env-for-build: &step-setup-env-for-build
Expand Down Expand Up @@ -747,6 +766,8 @@ steps-checkout-fast: &steps-checkout-fast
- *step-set-git-cache-path
# This sync call only runs if .circle-sync-done is an EMPTY file
- *step-gclient-sync
- store_artifacts:
path: patches
# These next few steps reset Electron to the correct commit regardless of which cache was restored
- run:
name: Wipe Electron
Expand Down
2 changes: 2 additions & 0 deletions DEPS
Expand Up @@ -154,3 +154,5 @@ hooks = [
recursedeps = [
'src',
]

# Touch DEPS to bust cache
2 changes: 1 addition & 1 deletion patches/common/chromium/browser_compositor_mac.patch
Expand Up @@ -29,7 +29,7 @@ diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/cont
index 4b3f3c7e97e73ad6d0166ad114f4168d9ed00e11..59e58d693c971742951434f6582140d9179235f2 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.mm
+++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -80,6 +80,12 @@
@@ -80,6 +80,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
DCHECK_EQ(1u, num_erased);
}

Expand Down
114 changes: 0 additions & 114 deletions patches/common/chromium/cherry-pick-db71a0afc1d0.patch

This file was deleted.

6 changes: 3 additions & 3 deletions patches/common/chromium/command-ismediakey.patch
Expand Up @@ -100,7 +100,7 @@ index f4e3126a4efd66f05c4f13e40ba23db10b8cca96..9232dda3fc82d9ad56fef96a25993121
}
return VKEY_UNKNOWN;
}
@@ -193,7 +200,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
@@ -193,7 +200,10 @@ CGEventRef MediaKeysListenerImpl::EventTapCallback(CGEventTapProxy proxy,
int key_code = (data1 & 0xFFFF0000) >> 16;
if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&
Expand All @@ -112,15 +112,15 @@ index f4e3126a4efd66f05c4f13e40ba23db10b8cca96..9232dda3fc82d9ad56fef96a25993121
return event;
}

@@ -224,6 +234,7 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
@@ -224,6 +234,7 @@ std::unique_ptr<MediaKeysListener> MediaKeysListener::Create(
// For Mac OS 10.12.2 or later, we want to use MPRemoteCommandCenter for
// getting media keys globally if there is a RemoteCommandCenterDelegate
// available.
+#if !BUILDFLAG(ENABLE_MEDIA_KEY_OVERRIDES)
if (@available(macOS 10.12.2, *)) {
if (scope == Scope::kGlobal &&
now_playing::RemoteCommandCenterDelegate::GetInstance()) {
@@ -233,6 +244,7 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
@@ -233,6 +244,7 @@ std::unique_ptr<MediaKeysListener> MediaKeysListener::Create(
return std::move(listener);
}
}
Expand Down
Expand Up @@ -9,7 +9,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont
index 2b10c5b8f6d4a7a091ef3dd9d8ff324e5663f768..477cef4973bc4f2d50aa173571fc1d2bcd0a6469 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -485,7 +485,12 @@
@@ -485,7 +485,12 @@ void RenderWidgetHostViewMac::WasUnOccluded() {

void RenderWidgetHostViewMac::WasOccluded() {
host()->WasHidden();
Expand Down
18 changes: 9 additions & 9 deletions patches/common/chromium/fix_hi-dpi_transitions_on_catalina.patch
Expand Up @@ -48,7 +48,7 @@ diff --git a/components/remote_cocoa/app_shim/bridged_native_widget_impl.mm b/co
index 402b6099126e0ac8dd3b6be5c0ffb1a1946dc139..c6b03fe02d9228bc22b9343687ea845c77c47d8d 100644
--- a/components/remote_cocoa/app_shim/bridged_native_widget_impl.mm
+++ b/components/remote_cocoa/app_shim/bridged_native_widget_impl.mm
@@ -310,9 +310,11 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
@@ -310,9 +310,11 @@ BridgedNativeWidgetImpl::BridgedNativeWidgetImpl(
bridge_mojo_binding_(this) {
DCHECK(GetIdToWidgetImplMap().find(id_) == GetIdToWidgetImplMap().end());
GetIdToWidgetImplMap().insert(std::make_pair(id_, this));
Expand All @@ -60,7 +60,7 @@ index 402b6099126e0ac8dd3b6be5c0ffb1a1946dc139..c6b03fe02d9228bc22b9343687ea845c
// The delegate should be cleared already. Note this enforces the precondition
// that -[NSWindow close] is invoked on the hosted window before the
// destructor is called.
@@ -1102,7 +1104,17 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
@@ -1102,7 +1104,17 @@ remote_cocoa::DragDropClient* BridgedNativeWidgetImpl::drag_drop_client() {
}

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -83,7 +83,7 @@ diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168706b3f33 100644
--- a/ui/display/mac/screen_mac.mm
+++ b/ui/display/mac/screen_mac.mm
@@ -31,8 +31,8 @@
@@ -31,8 +31,8 @@ Boolean CGDisplayUsesForceToGray(void);
namespace display {
namespace {

Expand All @@ -94,7 +94,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168
const int64_t kConfigureDelayMs = 500;

NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) {
@@ -155,20 +155,27 @@ CGFloat GetMinimumDistanceToCorner(const NSPoint& point, NSScreen* screen) {
@@ -155,20 +155,27 @@ class ScreenMac : public Screen {
CGDisplayRegisterReconfigurationCallback(
ScreenMac::DisplayReconfigurationCallBack, this);

Expand Down Expand Up @@ -126,7 +126,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168

CGDisplayRemoveReconfigurationCallback(
ScreenMac::DisplayReconfigurationCallBack, this);
@@ -193,16 +200,18 @@ bool IsWindowUnderCursor(gfx::NativeWindow native_window) override {
@@ -193,16 +200,18 @@ class ScreenMac : public Screen {
int GetNumDisplays() const override { return GetAllDisplays().size(); }

const std::vector<Display>& GetAllDisplays() const override {
Expand All @@ -147,7 +147,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168
if (!window)
return GetPrimaryDisplay();

@@ -275,31 +284,30 @@ void RemoveObserver(DisplayObserver* observer) override {
@@ -275,31 +284,30 @@ class ScreenMac : public Screen {
static void DisplayReconfigurationCallBack(CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void* userInfo) {
Expand Down Expand Up @@ -189,7 +189,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168
if (displays_require_update_) {
displays_ = BuildDisplaysFromQuartz();
displays_require_update_ = false;
@@ -307,7 +315,7 @@ void EnsureDisplaysValid() const {
@@ -307,7 +315,7 @@ class ScreenMac : public Screen {
}

void ConfigureTimerFired() {
Expand All @@ -198,7 +198,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168
change_notifier_.NotifyDisplaysChanged(old_displays_, displays_);
old_displays_ = displays_;
}
@@ -321,7 +329,7 @@ void ConfigureTimerFired() {
@@ -321,7 +329,7 @@ class ScreenMac : public Screen {
// It would be ridiculous to have this many displays connected, but
// CGDirectDisplayID is just an integer, so supporting up to this many
// doesn't hurt.
Expand All @@ -207,7 +207,7 @@ index 463ff7105ac329cafed793fd87cfc8423e0a0ed7..6b5424c3dae77585bc95b2da48d20168
CGDisplayCount online_display_count = 0;
if (CGGetOnlineDisplayList(base::size(online_displays), online_displays,
&online_display_count) != kCGErrorSuccess) {
@@ -357,21 +365,32 @@ void ConfigureTimerFired() {
@@ -357,21 +365,32 @@ class ScreenMac : public Screen {
: displays;
}

Expand Down
Expand Up @@ -32,7 +32,7 @@ diff --git a/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge_loc
index 2aa04c3764e6361fccec7ba47feb51fa40d99d3b..6bea303d86447f8a1311c67e183b4724b2e802e8 100644
--- a/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge_local.mm
+++ b/content/app_shim_remote_cocoa/render_widget_host_ns_view_bridge_local.mm
@@ -185,9 +185,11 @@
@@ -185,9 +185,11 @@ void RenderWidgetHostNSViewBridgeLocal::CancelComposition() {
[cocoa_view_ cancelComposition];
}

Expand Down Expand Up @@ -79,15 +79,15 @@ index 46fcb918f42654ec1d7d2c5c5ea70e4a402dede1..2815129bd44643fea242977a7f7dcf9d
#include "ui/accessibility/platform/ax_platform_node.h"
#import "ui/base/clipboard/clipboard_util_mac.h"
#import "ui/base/cocoa/appkit_utils.h"
@@ -190,6 +191,7 @@ - (void)candidateListTouchBarItem:(NSCandidateListTouchBarItem*)anItem
@@ -190,6 +191,7 @@ void ExtractUnderlines(NSAttributedString* string,
@implementation RenderWidgetHostViewCocoa
@synthesize markedRange = markedRange_;
@synthesize textInputType = textInputType_;
+@synthesize textInputFlags = textInputFlags_;
@synthesize spellCheckerForTesting = spellCheckerForTesting_;

- (id)initWithClient:(RenderWidgetHostNSViewClient*)client
@@ -1945,7 +1947,9 @@ - (void)invalidateTouchBar {
@@ -1945,7 +1947,9 @@ extern NSString* NSTextInputReplacementRangeAttributeName;

- (NSTouchBar*)makeTouchBar {
if (textInputType_ != ui::TEXT_INPUT_TYPE_NONE &&
Expand All @@ -102,7 +102,7 @@ diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/cont
index 477cef4973bc4f2d50aa173571fc1d2bcd0a6469..2ad881d2dd3bec1de545eaab29b69c12a05bbfe2 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -566,7 +566,11 @@
@@ -566,7 +566,11 @@ void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled(
if (!did_update_state)
return;

Expand All @@ -115,7 +115,7 @@ index 477cef4973bc4f2d50aa173571fc1d2bcd0a6469..2ad881d2dd3bec1de545eaab29b69c12

// |updated_view| is the last view to change its TextInputState which can be
// used to start/stop monitoring composition info when it has a focused
@@ -582,7 +586,6 @@
@@ -582,7 +586,6 @@ void RenderWidgetHostViewMac::OnUpdateTextInputStateCalled(

// Set the monitor state based on the text input focus state.
const bool has_focus = HasFocus();
Expand Down
6 changes: 3 additions & 3 deletions patches/common/chromium/mas-cfisobjc.patch
Expand Up @@ -9,15 +9,15 @@ diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 8b20ebc678c39b722bd5b03930ce89847e8cc73a..dca8c939e757003aafc1528ec7bbb739bf971fa6 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -26,7 +26,6 @@
@@ -26,7 +26,6 @@ CFTypeID SecKeyGetTypeID();
#if !defined(OS_IOS)
CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID();
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
#endif
} // extern "C"

@@ -315,8 +314,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
@@ -315,8 +314,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) {
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
DCHECK(!cf_val ||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
Expand All @@ -27,7 +27,7 @@ index 8b20ebc678c39b722bd5b03930ce89847e8cc73a..dca8c939e757003aafc1528ec7bbb739
return ns_val;
}

@@ -384,9 +382,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
@@ -384,9 +382,6 @@ CFCast<CTFontRef>(const CFTypeRef& cf_val) {
return (CTFontRef)(cf_val);
}

Expand Down
6 changes: 3 additions & 3 deletions patches/common/chromium/mas_blink_no_private_api.patch
Expand Up @@ -18,7 +18,7 @@ index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..2ec7f04c71824b47de1ddbf1f0e8625d
extern "C" {

// Kill ring calls. Would be better to use NSKillRing.h, but that's not
@@ -39,38 +40,53 @@
@@ -39,38 +40,53 @@ NSString* _NSYankFromKillRing();
void _NSNewKillRingSequence();
void _NSSetKillRingToYankedState();
}
Expand Down Expand Up @@ -92,7 +92,7 @@ index e965faf9fd8d5ec3572d769421f149907d66c67f..b2d0bbd80994fdf9607009d9e27bf4c3

namespace blink {

@@ -72,10 +74,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
@@ -72,10 +74,12 @@ bool ThemePainterMac::PaintTextField(const Node* node,
// behavior change while remaining a fragile solution.
// https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3
if (!use_ns_text_field_cell) {
Expand All @@ -105,7 +105,7 @@ index e965faf9fd8d5ec3572d769421f149907d66c67f..b2d0bbd80994fdf9607009d9e27bf4c3
return false;
}

@@ -161,10 +165,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
@@ -161,10 +165,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node,
const PaintInfo& paint_info,
const IntRect& r) {
LocalCurrentGraphicsContext local_context(paint_info.context, r);
Expand Down

0 comments on commit 9a058fb

Please sign in to comment.