rules_xcodeproj icon indicating copy to clipboard operation
rules_xcodeproj copied to clipboard

Bug: The generation project encountered a duplicate target

Open Kila2 opened this issue 1 year ago • 3 comments

Description

The generation project encountered a duplicate target, which corresponds to different configurations. Only //command_line_option: apple_split_cpu is different. I hope to optimize this duplicate target to avoid repeated compilation.

here is a deps graph example.

macos_command_line_applicationA
|-swift_libraryB
  |-swift_libraryA
macos_applicationA
|-swift_libraryC
  |-swift_libraryA

these target are set minimum_os_version to 11.0

I'm try custom rules_apple remove code about apple_split_cpu then generate project isn't contain duplicate target.

Reproduction steps

See the Description

Expected behavior

generate project don't contain duplicate target

rules_xcodeproj version

1.5.1

Xcode version

14.3

Bazel version

6.2.0

rules_apple version

No response

rules_swift version

No response

Additional information

RT

Kila2 avatar May 18 '23 06:05 Kila2

If you could share a minimal repro it would be great 🙏

thiagohmcruz avatar May 18 '23 13:05 thiagohmcruz

This is expected, if your library has a different configuration: https://github.com/MobileNativeFoundation/rules_xcodeproj/blob/c59ed2a0d336a9331ca0323b7959a7c27be03e32/docs/faq.md#why-are-there-multiple-versions-of-some-of-my-targets

Since Bazel is going to compile it two different ways, we will as well. You'll need to find a way to make them have the same configuration (modifying the rules, or creating a wrapper rule that transitions them the same, etc.) if you don't want rules_xcodeproj or Bazel to compile a target twice.

brentleyjones avatar May 18 '23 17:05 brentleyjones

If you could share a minimal repro it would be great 🙏

I was make minimal repo at https://github.com/Kila2/rules_xcodeproj/tree/issues/2210/examples/integration

cd /path/to/integration
$bazel run //:xcodeproj

use bazel config to get d9fd065 and 4a69d99 configuration

$bazel cquery "deps(//macOSApp/LibB:LibB)"
//macOSApp/LibB:LibB (d9fd065)
//macOSApp/LibB:LibB (4a69d99)
//macOSApp/LibB:LibB (c80b949)

Kila2 avatar May 19 '23 03:05 Kila2