swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.71k stars 1.33k forks source link

Package resolution fails when a dependency uses an SPM-plugin for code generation #4334

Closed tachyonics closed 2 years ago

tachyonics commented 2 years ago

Expected behavior

Compilation should complete as if the dependency wasn't using an SPM-plugin for code generation.

Actual behavior

Package resolution fails with

product 'SmokeFrameworkGenerateHttp1' required by package 'emptyexampleservice' target 'EmptyExampleOperationsHTTP1' not found in package 'smoke-framework-application-generate'.

Steps to reproduce

  1. Use SPM to create a new package.
  2. Clone the smoke-framework-examples repository locally.
  3. Add the EmptyExampleService as a local dependency [1]
  4. Try to resolve the dependencies, it should fail with the error

[1] .package(path: "${BASE_PATH}/smoke-framework-examples/EmptyExampleService"),

If possible, minimal yet complete reproducer code (or URL to code)

[anything to help us reproducing the issue]

Swift Package Manager version/commit hash

5.6.1

Swift & OS version (output of swift --version && uname -a)

swift-driver version: 1.45.2 Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8) Target: x86_64-apple-macosx12.0 Darwin 3c22fb28ce76.ant.amazon.com 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64

tachyonics commented 2 years ago

I have also tested this with non-local dependencies and the same error is encountered. The EmptyExampleService package itself correctly compiles.

tomerd commented 2 years ago

thanks for reporting @tachyonics, to make sure we understand the issue correctly:

  1. smoke-framework-examples uses plugins from smoke-framework-application-generate
  2. when creating a new package that depends on smoke-framework-examples, the build of that package fails to resolve?
tachyonics commented 2 years ago

Thanks @tomerd, that is correct.

tomerd commented 2 years ago

cc @abertelrud ^^

abertelrud commented 2 years ago

Tracked by rdar://93982305. Thanks for the detailed description of how to repro!