- Notifications
You must be signed in to change notification settings - Fork155
Open
Description
This seems to be a regression in 3.x. This used to work in rules_swift 2.x but fails with rules_swift 3.x:
MODULE.bazel
module(name="duplicate_symbol_repro",version="1.0.0",)bazel_dep(name="rules_swift",version="3.0.2")
BUILD
load("@rules_swift//swift:swift.bzl","swift_binary","swift_library","swift_test")swift_library(name="mylib",srcs= ["MyApp.swift"],module_name="MyApp",)swift_binary(name="myapp",deps= ["mylib"],)swift_test(name="MyAppTests",srcs= ["MyAppTests.swift"],deps= ["mylib"],)
MyApp.swift
@mainstructMyApp{staticfunc main(){print("Hello from MyApp!")}staticfunc businessLogic()->String{return"some business logic"}}
MyAppTests.swift
import XCTest@testableimport MyAppfinalclassMyAppTests:XCTestCase{func testBusinessLogic(){XCTAssertEqual(MyApp.businessLogic(),"some business logic")}}
With rules_swift 2.8.2 / 2.9.0:
$bazel clean --expunge&& bazeltest //:MyAppTests//:MyAppTests PASSED in 0.4s
With rules_swift 3.0.2:
$bazel clean --expunge&& bazeltest //:MyAppTestsERROR: /private/tmp/duplicate_symbol_repro/BUILD:14:11: Linking MyAppTests.xctest/Contents/MacOS/MyAppTests failed: (Exit 1): cc_wrapper.sh failed: error executing CppLink command (from target //:MyAppTests) bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/apple_support+/crosstool/cc_wrapper.sh @bazel-out/darwin_arm64-fastbuild/bin/MyAppTests.xctest/Contents/MacOS/MyAppTests-0.paramsUse --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debuggingduplicate symbol '_main' in: bazel-out/darwin_arm64-fastbuild/bin/libmylib.a[2](MyApp.swift.o) /private/var/tmp/_bazel_jsimard/5cd4c90ce95638f680541d109ff0573d/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin/MyAppTests__GeneratedTestDiscoveryRunner_objs/MyAppTests_test_discovery_srcs/main.swift.old: 1 duplicate symbolsclang: error: linker command failed with exit code 1 (use -v to see invocation)Error in child process '/usr/bin/xcrun'. 1Target //:MyAppTests failed to buildUse --verbose_failures to see the command lines of failed build steps.INFO: Elapsed time: 25.972s, Critical Path: 13.50sINFO: 59 processes: 22 internal, 29 darwin-sandbox, 8 worker.ERROR: Build did NOT complete successfully//:MyAppTests FAILED TO BUILDExecuted 0 out of 1 test: 1 fails to build.
Metadata
Metadata
Assignees
Labels
No labels