Skip to content

Initial integration of libdispatch into build-script #1030

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
Jan 21, 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
29 changes: 24 additions & 5 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ SWIFT_SOURCE_ROOT: a directory containing the source for LLVM, Clang, Swift.
$SWIFT_SOURCE_ROOT/llvm
/clang
/swift
/lldb (optional)
/llbuild (optional)
/swiftpm (optional, requires llbuild)
/swift-corelibs-xctest (optional)
/swift-corelibs-foundation (optional)
/lldb (optional)
/llbuild (optional)
/swiftpm (optional, requires llbuild)
/swift-corelibs-xctest (optional)
/swift-corelibs-foundation (optional)
/swift-corelibs-libdispatch (optional)

SWIFT_BUILD_ROOT: a directory in which to create out-of-tree builds.
Defaults to "$SWIFT_SOURCE_ROOT/build/".
Expand Down Expand Up @@ -309,6 +310,10 @@ details of the setups of other systems or automated environments.""")
help="build foundation",
action="store_true",
dest="build_foundation")
projects_group.add_argument("--libdispatch",
help="build libdispatch",
action="store_true",
dest="build_libdispatch")

extra_actions_group = parser.add_argument_group(
title="Extra actions to perform before or in addition to building")
Expand Down Expand Up @@ -373,6 +378,11 @@ build the Debug variant of the Swift standard library and SDK overlay""",
action="store_const",
const="Debug",
dest="foundation_build_variant")
build_variant_override_group.add_argument("--debug-libdispatch",
help="build the Debug variant of libdispatch",
action="store_const",
const="Debug",
dest="libdispatch_build_variant")

