SPM regressions on 5.2 with Sourcery

I'm trying to compile my library using SPM with Swift 5.2 Beta. Sadly it is not working:
.build/checkouts/Sourcery: error: target 'Sourcery' referenced in product 'sourcery' is empty

Package.swift file

I tried changing swift-tools-version from 5.0 to 5.2 but it didn't work. It even gave me an additional error:
error: manifest parse error: target depends on an unknown package 'SourceryRuntime' :frowning_face:

It all seem regressions to me. Should I fill bug tickets?

The fact that it does not continue to work with the tools version still set to 5.0 looks like a bug.

The error description with tools version 5.2 is accurate. It is due to SE‐0226.

You could try working around it by adjusting the package instance for 5.2 at the bottom of the manifest inside #if swift(>=5.2) and/or #if compiler(>=5.2).

I looked at this again closer because it was linked from the other thread.

What I said about 5.2 and SE‐0226 still stands.

But the error message in 5.0 is also accurate, and you would get the same message in 5.2 once you adjust your manifest.

The problem is that Sourcery 0.16.2 is incompatible with case‐sensitive file systems. The directory is sourcery, but its manifest tells SwiftPM to look in Sourcery. It appears that it has been fixed since 0.16.2:

Thanks for the information.

With swift 5.2:

  • the empty error is still present :frowning:. I'll try to make a test with swift 5.1 and the new resolver activated.

With tools in 5.2:

  • Giving a package name and using it instead of "SourceryRuntime" I don't have the manifest error anymore. However I don't really see how I can now target one specific product from Sourcery (SourceryRuntime)?

If you read closely, I told you that would happen. Sourcery itself is broken. 0.16.2 cannot build on any machine that has a case‐sensitive file system. The broken target isn’t part of the product you are trying to build, so you were getting lucky before. But a new check was added to help diagnose errors sooner and it now catches the problem while loading the manifest instead of waiting for the build to end up failed. This is intended. (Sourcery would have been much less likely to accidentally publish a broken version if this check had existed earlier.)

This is how it should look:

// ...
dependencies: [
  // ...
  .package(
    name: "Sourcery", // ← Can be omitted because it matches the URL.
    url: "https://github.com/krzysztofzablocki/Sourcery",
    .branch("master") // Because I don’t see any releases yet since the fix.
  ),
  // ...
],
targets: [
  .target(
    name: "AnnotationInject",
    dependencies: [
      "Swinject", // ← Shorthand when the product and package names match.
      .product(name: "SourceryRuntime", package: "Sourcery")
    ],
    path: "Sources"
  ),
]