简体   繁体   中英

Building iOS app with Bazel fails on iOS version

I am learning bazel. In my ios_application rule there is this line:

minimum_os_version = "14.5"

and in my.bazelrc there are these lines:

build \
  --apple_platform_type=ios \
  --xcode_version=13.4.1 \
  --ios_minimum_os=14.5 \
  --ios_simulator_device="iPhone 13" \
  --ios_simulator_version=15.5 \

When I build it with bazel build //:App, it gives me these errors like

ContentView.swift:11:6: error: 'ObservedObject' is only available in iOS 13.0 or newer , as if I am building with a lower version of iOS than 13.0

any idea what the problem could be?

Error log:

INFO: Analyzed target //XcodeBenchmark:App (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /Users/tahabebek/BazelEd/BenchmarkProjects/XcodeBenchmark/XcodeBenchmark/Screen5/BUILD.bazel:3:14: Compiling Swift module //XcodeBenchmark/Screen5:Screen5 failed: (Exit 1): worker failed: error executing command
  (cd /private/var/tmp/_bazel_tahabebek/ea06894acf9e8d0a18b7c9fce25481e4/execroot/__main__ && \
  exec env - \
    APPLE_SDK_PLATFORM=iPhoneSimulator \
    APPLE_SDK_VERSION_OVERRIDE=15.5 \
    SWIFT_AVOID_WARNING_USING_OLD_DRIVER=1 \
    XCODE_VERSION_OVERRIDE=13.4.1.13F100 \
  bazel-out/darwin_arm64-opt-exec-2B5CBBC6-ST-e5c8d72b3b04/bin/external/build_bazel_rules_swift/tools/worker/worker swiftc @bazel-out/ios-sim_arm64-min14.5-applebin_ios-ios_sim_arm64-fastbuild-ST-92fa43ee4129/bin/XcodeBenchmark/Screen5/Screen5.swiftmodule-0.params)
# Configuration: b49a82c195d775e901470b0dfb490b914790bcca5cf674a00f03b79e63478dfc
# Execution platform: @local_config_platform//:host
error: emit-module command failed with exit code 1 (use -v to see invocation)
XcodeBenchmark/Screen5/ContentView5.swift:11:6: error: 'ObservedObject' is only available in iOS 13.0 or newer
    @ObservedObject var vm: ViewModel5

Using bazel 5.3.0 instead of 5.1.1 fixed it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM