Commit Graph

308 Commits

Author SHA1 Message Date
Michael Gottesman
404867eee7 [build-script] Convert swiftdt to be a swiftpm project that is built via a build-script product. 2020-05-29 08:31:03 -07:00
Ben Langmuir
5eb14326f0 [build-script] Add sanitizer options to sourcekit-lsp
For now, default to no sanitizers.
2020-04-14 10:33:38 -07:00
Ben Langmuir
1d7ce7efe5 [build-script] Add sanitizer support to indexstore-db product
Support the usual `--enable-*san options`, but also add a
`--test-indexstore-db-santitize-all` that runs the tests once for each
sanitizer. Sanitizing just indexstore-db with a regular toolchain should
be much faster than using sanitized compilers.
2020-04-13 15:39:36 -07:00
Mishal Shah
2f7ff37329 [Build System] Add support to execute non-executable tests 2020-02-21 18:03:16 +05:30
Saleem Abdulrasool
9b332a3a35 build: add an option to optionally build tensorflow-swift-apis
Now that the autodifferentiation support is being upstreamed, add an
option to enable building the TensorFlow swift-apis package optionally.
This enables easier development cycles for the engineers working on it.
2020-02-13 13:21:30 -08:00
Saleem Abdulrasool
8d32ee36fc Merge pull request #29443 from compnerd/unsupported-playground-support
build: migrate playground support to post-build artifact
2020-02-12 11:28:03 -08:00
Ross Bayer
e793fcf052 [Build System: build-script] Moved SWIFT_SOURCE_ROOT, SWIFT_BUILD_ROOT and SWIFT_REPO_NAME along with other project path constants into a new build_swift.constants module. 2020-02-11 12:46:03 -08:00
Michael Gottesman
704b0cc169 Presets add missing preset default for build_swift test. 2020-02-09 16:01:03 -08:00
Saleem Abdulrasool
f4086d8428 build: migrate playground support to post-build artifact
This migrates the playground support out of the build-script-impl and
into the python based build system.  This makes it build more similarly
to the Swift Package Manager and SourceKit-LSP.  More importantly, it
reduces the dependency on build-script-impl.
2020-02-08 14:00:02 -08:00
Ross Bayer
52428ff971 [Build System: build-script] Remove the host module from swift_build_support.
The functions used to calculate default LTO link jobs for LLVM and Swift have been moved to the build_swift.defaults module.
2020-02-02 14:01:19 -08:00
Ross Bayer
a7d6cd8126 [Build System: build-script] Adds a new cache_utils module to build_swift which replaces the existing module from swift_build_support. 2020-01-30 23:06:14 -08:00
Andrew Trick
4a123f102e Fix the build-script --skip-build option.
This option configures the build directories without building any
targets. Splitting configuration from build allows for the decoupling
of build products. This decoupling is essential for the enlightened
way of developing Swift where the build-script is never actually used
to build anything, and build products can be independently
configured. When fully supported, this avoids many unnecessary
full/clean rebuilds and enables debugging by mixing-and-matching
configurations and rebuilding only select products after a change.

Sadly, the option has degraded, and a recent commit rendered it fully broken:

  commit 34848e6026
  Author: Alex Langford <apl@fb.com>
  Date:   Wed Jan 22 19:27:44 2020

    [build] Unify logic to skip building projects in build-script-impl

The breaking commit was itself a reasonable cleanup. The underlying
problem was the original --skip-build was implemented using hacks that
conflated configuration with build.

This fix reinstates a reasonable situation:

--skip-build has no effect on configuration, as documented. It merely
  skips building the targets. This is how it must behave to work as
  intended.

--skip-build-{product} and its inverse --build-{product} controls
  which products will be configured. These options are in heavy use
  throughout the scripts, so changing the name (e.g. to --skip-config)
  would be disruptive and of questionable benefit.

