Skip to content

Conversation

@spatten
Copy link
Contributor

@spatten spatten commented Mar 3, 2025

Overview

Delivers ANE-2299

The problem is happening when we scan a Package.swift file with a path dependency that has a name specified:

// swift-tools-version:5.5

import PackageDescription

let package = Package(
        name: "QueryCpuData",
        platforms: [
            .macOS(.v10_15)
        ],
        products: [
            .executable(name: "query-cpu-data", targets: ["QueryCpuData"])
        ],
        dependencies: [
            .package(name: "influxdb-client-swift", path: "../.."),
            .package(url: "https://github.com/apple/swift-argument-parser", from: "1.1.2")
        ],
        targets: [
            .executableTarget(name: "QueryCpuData", dependencies: [
                .product(name: "InfluxDBSwiftApis", package: "influxdb-client-swift"),
                .product(name: "ArgumentParser", package: "swift-argument-parser"),
            ])
        ]
)

The name option was introduced in SwiftPM 5.2: https://developer.apple.com/documentation/packagedescription/package/dependency/package(name:path:)

This PR adds the ability to parse path dependencies with names.

Acceptance criteria

  • We can parse path dependencies with names

Testing plan

git clone https://github.com/influxdata/influxdb-client-swift.git 
cd influxdb-client-swift/Examples/QueryCpuData/ 
fossa analyze --output

That analysis will fail on master but should pass using this branch. It won't find the path dependencies, but it won't fail to analyze.

Edit Package.swift and remove the name field from the path dependency. Analyze again. It should still work.

Risks

This seems low risk.

Metrics

References

ANE-2299

Checklist

  • I added tests for this PR's change (or explained in the PR description why tests don't make sense).
  • If this PR introduced a user-visible change, I added documentation into docs/.
  • If this PR added docs, I added links as appropriate to the user manual's ToC in docs/README.ms and gave consideration to how discoverable or not my documentation is.
  • If this change is externally visible, I updated Changelog.md. If this PR did not mark a release, I added my changes into an ## Unreleased section at the top.
  • If I made changes to .fossa.yml or fossa-deps.{json.yml}, I updated docs/references/files/*.schema.json AND I have updated example files used by fossa init command. You may also need to update these if you have added/removed new dependency type (e.g. pip) or analysis target type (e.g. poetry).
  • If I made changes to a subcommand's options, I updated docs/references/subcommands/<subcommand>.md.

@spatten spatten marked this pull request as ready for review March 3, 2025 23:55
@spatten spatten requested a review from a team as a code owner March 3, 2025 23:55
@spatten spatten requested review from csasarak and james-fossa and removed request for james-fossa March 3, 2025 23:55
@spatten spatten enabled auto-merge (squash) March 4, 2025 19:31
@spatten spatten merged commit c360fab into master Mar 4, 2025
17 of 18 checks passed
@spatten spatten deleted the ANE-2299-swift-path-deps-with-names branch March 4, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants