Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multi channel release on Windows #85

Merged
merged 6 commits into from Apr 11, 2018
Merged

Support multi channel release on Windows #85

merged 6 commits into from Apr 11, 2018

Conversation

@simonhong
Copy link
Collaborator

simonhong commented Apr 5, 2018

Use different user dir and app icon on Windows.
To do this, some dependency rule is refactored in first commit.
Please see each commit's description.

Issue: brave/brave-browser#10

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
@simonhong simonhong self-assigned this Apr 5, 2018
@simonhong simonhong requested a review from bbondy Apr 5, 2018
@simonhong simonhong changed the title Cleanup install_static modules Cleanup install_static_util modules Apr 5, 2018
@simonhong simonhong requested a review from AlexeyBarabash Apr 5, 2018
L"BraveDeveloper", // A distinct base_app_id.
L"BraveDelveloperHTM", // ProgID prefix.
L"Brave Developer HTML Document", // ProgID description.
L"{7D2B3E1D-D096-4594-9D8F-A6667F12E0AC}", // Active Setup GUID.

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 5, 2018

Author Collaborator

Just copied guids from upstream. which value should I use?

This comment has been minimized.

Copy link
@bbondy

bbondy Apr 5, 2018

Member

You should use the ones above as I created all new IDs for them.

This comment has been minimized.

Copy link
@bbondy

bbondy Apr 5, 2018

Member

And made sure other places that used those IDs were also updated.

This comment has been minimized.

Copy link
@bbondy

bbondy Apr 5, 2018

Member

I think when we compile with no brave chromium override we could skip the cc_wrapper check for override files. That way we don't need to maintain separate chrome stuff in our src/brave dir.

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 6, 2018

Author Collaborator

Oops.. I didn't know about our cc_wrapper.
That script replaces original file with our files when same file exists.
So, my thought was wrong - I changed PR description.

install_static_util target includes our version and other targets that depends on //brave:browser_dependencies also includes ours , too.

I want to make only install_static_util target dependent on our chromium_install_modes.* files.
We should make install_static_util depends on directly our chromium_install_modes files.
If not, that target build isn't triggered by modifying our files.

I'm not sure another ways is exists to solve this problem.

Regarding to guid, should I use one of IDs above you created in official build guard? or need to generate new one?

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 6, 2018

Author Collaborator

When we use our redirect-cc.py, there is one problem - dependency check.
To trigger re-build, original file should be touched if we don't add additional dependency.
In install_static_util case, we added another dependency to brave:browser_dependencies.
How about making dependency directly to the target like below instead of using cc-wrapper?

else {
  if (brave_chromium_build) {
    sources += [
      "//brave/chromium_src/chrome/install_static/chromium_install_modes.cc",
      "//brave/chromium_src/chrome/install_static/chromium_install_modes.h",
    ]
  } else {
    sources += [
      "chromium_install_modes.cc",
      "chromium_install_modes.h",
    ]
  }

With this, I think we don't need to introduce another dependency and can know dependency easily instead of adding another dependencies into some other places.
I think this kind of modification can be rebased easily.

This comment has been minimized.

Copy link
@bbondy

bbondy Apr 6, 2018

Member

Regarding to guid, should I use one of IDs above you created in official build guard? or need to generate new one?

No they were already all newly generated, no need to generate any new IDs here.

This comment has been minimized.

Copy link
@bbondy

bbondy Apr 6, 2018

Member

Good point about the dependencies. The whole reason to introduce cc_wrapper hack was to avoid having to patch extra gn files with the real source path though. Maybe we can just have the dev changing these files touch the original ones too, the overrides should very rarely be used.

@bridiver thoughts?

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 7, 2018

Author Collaborator

@bbondy , updated. Please check again.
In addition, I added some missed dependency of our copied chrome_icon_resources_win.h.

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

I think in an ideal world we would have a way to reference gn targets and add/remove source files without actually modifying them. For the cc_wrapper files we can create a dummy script target and mark them as inputs to a no-op script or something like that

@simonhong simonhong force-pushed the cleanup_install_mode branch 2 times, most recently from 1f6643d to d285aef Apr 7, 2018
So far, install_static_util target doesn't have dependency to our
copied chromium_install_mode.[cc|h].
This cl makes install_static_util traget only have dependency to
our copied files.
If we don't make install_static_util target depend on directly
copied files, that target rebuild isn't triggered when we only
touches our copied file.
Also, add missing chrome_icon_resources_win.h dependency.

Duplicated chromium_src/common/chrome_icon_resources_win.h is
removed and unused changes in upstream chromium_install_mode.cc is
deleted.
@simonhong simonhong force-pushed the cleanup_install_mode branch from d285aef to 059ad0d Apr 7, 2018
simonhong added 2 commits Apr 9, 2018
To show properly, dll name is changed to brave.
Also, chrome_dll.rc file is copied to brave_dll.rc
Use Brave-Browser-XXX style for each release channel.
@simonhong simonhong changed the title Cleanup install_static_util modules Support multi channel release on Windows Apr 9, 2018
@simonhong simonhong requested a review from darkdh Apr 9, 2018
+ brand = "$branding_path_component"
+
+ if (brave_chromium_build && !is_official_build) {
+ brand = brand + "-development"

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

I don't think this is going to be sufficient because we'll also have beta, etc.. why wouldn't we just modify the branding_path_component in the args.gn?

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 9, 2018

Author Collaborator

Upstream chrome uses two kinds of brand strings - google_chrome and chromium.
For specific channel support like beta or dev, they handled under google_chrome.
So, I think introducing brave-development or similar name for unofficial build.
We should cleanup/refactoring to use both 'braveandbrave-development` in other places.

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

ok, I think I understand what you're trying to do here, but I still think we should modify the branding_path_component here https://github.com/brave/brave-browser/blob/master/lib/config.js#L51 like we do in muon. It was only commented out as a temporary workaround and I'm not sure that it's a good idea to modify it here

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 9, 2018

Author Collaborator

Yep, I agree with you.
How about cleanup/refactoring it as a separate PR?
If we change branding_path_component in args.gn for now, many places would be broken such as brave_strings.grd and mostly under app/theme/.

In the separate PR, we can start it by below in chrome_build.gni

if (brave_chromium_build) {
  if (is_official_build) {
    branding_path_component = "brave"
  } else {
    branding_path_component = "brave-development' # or "brave-dev"
  }
} else {
  if (is_chrome_branded) {
    branding_path_component = "google_chrome"
  } else {
    branding_path_component = "chromium"
  }
}

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

can you create an issue for it and I'll remove the "changes requested"?

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 9, 2018

Author Collaborator

brave/brave-browser#153 is created for it.

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

looks like I can't directly remove my request for changes, so just ignore it :)

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 9, 2018

Author Collaborator

@bridiver , can you confirm this PR? or should I wait more from other reviewers?

Copy link
Collaborator

bridiver left a comment

see branding_path_component comment

@simonhong simonhong force-pushed the cleanup_install_mode branch from eecd6f5 to 4a10340 Apr 9, 2018
"app/chrome_main.cc",
"app/chrome_main_delegate.cc",
"app/chrome_main_delegate.h",
+ "//brave/app/brave_main_delegate.cc",
+ "//brave/app/brave_main_delegate.h",
]

output_name = "chrome"
@@ -475,6 +479,8 @@ if (is_win) {
- output_name = "chrome"

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

I thought we had most of this stuff sorted out already? We left the name as chrome early on to avoid other issues and renamed later I think. @AlexeyBarabash I think you did the earlier work on this?

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 9, 2018

Author Collaborator

I tested on official/unofficial/component build with this change and and works well :)

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

if this isn't already handled by @AlexeyBarabash's work, I'd still prefer to rename in a brave build step vs patching here, again unless there is some other compelling reason to change it

@@ -35,3 +35,16 @@ index 3f65aa27ca38e9721493b4e3fe7a40593ab75e0b..e5a8172dbafdd3982e4ed50de1770fbd
]

