-
Notifications
You must be signed in to change notification settings - Fork 885
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
Fix update branding logic to make release builds faster #16033
Conversation
22dbb3a
to
3f7f9e9
Compare
5341f4d
to
67940dc
Compare
console.log('copy branding file') | ||
fs.copySync(brandingSource, brandingDest) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was always rewriting BRANDING
and icns
files, which triggered unnecessary rebuilds during create_dist
in non-development channels.
the logic was:
- rewrite all files using fileMap by comparing timestamps/checksums, which always restored "development" files.
- rewrite BRANDING and icns on top, using
config.channel
value.
now we use channel-specific files without unnecessary overwrites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
running npm run test ...
without first running npm run build ...
fails now
ninja: Entering directory `/Volumes/brave/src/out/Component'
ninja: error: '../../components/vector_icons/brave/product_refresh.icon', needed by 'gen/components/vector_icons/vector_icons.cc', missing and no known rule to make it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
running
npm run test ...
without first runningnpm run build ...
fails nowninja: Entering directory `/Volumes/brave/src/out/Component' ninja: error: '../../components/vector_icons/brave/product_refresh.icon', needed by 'gen/components/vector_icons/vector_icons.cc', missing and no known rule to make it
yes, that was always the case. npm run test
also never calls gn gen
, so you had to call npm run build
at least once to prepare everything. I usually do npm run build -- --target=base
before running some test on a fresh checkout.
to fix this we need to have the right branding dependency done via GN, hopefully this task will align what we have in the right direction: brave/brave-browser#38309
|
// Set proper mac app icon for channel to chrome/app/theme/mac/app.icns. | ||
// Each channel's app icons are stored in brave/app/theme/$channel/app.icns. | ||
// With this copying, we don't need to modify chrome/BUILD.gn for this. | ||
const iconSource = path.join(braveAppDir, 'theme', 'brave', 'mac', config.channel, 'app.icns') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't we just copying all channels here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
source file depends on the channel, but the destination file does not.
|
||
// Set proper branding file. | ||
let branding_file_name = 'BRANDING' | ||
if (config.channel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, we should always copy all the files or this is not accurate #16033 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we remove the channel dependency here then we can update the branding at sync time and only update on build when needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. The destination file is a single file, it doesn't depend on the channel, so we can't copy "all the files" into the same destination file..
I have a task to rework this: brave/brave-browser#38309
Currently MacOS tests in release branches fallback to development branding, which is incorrect.
This happens because
config.channel
isdevelopment
in tests. Regression from: #13597This PR:
updateBranding()
call fornpm run test
.util.touchOverriddenFiles()
tocreate_dist
command as it's used as a default build command in Android PR builds. This should be a no-op in most scenarios. If it's not, then we'd better fix those scenarios.BRANDING
,app.icns
rewrites when--channel
is passed.Resolves brave/brave-browser#26869
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: