Skip to content

Commit

Permalink
Support rules_apple version 3.1.1.
Browse files Browse the repository at this point in the history
* Updated the Qt rules with `apple_dynamic_framework_import`.
* Updated `tweak_installer_files.py` to follow the above updates.
* This will fix the build failure on macOS.

#codehealth

PiperOrigin-RevId: 592352480
  • Loading branch information
hiroyuki-komatsu committed Dec 19, 2023
1 parent da18015 commit 4dd0440
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
32 changes: 16 additions & 16 deletions src/bazel/BUILD.qt.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,43 +57,43 @@ cc_library(
apple_dynamic_framework_import(
name = "QtCore_mac",
framework_imports = glob(
include = [
"lib/QtCore.framework/Versions/A/QtCore",
"lib/QtCore.framework/QtCore",
"lib/QtCore.framework/Resoures/**",
include = ["lib/QtCore.framework/**"],
exclude = [
"lib/QtCore.framework/Headers/**",
"lib/QtCore.framework/Versions/A/Headers/**",
],
),
)

apple_dynamic_framework_import(
name = "QtGui_mac",
framework_imports = glob(
include = [
"lib/QtGui.framework/Versions/A/QtGui",
"lib/QtGui.framework/QtGui",
"lib/QtGui.framework/Resoures/**",
include = ["lib/QtGui.framework/**"],
exclude = [
"lib/QtGui.framework/Headers/**",
"lib/QtGui.framework/Versions/A/Headers/**",
],
),
)

apple_dynamic_framework_import(
name = "QtPrintSupport_mac",
framework_imports = glob(
include = [
"lib/QtPrintSupport.framework/Versions/A/QtPrintSupport",
"lib/QtPrintSupport.framework/QtPrintSupport",
"lib/QtPrintSupport.framework/Resoures/**",
include = ["lib/QtPrintSupport.framework/**"],
exclude = [
"lib/QtPrintSupport.framework/Headers/**",
"lib/QtPrintSupport.framework/Versions/A/Headers/**",
],
),
)

apple_dynamic_framework_import(
name = "QtWidgets_mac",
framework_imports = glob(
include = [
"lib/QtWidgets.framework/Versions/A/QtWidgets",
"lib/QtWidgets.framework/QtWidgets",
"lib/QtWidgets.framework/Resoures/**",
include = ["lib/QtWidgets.framework/**"],
exclude = [
"lib/QtWidgets.framework/Headers/**",
"lib/QtWidgets.framework/Versions/A/Headers/**",
],
),
)
Expand Down
11 changes: 9 additions & 2 deletions src/mac/tweak_installer_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,23 @@ def SymlinkQtFrameworks(app_dir: str) -> None:
framework_dir = os.path.join(app_dir,
f'Contents/Frameworks/{framework}.framework/')

# Restore symlinks. Bazel uses zip without consideration of symlinks.
# It changes symlink files to normal files. The following logics remove
# those normal files and make symlinks again.

# rm {app_dir}/QtCore.framework/Versions/Current
# ln -s A {app_dir}/QtCore.framework/Versions/Current
os.remove(framework_dir + 'Versions/Current')
os.symlink('A', framework_dir + 'Versions/Current')

# rm {app_dir}/QtCore.framework/QtCore
os.remove(framework_dir + framework)

# ln -s Versions/Current/QtCore {app_dir}/QtCore.framework/QtCore
os.remove(framework_dir + framework)
os.symlink('Versions/Current/' + framework, framework_dir + framework)

# rm {app_dir}/QtCore.framework/Resources
# ln -s Versions/Current/Resources {app_dir}/QtCore.framework/Resources
os.remove(framework_dir + 'Resources')
os.symlink('Versions/Current/Resources', framework_dir + 'Resources')


Expand Down

0 comments on commit 4dd0440

Please sign in to comment.