None of this changes the fact that any required build logic that
people have dumped into build-script-impl still effectively breaks the
enlightened way of building Swift, particularly when building
toolchain components.
2020-01-28 13:09:08 -08:00
Saleem Abdulrasool
cad0c7ae21 build: add support for optionally building PythonKit
This adds support for building PythonKit as a package as part of the
toolchain build.
2020-01-24 11:17:41 -08:00
Ross Bayer
cc9ff6aed8 [Build System: build-script] Support Swift versions with up to four version components, matching Clang. 2020-01-23 16:39:58 -08:00
Devin Coughlin
63ce243437 [CMake] Add initial build system support for macCatalyst
This commit adds initial build system support for macCatalyst,
an Apple technology that enables code targeting iOS
to be recompiled so that it can be executed on macOS while still using
iOS APIs. This is the first in a series of commits building out support for
macCatalyst in the compiler, runtime, standard library, and overlays. Swift
for macCatalyst represents the work of multiple people, including
Devin Coughlin, Ross Bayer, and Brent Royal-Gordon.

Under macCatalyst, compiler-provided shared libraries (including overlays)
are built as one of four kinds (or "flavors") of libraries,
each with different install names and Mach-O load commands. This commit
adds the build system infrastructure to produce these different
library flavors.

**macOS-like Libraries**

A "macOS-like" library (such as the GLKit overlay) is a plain-old macOS library
that can only be loaded into regular macOS processes. It has a macOS slice with
a single load command allowing it to be loaded into normal macOS processes.

**iOS-like Libraries**

An "iOS-like" library, such as the UIKit overlay, is a library with a
macOS slice but with a load command that only allows it be loaded into
macCatalyst processes. iOS-like libraries are produced by passing a new
target tuple to the compiler:

  swiftc ... -target x86_64-apple-ios13.0-macabi ...

Here 'ios' (and an iOS version number) is used for OS portion
of the triple, but the 'macabi' environment tells the compiler
that the library is intended for macCatalyst.

**Zippered Libraries**

A "zippered" library can be loaded into either a macCatalyst process or
a standard macOS process. Since macCatalyst does not introduce a new Mach-O
slice, the same code is shared between both processes. Zippered libraries
are usually relatively low level and with an API surface that is similar
between macOS and iOS (for example, both the Foundation overlay and the Swift
Standard Library/Runtime itself are zippered).

Zippered libraries are created by passing both the usual `-target`
flag to the compiler and an additional `-target-variant` flag:

   swiftc ... -target x86_64-apple-macos10.15 \
              -target-variant x86_64-apple-ios13.0-macabi

Just like the -target flag, -target-variant takes a target tuple.
This tells the compiler to compile the library for the -target tuple but
to add an extra load command, allowing the library to be loaded into processes
of the -target-variant flavor as well.

While a single zippered library and slice is shared between macOS and
macCatalyst, zippered libraries require two separate .swiftinterface/.swiftmodule
files, one for macOS and one for macCatalyst. When a macOS or macCatalyst client
imports the library, it will use module file for its flavor to determine what
symbols are present. This enables a zippered library to expose a subset of its
target APIs to its target-variant.

**Unzippered-Twin Libraries**

"Unzippered Twins" are pairs of libraries with the same name but different
contents and install locations, one for use from macOS processes and one for
use from macCatalyst processes. Unzippered twins are usually libraries that
depend on AppKit on macOS and UIKit on iOS (for example, the MapKit overlay)
and so do not share a common implementation between macOS and macCatalyst.

The macCatalyst version of an unzippered twin is installed in a parallel
directory hierarchy rooted at /System/iOSSupport/. So, for example, while macOS
and zippered Swift overlays are installed in /usr/lib/swift/, iOS-like and
the macCatalyst side of unzippered twins are installed in
/System/iOSSupport/usr/lib/swift. When building for macCatalyst, the build system
passes additional search paths so that the macCatalyst version of libraries is
found before macOS versions.

