Anyway to not have to exclude everything with 5.3 SPM?

I had a complicated package where I don't have control over the file layout working great under 5.1. But I wanted to now try to include some resource files for test cases. So I bumped the version line at the top of the Package.swift file to 5.3 and got an incredible slew of warnings/errors.

The major problem is this: I am forced to write something like this to get a particular target to work right:

.target(name: "opentimelineio",
                dependencies: ["opentime", "any", "optionallite"],
                path: "./src",
                exclude: ["opentimelineio/main.cpp"],
                sources: ["opentimelineio"],
                publicHeadersPath: ".",
                cxxSettings: [CXXSetting.headerSearchPath("deps/rapidjson/include")]),

where the directory "src" contains the directory which has my code (opentimelineio) but also basically lots of stuff NOT under my control, and that I can't monitor. Before, everything was fine, but now SPM wants me to exclude everything under src I don't care about.

What I really want to do here is say: (1) "ok, exclude everything under src" and then (2) now start including the following, i.e. for sources, publicHeaders, etc.

  1. Can I do that somehow?
  2. Could I tell the package manager "go back to the explicit opt-in model we had before"?
  3. I tried changing my exclude to be exclude: ["opentimelineio/main.cpp", "."] but then it says my target has no files at all, so I guess the exclude argument is trumping the sources argument.

I love the changes for resources, but making the package manager grab everything in sight seems a bad design for those of us who have to struggle to add SPM functionality to existing code bases.

P.S. You might ask why I don't just make path be "./src/opentimelineio". Believe me, I tried. That ends up breaking things because of the structure of the includes and because of the way we need the publicheaders to get communicated to client projects.

Terms of Service

Privacy Policy

Cookie Policy