assertions_group = parser.add_mutually_exclusive_group(required=False)
assertions_group.add_argument("--assertions",
Expand Down Expand Up @@ -564,6 +574,9 @@ the number of parallel build jobs to use""",
if args.foundation_build_variant is None:
args.foundation_build_variant = args.build_variant

if args.libdispatch_build_variant is None:
args.libdispatch_build_variant = args.build_variant

# Assertions are enabled by default.
if args.assertions is None:
args.assertions = True
Expand Down Expand Up @@ -615,6 +628,7 @@ the number of parallel build jobs to use""",
"--skip-test-swiftpm",
"--skip-test-xctest",
"--skip-test-foundation",
"--skip-test-libdispatch",
"--skip-test-ios",
"--skip-test-tvos",
"--skip-test-watchos",
Expand Down Expand Up @@ -673,6 +687,11 @@ the number of parallel build jobs to use""",
"--skip-build-foundation"
]

if not args.build_libdispatch:
build_script_impl_inferred_args += [
"--skip-build-libdispatch"
]

if args.skip_build:
build_script_impl_inferred_args += [
"--skip-build"
Expand Down
69 changes: 69 additions & 0 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ KNOWN_SETTINGS=(
skip-build-swiftpm "" "set to skip building swiftpm"
skip-build-xctest "" "set to skip building xctest"
skip-build-foundation "" "set to skip building foundation"
skip-build-libdispatch "" "set to skip building libdispatch"
skip-test-cmark "" "set to skip testing CommonMark"
skip-test-lldb "" "set to skip testing lldb"
skip-test-swift "" "set to skip testing Swift"
skip-test-llbuild "" "set to skip testing llbuild"
skip-test-swiftpm "" "set to skip testing swiftpm"
skip-test-xctest "" "set to skip testing xctest"
skip-test-foundation "" "set to skip testing foundation"
skip-test-libdispatch "" "set to skip testing libdispatch"
skip-test-osx "" "set to skip testing Swift stdlibs for OSX"
skip-test-ios "" "set to skip testing Swift stdlibs for iOS"
skip-test-ios-simulator "" "set to skip testing Swift stdlibs for iOS simulators (i.e. test devices only)"
Expand Down Expand Up @@ -165,6 +167,7 @@ KNOWN_SETTINGS=(
install-swiftpm "" "whether to install swiftpm"
install-xctest "" "whether to install xctest"
install-foundation "" "whether to install foundation"
install-libdispatch "" "whether to install libdispatch"
darwin-install-extract-symbols "" "whether to extract symbols with dsymutil during installations"
cross-compile-tools-deployment-targets "" "space-separated list of targets to cross-compile host Swift tools for"
skip-merge-lipo-cross-compile-tools "" "set to skip running merge-lipo after installing cross-compiled host Swift tools"
Expand Down Expand Up @@ -542,6 +545,7 @@ if [[ "${SKIP_BUILD}" ]]; then
SKIP_BUILD_SWIFTPM=1
SKIP_BUILD_XCTEST=1
SKIP_BUILD_FOUNDATION=1
SKIP_BUILD_LIBDISPATCH=1
fi

if [[ "${SKIP_IOS}" ]] ; then
Expand Down Expand Up @@ -886,6 +890,7 @@ LLBUILD_SOURCE_DIR="${WORKSPACE}/llbuild"
SWIFTPM_SOURCE_DIR="${WORKSPACE}/swiftpm"
XCTEST_SOURCE_DIR="${WORKSPACE}/swift-corelibs-xctest"
FOUNDATION_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation"
LIBDISPATCH_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch"

if [[ ! -d ${CMARK_SOURCE_DIR} ]]; then
echo "Couldn't find cmark source directory."
Expand Down Expand Up @@ -926,6 +931,11 @@ if [[ ! "${SKIP_BUILD_FOUNDATION}" && ! -d ${FOUNDATION_SOURCE_DIR} ]]; then
exit 1
fi

if [[ ! "${SKIP_BUILD_LIBDISPATCH}" && ! -d ${LIBDISPATCH_SOURCE_DIR} ]]; then
echo "Couldn't find libdispatch source directory."
exit 1
fi

# Symlink clang into the llvm tree.
CLANG_SOURCE_DIR="${LLVM_SOURCE_DIR}/tools/clang"
if [ ! -e "${WORKSPACE}/clang" ] ; then
Expand Down Expand Up @@ -955,6 +965,9 @@ fi
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" foundation)
fi
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
PRODUCTS=("${PRODUCTS[@]}" libdispatch)
fi

SWIFT_STDLIB_TARGETS=()
SWIFT_PERFTEST_TARGETS=()
Expand Down Expand Up @@ -1184,6 +1197,9 @@ function build_directory_bin() {
foundation)
echo "${root}/${FOUNDATION_BUILD_TYPE}/bin"
;;
libdispatch)
echo "${root}/bin"
;;
*)
echo "error: unknown product: ${product}"
exit 1
Expand Down Expand Up @@ -1284,6 +1300,8 @@ function cmake_config_opt() {
foundation)
echo "--config ${FOUNDATION_BUILD_TYPE}"
;;
libdispatch)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does libdispatch use CMake? If not, why is this change needed?

;;
*)
echo "error: unknown product: ${product}"
exit 1
Expand Down Expand Up @@ -1826,6 +1844,28 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_
# Foundation builds itself and doesn't use cmake
continue
;;
libdispatch)
LIBDISPATCH_BUILD_DIR=$(build_directory ${deployment_target} ${product})

set -x
if [[ ! -f "${LIBDISPATCH_BUILD_DIR}"/config.status ]]; then
# First time building; need to run autotools and configure
mkdir -p "${LIBDISPATCH_BUILD_DIR}"
pushd "${LIBDISPATCH_SOURCE_DIR}"
autoreconf -fvi
popd
pushd "${LIBDISPATCH_BUILD_DIR}"
"${LIBDISPATCH_SOURCE_DIR}"/configure --prefix="${INSTALL_DESTDIR}"/"${INSTALL_PREFIX}"
popd
fi
pushd "${LIBDISPATCH_BUILD_DIR}"
make
popd
{ set +x; } 2>/dev/null

# libdispatch builds itself and doesn't use cmake
continue
;;
*)
echo "error: unknown product: ${product}"
exit 1
Expand Down Expand Up @@ -2013,6 +2053,20 @@ for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do
echo "--- Finished tests for ${product} ---"
continue
;;
libdispatch)
if [[ "${SKIP_TEST_LIBDISPATCH}" ]]; then
continue
fi
LIBDISPATCH_BUILD_DIR=$(build_directory ${deployment_target} ${product})
echo "--- Running tests for ${product} ---"
set -x
pushd "${LIBDISPATCH_BUILD_DIR}"
make check
popd
{ set +x; } 2>/dev/null
echo "--- Finished tests for ${product} ---"
continue
;;
*)
echo "error: unknown product: ${product}"
exit 1
Expand Down Expand Up @@ -2158,6 +2212,21 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_
# As foundation installation is self-contained, we break early here.
continue
;;
libdispatch)
if [[ -z "${INSTALL_LIBDISPATCH}" ]] ; then
continue
fi
echo "--- Installing ${product} ---"
LIBDISPATCH_BUILD_DIR=$(build_directory ${deployment_target} ${product})
set -x
pushd "${LIBDISPATCH_BUILD_DIR}"
make install
popd
{ set +x; } 2>/dev/null

# As libdispatch installation is self-contained, we break early here.
continue
;;
*)
echo "error: unknown product: ${product}"
exit 1
Expand Down
2 changes: 2 additions & 0 deletions utils/update-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def obtain_additional_swift_sources(opts = {'with_ssh': False}):
'swiftpm': 'apple/swift-package-manager',
'swift-corelibs-xctest': 'apple/swift-corelibs-xctest',
'swift-corelibs-foundation': 'apple/swift-corelibs-foundation',
'swift-corelibs-libdispatch': 'apple/swift-corelibs-libdispatch',
'swift-integration-tests': 'apple/swift-integration-tests',
}
for dir_name, repo in additional_repos.items():
Expand Down Expand Up @@ -95,6 +96,7 @@ By default, updates your checkouts of Swift, SourceKit, LLDB, and SwiftPM.""")
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "cmark"))
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "lldb"))
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swiftpm"))
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift-corelibs-libdispatch"))
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift-corelibs-foundation"))
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift-corelibs-xctest"))
update_working_copy(os.path.join(SWIFT_SOURCE_ROOT, "swift-integration-tests"))
Expand Down