Always copy Assets.car, app.icns to avoid mac rebuilds. (#33931)

* Always copy Assets.car, app.icns to avoid cross-platform rebuilds.

* Rename explicitSourceFiles to be clearer what is it for.
This commit is contained in:
Aleksei Khoroshilov
2026-02-18 15:51:13 +07:00
committed by GitHub
parent bfda34591d
commit 91f416237f
+44 -45
View File
@@ -242,7 +242,8 @@ exports.update = () => {
),
])
let explicitSourceFiles = new Set()
// When the channel is set, we need to copy the channel-specific files.
let channelSpecificSourceFiles = new Set()
for (const branding of ['brave', 'brave_origin']) {
// Set proper branding file.
const brandingSource = path.join(
@@ -252,51 +253,49 @@ exports.update = () => {
'BRANDING' + (config.channel ? `.${config.channel}` : ''),
)
const brandingDest = path.join(chromeAppDir, 'theme', branding, 'BRANDING')
explicitSourceFiles[brandingDest] = brandingSource
channelSpecificSourceFiles[brandingDest] = brandingSource
if (config.targetOS === 'mac') {
// 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',
branding,
'mac',
config.channel,
'app.icns',
)
const iconDest = path.join(
chromeAppDir,
'theme',
branding,
'mac',
'app.icns',
)
explicitSourceFiles[iconDest] = iconSource
// 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',
branding,
'mac',
config.channel,
'app.icns',
)
const iconDest = path.join(
chromeAppDir,
'theme',
branding,
'mac',
'app.icns',
)
channelSpecificSourceFiles[iconDest] = iconSource
// Set proper mac app asset catalog for channel to
// chrome/app/theme/mac/Assets.car. Each channel's resource catalog is
// stored in brave/app/theme/$channel/Assets.car. With this copying, we
// don't need to modify chrome/BUILD.gn for this.
const assetCatalogSource = path.join(
braveAppDir,
'theme',
branding,
'mac',
config.channel,
'Assets.car',
)
const assetCatalogDest = path.join(
chromeAppDir,
'theme',
branding,
'mac',
'Assets.car',
)
explicitSourceFiles[assetCatalogDest] = assetCatalogSource
}
// Set proper mac app asset catalog for channel to
// chrome/app/theme/mac/Assets.car. Each channel's resource catalog is
// stored in brave/app/theme/$channel/Assets.car. With this copying, we
// don't need to modify chrome/BUILD.gn for this.
const assetCatalogSource = path.join(
braveAppDir,
'theme',
branding,
'mac',
config.channel,
'Assets.car',
)
const assetCatalogDest = path.join(
chromeAppDir,
'theme',
branding,
'mac',
'Assets.car',
)
channelSpecificSourceFiles[assetCatalogDest] = assetCatalogSource
}
for (const [source, output] of fileMap) {
@@ -324,7 +323,7 @@ exports.update = () => {
output,
path.relative(source, sourceFile),
)
sourceFile = explicitSourceFiles[destinationFile] || sourceFile
sourceFile = channelSpecificSourceFiles[destinationFile] || sourceFile
if (
!fs.existsSync(destinationFile)
|| util.calculateFileChecksum(sourceFile)