The add_swift_target_library() funciton now take an
optional  MACCATALYST_BUILD_FLAVOR, which enables swift libraries to indicate
which flavor of library they are.
2020-01-21 18:26:13 -08:00
Ross Bayer
5852aea3e8 [Build System: build-script] Updated the presets module to simplify the API and improve testability. 2020-01-20 02:34:45 -08:00
Ross Bayer
a6dab52f31 [Build System: build-script] Adds a new xcrun module to build_swift which replaces the existing module from swift_build_support.
This new module uses the build_swift.shell.ExecutableWrapper API to create a wrapper class around 'xcrun'. The wrapper class is instantiated and exposed under the name build_swift.wrappers.xcrun.
2020-01-19 17:19:38 -08:00
Ross Bayer
7587c7c0ac [Build System: build-script] Re-structured the build_swift module tests to contain a build_swift directory.
Having the test directory match the module we are testing means we can have scripts in the top level of utils/build_swift which can also have tests. As part of this re-structure the test utilties have been simplified somewhat and all tests no longer use a custom TestCase, rather the standard one exposed by the unittest module.
2020-01-19 01:31:21 -08:00
Ross Bayer
d21a603829 Merge pull request #29268 from Rostepher/shell-module
[Build System: build-script] Shell module.
2020-01-18 15:16:29 -08:00
Ross Bayer
885fd01d49 [Build System: build-script] Adds a new shell module to build_swift which wraps the standard subprocess module and provides convenience functions for common shell tasks. 2020-01-18 12:24:47 -08:00
Ross Bayer
67d6b10dd0 [Build System: build-script] Add a new versions module to build_swift which provides the Version class.
Version acts very similarly to distutils.version.LooseVersion, but with some more flexibility around character group boundries.
2020-01-18 12:04:53 -08:00
Ross Bayer
516ad28c50 Merge pull request #29244 from Rostepher/adopt-six-in-build-swift
[Build System: build-script] Adopt the six compatibility library in the build_swift module.
2020-01-18 11:56:21 -08:00
Ross Bayer
0fdef59633 [Build System: build-script] Adopt the six compatibility library in the build_swift module. 2020-01-17 15:43:54 -08:00
Ross Bayer
bfeb13451e [Build System: build-script] Update the auto-generated preset parsing tests to always supply and exhaustive set of substitutions. 2020-01-17 14:37:15 -08:00
Ross Bayer
7b8401c3f7 [Build System: build-script] Remove the old implementation of the preset parser hidden away in swift_build_support. 2020-01-17 00:25:35 -08:00
Ross Bayer
525708e485 Merge pull request #29265 from Rostepher/remove-assert-not-raises
[NFC][Build System: build-script] Remove TestCase.assertNotRaises method.
2020-01-16 23:30:59 -08:00
Ross Bayer
f5c56f201c [Build System: build-script] Remove the dumb assertNotRaises test method which does less than nothing as it produces right-ward drift without any meaningful semantic benefit. 2020-01-16 21:43:36 -08:00
Ross Bayer
bb22690af0 [Build System: build-script] Moves the rest of the build-script-impl migration code from swift_build_support into build_swift. 2020-01-16 21:00:11 -08:00
Ross Bayer
ff60592ac3 [Build System: build-script] Re-organized the build_swift module to maintain a similar nested structure to swift_build_support and other Python scripting that already exists in the project. 2020-01-15 18:05:59 -08:00
Saleem Abdulrasool
d8cc616602 Merge pull request #28663 from ahoppen/install-swiftsyntax-usr-lib
[build-script] Install SwiftSyntax to usr/lib instead of usr/lib/swift
2020-01-13 14:43:32 -08:00
Alex Hoppen
91ca8ca093 [build-script] Install SwiftSyntax to usr/lib instead of usr/lib/swift
SwiftSyntax is not part of the standard library and thus should not be
installed in usr/lib/swift.

