Skip to content

[PackageGraph] Allow unsafe flags in local and branch-based dependencies#2254

Merged
aciidgh merged 1 commit into
swiftlang:masterfrom
aciidgh:all-your-unsafe-are-belong-to-us
Jul 30, 2019
Merged

[PackageGraph] Allow unsafe flags in local and branch-based dependencies#2254
aciidgh merged 1 commit into
swiftlang:masterfrom
aciidgh:all-your-unsafe-are-belong-to-us

Conversation

@aciidgh

@aciidgh aciidgh commented Jul 29, 2019

Copy link
Copy Markdown
Contributor

rdar://problem/53557659
SR-11225

This will lift the restriction of using unsafe flags from local and
branch-based dependencies.

<rdar://problem/53557659>
SR-11225

This will lift the restriction of using unsafe flags from local and
branch-based dependencies.
@aciidgh

aciidgh commented Jul 29, 2019

Copy link
Copy Markdown
Contributor Author

@swift-ci smoke test

@aciidgh aciidgh merged commit f56a980 into swiftlang:master Jul 30, 2019
@aciidgh aciidgh deleted the all-your-unsafe-are-belong-to-us branch July 30, 2019 14:54
switch dependency.state {
case .checkout(let checkout):
if checkout.isBranchOrRevisionBased {
result.insert(dependency.packageRef)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this whole function (unsafeAllowedDependencies) applied recursively to all packages starting from the root? If not, how does this handle indirect references through revision/branch dependencies? i.e. if I have Root -> A -> B where both dependencies are branch dependencies, and B has unsafe flags, can they still be used? Or is that not intended?

I might have misread the test case but it looked as if it only used a single direct dependency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "dependencies" here is the entire closure from the inputs so this will work for transitive dependencies as well.

@eonist

eonist commented Jul 23, 2020

Copy link
Copy Markdown

Is this in Xcode 11.6? Im still getting: The package product 'Some-lib' cannot be used as a dependency of this target because it uses unsafe build flags 😢

@bgromov

bgromov commented Jul 24, 2020

Copy link
Copy Markdown

@eonist If you happen to use unsafe flags for the linker -L options, have a look at this workaround.

@eonist

eonist commented Jul 24, 2020

Copy link
Copy Markdown

@bgromov nope, I'm trying to use the package with optimisations enabled. I guess SPM isn't ready for optimised modules yet. Which is strange. As performance should be top of mind IMO
let optimize = [SwiftSetting.unsafeFlags(["-cross-module-optimization", "-O"], .when(configuration: .debug))]
swiftSettings: optimize

@eonist

eonist commented Jul 25, 2020

Copy link
Copy Markdown

@bgromov I found a solution. Will share soon. Ping me if I forget to write it.

@mikolasstuchlik

Copy link
Copy Markdown

@eonist ping :)

@eonist

eonist commented Dec 20, 2020

Copy link
Copy Markdown

Sorry. For reasons out of my hand. I can't share.

@RenatGafarov

Copy link
Copy Markdown

its bad(

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.

6 participants