Skip to content

[SwiftPM] Build with foundation #2406

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 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -991,10 +991,10 @@ details of the setups of other systems or automated environments.""")
if args.test_optimized:
args.test = True

# XCTest has a dependency on Foundation.
# SwiftPM and XCTest have a dependency on Foundation.
# On OS X, Foundation is built automatically using xcodebuild.
# On Linux, we must ensure that it is built manually.
if args.build_xctest and platform.system() != "Darwin":
if (args.build_swiftpm or args.build_xctest) and platform.system() != "Darwin":
args.build_foundation = True

# --skip-test-ios is merely a shorthand for host and simulator tests.
Expand Down
27 changes: 17 additions & 10 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -990,20 +990,22 @@ fi
if [[ ! "${SKIP_BUILD_LLBUILD}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" llbuild)
fi
if [[ ! "${SKIP_BUILD_SWIFTPM}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" swiftpm)
fi
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" libdispatch)
fi
# XCTest has a dependency on Foundation, so Foundation must be added to the
# list of build products first.
# SwiftPM and XCTest are dependent on Foundation, so Foundation must be
# added to the list of build products first.
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" foundation)
fi
# SwiftPM is dependent on XCTest, so XCTest must be added to the list of
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think SwiftPM actually requires XCTest as a build-time dependency. I would actually prefer to see SwiftPM built first to facilitate migrating XCTest to be built by SwiftPM in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't currently, but it does actually use XCTest today (whereas the converse is not true), and I can imagine at some point it might be desirable to "just build".

I think we are going to ultimately have to solve the circular build dependency another way, but would rather start with this order since SwiftPM does use XCTest.

# build products first.
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" xctest)
fi
if [[ ! "${SKIP_BUILD_SWIFTPM}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" swiftpm)
fi

SWIFT_STDLIB_TARGETS=()
SWIFT_BENCHMARK_TARGETS=()
Expand Down Expand Up @@ -1309,9 +1311,11 @@ function cmake_config_opt() {
function set_swiftpm_bootstrap_command() {
SWIFTC_BIN="$(build_directory_bin ${deployment_target} swift)/swiftc"
LLBUILD_BIN="$(build_directory_bin ${deployment_target} llbuild)/swift-build-tool"
if [[ ! "${SKIP_BUILD_FOUNDATION}" && ! "${SKIP_BUILD_XCTEST}" ]] ; then
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
FOUNDATION_BUILD_DIR=$(build_directory ${deployment_target} foundation)
XCTEST_BUILD_DIR=$(build_directory ${deployment_target} xctest)
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
XCTEST_BUILD_DIR=$(build_directory ${deployment_target} xctest)
fi
fi
if [ ! -e "${LLBUILD_BIN}" ]; then
echo "Error: Cannot build swiftpm without llbuild (swift-build-tool)."
Expand All @@ -1325,10 +1329,13 @@ function set_swiftpm_bootstrap_command() {
--swiftc="${SWIFTC_BIN}"
--sbt="${LLBUILD_BIN}"
--build="${build_dir}")
if [[ ! "${SKIP_BUILD_FOUNDATION}" && ! "${SKIP_BUILD_XCTEST}" ]] ; then
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
swiftpm_bootstrap_command+=(
--foundation="${FOUNDATION_BUILD_DIR}/Foundation"
--xctest="${XCTEST_BUILD_DIR}")
--foundation="${FOUNDATION_BUILD_DIR}/Foundation")
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
swiftpm_bootstrap_command+=(
--xctest="${XCTEST_BUILD_DIR}")
fi
fi
}

Expand Down