Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-859] Add a way to exclude files, folders, and targets when used as a dependency #5389

Closed
swift-ci opened this issue Mar 2, 2016 · 4 comments

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Mar 2, 2016

Previous ID SR-859
Radar None
Original Reporter ketzusaka (JIRA User)
Type Improvement
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Improvement
Assignee None
Priority Medium

md5: fc4848b9eecc355917c37c020b3d4cab

is duplicated by:

  • SR-1868 SwiftPM should avoid building unneeded dependency modules

relates to:

  • SR-883 Support conditional dependencies

Issue Description:

Lets take the following project as an example: https://github.com/czechboy0/Jay/blob/master/Package.swift

In this project, theres the library that a project can use, and then an example application. As someone who is using Jay as a dependency, I don't care to compile JayExample when I run swift build. Jay should be able to specify which files, folders, or targets to exclude when being built as a dependency. However, if I'm working on Jay, or checking it out, and I'm in a checkout of Jay, I wouldn't want to exclude JayExample from building (which is why the existing exclude doesn't work; if ALWAYS excludes those files). I would imagine the Package file for Jay should look something like this:

import PackageDescription

let package = Package(
    name: "Jay",
    exclude: [],
    excludeWhenDependant: ["Sources/JayExample"],
    targets: [
        Target(
            name: "Jay"
        ),
        Target(
            name: "JayExample",
            dependencies: [
                .Target(name: "Jay")
            ]
        )
    ]
)

@ddunbar
Copy link
Member

ddunbar commented Apr 30, 2016

I agree this is a useful problem to solve, I'm not sure what form it should take.

One could also argue that we should have explicit dependencies from the consuming packages to the targets in the producing package, and if we did that then clients just wouldn't depend on the example target, so it wouldn't be built. That is my default inclination here...

@abertelrud
Copy link
Contributor

This is going to be very important moving forward. I agree with Daniel here that the solution should involve being able to define the dependencies in more detail.

@ddunbar
Copy link
Member

ddunbar commented Oct 3, 2016

For posterity, this was discussed some in this thread:
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160704/023659.html

@ankitspd
Copy link
Member

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
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

No branches or pull requests

4 participants