This also removes the code to install SwiftSyntax's .swiftmodule file
since that code path was never exercised.
2019-12-09 18:27:55 -08:00
Eric Miotto
e5e274333f Add support for flag in driver_arguments 2019-12-03 12:09:05 -08:00
Ankit Aggarwal
7241030876 Move swiftpm to swift_build_support infra
This will allow cleaning up most of the hacks in SwiftPM's build script.

<rdar://problem/56220087>
2019-11-03 03:23:35 +00:00
Ben Langmuir
56e9b2a099 python-lint fixes 2019-10-31 14:44:26 -07:00
Ben Langmuir
11aeb8b7fa Add build-script option --skip-test-toolchain-benchmarks 2019-10-31 09:47:20 -07:00
Alex Hoppen
fcd3457560 [build-script] Migrate SwiftSyntax to swift_build_support 2019-10-29 10:40:09 -07:00
Alex Hoppen
776e2c0030 Revert "Migrate building SwiftSyntax to swift_build_support" 2019-10-29 09:55:32 -07:00
Alex Hoppen
7ed085cb55 [build-script] Migrate SwiftSyntax to swift_build_support 2019-10-25 15:58:07 -07:00
Rintaro Ishizaki
4d31e7e755 [build-script] Fix python-lint issue
rdar://problem/56469555
2019-10-21 11:43:20 -07:00
Alex Hoppen
1926da3fe7 [build-script] Move building swiftevolve to swift_build_support 2019-10-19 19:10:41 -07:00
Alex Hoppen
adbd96bcf1 [build-script] Move building skstresstester to swift_build_support 2019-10-19 19:10:41 -07:00
Dan Zheng
2bd55f6755 [Autodiff upstream] Add build-script flag for differentiable programming. (#27595)
Add `--enable-experimental-differentiable-programming` build-script flag.

The build-script flag enables/disables standard library additions
related to differentiable programming. This will allow official Swift
releases to disable these additions.

The build-script flag is on by default to ensure testing of
differentiable programming standard library additions. An additional
driver flag must be enabled to use differentiable programming features:
https://github.com/apple/swift/pull/27446
2019-10-14 14:34:48 -07:00
Davide Italiano
b2a1e1c1ff [build-script] Introduce an option to skip local build.
This is useful for cross-compiling.

<rdar://problem/55916729>
2019-10-08 11:16:08 -07:00
Ben Langmuir
718a5bf368 [build-script] Installation support for sourcekit-lsp
Add --install-sourcekit-lsp option to build-script and update presets
for package bots to install it.
2019-08-12 13:24:49 -07:00
Ross Bayer
094696702c Merge pull request #25534 from Rostepher/append-no-more-stdlib-deployment-targets
[Build System: build-script] Update the --stdlib-deployment-targets flag to no longer append from multiple uses, instead use the standard last-wins strategy.
2019-06-18 13:24:16 -07:00
Ross Bayer
9dc44b70b5 Merge pull request #25520 from Rostepher/empty-swift-sdks
[Build System: build-script] Update the migration logic for the preset-only option '--swift-sdks' to execute in-place and support empty SDK lists.
2019-06-17 16:15:16 -07:00
Ross Bayer
563bef609f [Build System: build-script] Update the --stdlib-deployment-targets flag to no longer append from multiple uses, instead use the standard last-wins strategy. This aligns better with the existing documentation for the argument and the similar --build-stdlib-deployment-targets flag. 2019-06-17 16:13:58 -07:00
Ross Bayer
ef0b49d96e [Build System: build-script] Update the migration logic for the preset-only option '--swift-sdks' to execute in-place and support empty SDK lists. 2019-06-17 13:42:52 -07:00
Saleem Abdulrasool
7ff22f5b7a Merge pull request #25266 from drodriguez/windows-fix-python-tests
[windows] Fix Python tests in Windows.
2019-06-11 10:35:02 -07:00
Ross Bayer
8db65b35a4 Merge pull request #25122 from Rostepher/darwin-supported-archs
[Build System: CMake] Darwin Supported Archs and Modules.
2019-06-10 12:03:04 -07:00