if (enable_hidpi) {
@@ -270,7 +273,11 @@ template("generate_mini_installer") {

generate_mini_installer("mini_installer") {

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

Do we need to make this change? I don't think we care if the filename is chrome.dll vs brave.dll. If that's the only reason we are changing it then I think we should leave it alone, or is there something else?

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

I think there are also more references to chrome.dll and chrome_child.dll that will break with this change.

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 9, 2018

Author Collaborator

Yep, it would be happen if we try to build all targets. I just tested only brave target.
I'll revert to use chrome.dll.

-const wchar_t kChromeOldExe[] = L"old_chrome.exe";
+#if defined(BRAVE_CHROMIUM_BUILD)
+const wchar_t kChromeDll[] = L"brave.dll";
+const wchar_t kChromeChildDll[] = L"brave_child.dll";
+const wchar_t kChromeExe[] = L"brave.exe";
+const wchar_t kChromeNewExe[] = L"new_brave.exe";

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

I don't see any reason to patch the old/new exes because they get renamed. Only the final brave.exe matters

This comment has been minimized.

Copy link
@simonhong

simonhong Apr 9, 2018

Author Collaborator

Yep, I also don't care about the name of dll.
If we only want to use brave.exe, I'll revert them to chrome.dll and chrome_child.dll.

-const wchar_t kChromeOldExe[] = L"old_chrome.exe";
+#if defined(BRAVE_CHROMIUM_BUILD)
+const wchar_t kChromeDll[] = L"brave.dll";
+const wchar_t kChromeChildDll[] = L"brave_child.dll";

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

Same thing here with chrome/brave. Unless there is a compelling reason to rename these dlls I don't think we should

//
#include "../../chrome/app/chrome_dll_resource.h"
#include "../../chrome/app/chrome_command_ids.h"
#include "brave_command_ids.h"

This comment has been minimized.

Copy link
@bridiver

bridiver Apr 9, 2018

Collaborator

I believe brave_command_ids.h is included in chrome_command_ids.h and only contains brave-specific ids so most of the ones listed here won't be there. This is one of the few cases where I think it's better to patch (vs large-scale copying)

simonhong added 2 commits Apr 10, 2018
Files that have _win suffix is removed from source list implicitly.
So, is_win check is needed when we want to subtract file that has _win
suffix from source list.
@simonhong
Copy link
Collaborator Author

simonhong commented Apr 10, 2018

All comments are addressed.

@bbondy
bbondy approved these changes Apr 11, 2018
@bbondy bbondy merged commit 702f616 into master Apr 11, 2018
@simonhong simonhong deleted the cleanup_install_mode branch Apr 11, 2018
@bridiver

This comment has been minimized.

Copy link
Collaborator

bridiver commented on patches/chrome-common-BUILD.gn.patch in 059ad0d Jun 13, 2018

this patch is not needed. The header file in chromium_src will automatically override the one in src/chrome

This comment has been minimized.

Copy link
Collaborator Author

simonhong replied Jun 13, 2018

IIRU, dependency problem was happened. I'll check this again!

@bridiver

This comment has been minimized.

Copy link
Collaborator

bridiver commented on patches/chrome-install_static-BUILD.gn.patch in 059ad0d Jun 13, 2018

this is also not necessary for the same reason as above

NejcZdovc added a commit that referenced this pull request Dec 10, 2018
ignore validation errors for testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.