Skip to content

New defaults module for build_swift argument parser #11911

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 2 commits into from
Sep 14, 2017
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
52 changes: 52 additions & 0 deletions utils/build_swift/defaults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

"""
Default option value definitions.
"""

__all__ = [
# Command line configuarable
'SWIFT_USER_VISIBLE_VERSION',
'CLANG_USER_VISIBLE_VERSION',
'SWIFT_ANALYZE_CODE_COVERAGE',
'DARWIN_XCRUN_TOOLCHAIN',
'DARWIN_DEPLOYMENT_VERSION_OSX',
'DARWIN_DEPLOYMENT_VERSION_IOS',
'DARWIN_DEPLOYMENT_VERSION_TVOS',
'DARWIN_DEPLOYMENT_VERSION_WATCHOS',
'UNIX_INSTALL_PREFIX',
'DARWIN_INSTALL_PREFIX',

# Constants
]

# Options that can be "configured" by command line options

BUILD_VARIANT = 'Debug'
CMAKE_GENERATOR = 'Ninja'

COMPILER_VENDOR = 'none'
SWIFT_USER_VISIBLE_VERSION = '4.1'
CLANG_USER_VISIBLE_VERSION = '5.0.0'
SWIFT_ANALYZE_CODE_COVERAGE = 'false'

DARWIN_XCRUN_TOOLCHAIN = 'default'
DARWIN_DEPLOYMENT_VERSION_OSX = '10.9'
DARWIN_DEPLOYMENT_VERSION_IOS = '7.0'
DARWIN_DEPLOYMENT_VERSION_TVOS = '9.0'
DARWIN_DEPLOYMENT_VERSION_WATCHOS = '2.0'

UNIX_INSTALL_PREFIX = '/usr'
DARWIN_INSTALL_PREFIX = ('/Applications/Xcode.app/Contents/Developer/'
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that some of the options here are not used below. Why are they here? Specifically UNIX_INSTALL_PREFIX or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They will be used very soon. I just didn't want to add more complexity in #11827.

'Toolchains/XcodeDefault.xctoolchain/usr')

# Options that can only be "configured" by editing this file.
#
# These options are not exposed as command line options on purpose. If you
# need to change any of these, you should do so on trunk or in a branch.
21 changes: 12 additions & 9 deletions utils/build_swift/driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from swift_build_support.swift_build_support.targets import \
StdlibDeploymentTarget

from . import defaults


__all__ = [
'apply_default_arguments',
Expand Down Expand Up @@ -826,7 +828,8 @@ def create_argument_parser():
help="enable code coverage analysis in Swift (false, not-merged, "
"merged).",
choices=["false", "not-merged", "merged"],
default="false", # so CMake can see the inert mode as a false value
# so CMake can see the inert mode as a false value
default=defaults.SWIFT_ANALYZE_CODE_COVERAGE,
dest="swift_analyze_code_coverage")

parser.add_argument(
Expand Down Expand Up @@ -855,7 +858,7 @@ def create_argument_parser():
parser.add_argument(
"--darwin-xcrun-toolchain",
help="the name of the toolchain to use on Darwin",
default="default")
default=defaults.DARWIN_XCRUN_TOOLCHAIN)
parser.add_argument(
"--cmake",
help="the path to a CMake executable that will be used to build "
Expand Down Expand Up @@ -975,7 +978,7 @@ def create_argument_parser():
parser.add_argument(
"--compiler-vendor",
choices=["none", "apple"],
default="none",
default=defaults.COMPILER_VENDOR,
help="Compiler vendor name")
parser.add_argument(
"--clang-compiler-version",
Expand All @@ -986,7 +989,7 @@ def create_argument_parser():
"--clang-user-visible-version",
help="User-visible version of the embedded Clang and LLVM compilers",
type=arguments.type.clang_compiler_version,
default="5.0.0",
default=defaults.CLANG_USER_VISIBLE_VERSION,
metavar="MAJOR.MINOR.PATCH")
parser.add_argument(
"--swift-compiler-version",
Expand All @@ -997,29 +1000,29 @@ def create_argument_parser():
"--swift-user-visible-version",
help="User-visible version of the embedded Swift compiler",
type=arguments.type.swift_compiler_version,
default="4.1",
default=defaults.SWIFT_USER_VISIBLE_VERSION,
metavar="MAJOR.MINOR")

parser.add_argument(
"--darwin-deployment-version-osx",
help="minimum deployment target version for OS X",
metavar="MAJOR.MINOR",
default="10.9")
default=defaults.DARWIN_DEPLOYMENT_VERSION_OSX)
parser.add_argument(
"--darwin-deployment-version-ios",
help="minimum deployment target version for iOS",
metavar="MAJOR.MINOR",
default="7.0")
default=defaults.DARWIN_DEPLOYMENT_VERSION_IOS)
parser.add_argument(
"--darwin-deployment-version-tvos",
help="minimum deployment target version for tvOS",
metavar="MAJOR.MINOR",
default="9.0")
default=defaults.DARWIN_DEPLOYMENT_VERSION_TVOS)
parser.add_argument(
"--darwin-deployment-version-watchos",
help="minimum deployment target version for watchOS",
metavar="MAJOR.MINOR",
default="2.0")
default=defaults.DARWIN_DEPLOYMENT_VERSION_WATCHOS)

parser.add_argument(
"--extra-cmake-options",
Expand Down