Skip to content

CoreFoundation modularization fixes #4952

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

Merged
merged 1 commit into from
May 16, 2024

Conversation

parkera
Copy link
Contributor

@parkera parkera commented May 9, 2024

The tests do not yet run on Darwin, but it does pass tests for other platforms.

This patch also updates the contents of the CF Unicode data tables, bringing them up to date.

The majority of this patch is probably unreviewable. However I think the Package.swift and other configuration diffs can be reviewed.

Note: This patch does away with the name "SwiftFoundation" on macOS. It's just "Foundation" everywhere now. That means we need to avoid bringing in the system Foundation when we run executables that use this library, including the tests.

Package.swift Outdated
// /EHsc for Windows
]),
.unsafeFlags(["-I/usr/lib/swift"], .when(platforms: [.linux, .android])) // dispatch
]

#if os(macOS)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think this can also be a .when(platforms: [.macOS]) on the .unsafeFlags below to avoid the ifdefs here if we want

Package.swift Outdated
@@ -63,6 +80,11 @@ let interfaceBuildSettings: [CSetting] = [
.unsafeFlags(["-I/usr/lib/swift"], .when(platforms: [.linux, .android])) // dispatch
]

let swiftBuildSettings: [SwiftSetting] = [
.define("DEPLOYMENT_RUNTIME_SWIFT"),
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we define this in Swift for all platforms but in C only for Linux - just checking, is that intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may not actually matter... CFAvailability.h defines it now too:

#ifndef DEPLOYMENT_RUNTIME_SWIFT
#define DEPLOYMENT_RUNTIME_SWIFT 1
#endif

Package.swift Outdated
Comment on lines 87 to 89
let foundationName = "SwiftFoundation"
let foundationXMLName = "SwiftFoundationXML"
let foundationNetworkingName = "SwiftFoundationNetworking"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need to do this if we are no longer build on macOS? Mainly if we decide to use these names Cmake needs to match as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I think I will revert this part.

@parkera parkera force-pushed the parkera/build_package_macos branch from 948093f to a9ffa77 Compare May 16, 2024 17:59
@parkera parkera changed the title Preliminary work to get swift-corelibs-foundation's package branch building for Darwin CoreFoundation modularization fixes May 16, 2024
@parkera
Copy link
Contributor Author

parkera commented May 16, 2024

I've retitled this PR to reflect what it became in the end - fixes for CoreFoundation's modularization.

),
.target(
name: "FoundationXML",
dependencies: [
.product(name: "FoundationEssentials", package: "swift-foundation"),
"Foundation",
.targetItem(name: "Foundation", condition: nil),
Copy link
Contributor

Choose a reason for hiding this comment

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

For my context, is there a difference between these two spellings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh - I missed this, sorry. It was required when I used a String instead of a string literal for the target name. We can revert it back now.

"Foundation",
"FoundationNetworking"
.targetItem(name: "Foundation", condition: nil),
.targetItem(name: "FoundationXML", condition: nil),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this dependency is new. I don't expect it to be a problem, but was it intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, it was intentional.

@parkera parkera merged commit 405627b into swiftlang:package May 16, 2024
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