Commit Graph

934 Commits

Author SHA1 Message Date
Michael Gottesman
363bd5d26e [build-script] Fix import of dependencies of each product.
While actually wiring this up, I discovered that I imported these products
incorrectly.

Should be NFC.
2020-06-08 13:20:15 -07:00
Michael Gottesman
8effe4984e [build-script] Add a really simple build scheduler that assumes/enforces a DAG build graph.
Some notes:

* I am purposely trying to not do something too crazy here. My hope is that this
  can tied us over until we can remove a bunch of build-script logic (after
  build-script-impl is destroyed).

* Given this need for simplicity, I purposely did something really simple: I
  assumed the build-graph was a DAG. This makes it really easy to compute a
  topological ordering just by computing RPOT numbers from POT numbers. That is
  what I did in this implementation.

I haven't wired it up to anything and just added a simple test that shows how it
can properly infer from a toy dependency tree the dependencies of a "toy
swiftpm" project.
2020-06-08 12:53:07 -07:00
Michael Gottesman
1e1b350fd1 [build-script] Add dependencies for all build-script products as a first approximation.
In most cases, I followed the ordering of dependencies defined already by
build-script's product classes. In a subsequent commit I am going to add an
option (disabled by default) that schedules this via a simple topological sort
based on proving our dep graph is a DAG and using RPOT numbers.
2020-06-06 01:19:53 -07:00
Michael Gottesman
104c8f363c [build-script] Make is_build_script_impl_product() a pure method and get rid of default Yes answer.
This forces the code to self document this property. This is just an NFC
refactor.
2020-06-05 20:16:33 -07:00
Mike Ash
2a55b9d08f Fix python lint errors. 2020-05-30 14:04:32 -04:00
Ben Cohen
49cbf9788f Rename swiftdt to swift-inspect 2020-05-29 08:31:04 -07:00
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
Doug Gregor
a87b8d5f43 [build-script] When we build Dispatch and Foundation, pass them down to SwiftPM's build 2020-05-12 11:17:45 -07:00
Max Desiatov
f88269587b Gardening: fix typo in swift_build_support product.py 2020-05-11 13:17:24 +01:00
Argyrios Kyrtzidis
7600043559 [utils/build-parser-lib] Fixes for building the parser library
* Need to symlink 'swift' into 'llvm-project' since we are doing a unified configure with 'swift' as an external project.
* Need to set "-DLLVM_ENABLE_LIBEDIT=FALSE" to get iOS builds working again
2020-05-06 07:49:35 -07:00
Ben Langmuir
bb89c46f06 Merge pull request #31015 from benlangmuir/sk-sanitize
[build-script] Add sanitizer options to sourcekit-lsp
2020-04-28 09:03:33 -07:00
Mishal Shah
682b375372 Merge pull request #30565 from buttaface/prefix
[build-script] Add the installation prefix to the toolchain path
2020-04-20 10:03:22 -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
43bb415668 Merge pull request #30963 from benlangmuir/isdb-san
[build-script] Add sanitizer support to indexstore-db product
2020-04-14 09:28:55 -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
Robert Widmann
22b0526917 Merge pull request #30082 from 3405691582/OpenBSD_Port_Build
Build system recognizes OpenBSD.
2020-04-12 09:30:17 -07:00
3405691582
f8d0174b85 Build system recognizes OpenBSD.
Commit for CMake and build scripts to recognize OpenBSD. To keep this
commit relatively short, this just deals with the rather simple and
uncontroversial changes to the build system.

Note that OpenBSD calls "x86_64" as "amd64", Since the Swift stdlib will
be put in a subdirectory named after ARCH, to ensure the standard
library is properly found later, we use the native architecture name for
OpenBSD in the build system rather than trying to deal with the
difference the other way around.
2020-04-03 13:34:17 -04:00
Dario Rexin
964de289a7 Update cmake version to 3.16.5
3.15.1 contains a bug that causes libraries that use the CMake Swift module to be built with -Onone, even in release mode.
2020-03-31 18:42:53 -07:00
Butta
41ef65c23e [build-script] Add the installation prefix to the toolchain path
In several places, it was assumed to be /usr and hard-coded to that. This makes sure
the installation prefix actually passed in is used.
2020-03-22 20:02:00 +05:30
Kuba (Brecka) Mracek
5d918e5ee1 Merge branch 'master' into mracek/arm64e 2020-03-03 08:28:01 -08:00
Saleem Abdulrasool
d8a40a1662 build: use the correct install location
Use the correct installation location path computation
`toolchain_install_path` rather than trying to compute it ourselves.
This ensures that the files are installed into the right location.
2020-02-27 16:12:17 -08:00
Kuba Mracek
45ba5cec05 [arm64e] Add arm64e support into Swift's build system 2020-02-27 16:08:15 -08:00
Mishal Shah
5a4d290deb [Test] Fix build system test by adding only_non_executable_test flag 2020-02-21 19:56:53 +05:30
Mishal Shah
2f7ff37329 [Build System] Add support to execute non-executable tests 2020-02-21 18:03:16 +05:30
Saleem Abdulrasool
ac6e34ce7c build: make tensorflow-swift-apis build with older CMake
Support CMake 3.15 for the build which required changing into the build
tree before configuring/building.

Use the just-built `swiftc` to build the product.
2020-02-20 15:35:41 -08:00
Saleem Abdulrasool
5d87e43ffb build: improve the PythonKit build
This improves the PythonKit build for CMake <3.16 and for Python 2.7 or
Python 3.x.
2020-02-20 08:22:58 -08:00
Saleem Abdulrasool
ef32ead97f build: correct executable name for swift compiler
The swift compiler is `swiftc` not `swift`.  Correct the spelling.
2020-02-19 11:09:06 -08:00
Saleem Abdulrasool
01f9321496 build: build PythonKit with just built toolchain
Use the toolchain we just built to build the PythonKit module.
2020-02-18 16:34:05 -08:00
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
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
e8f2119e0a Merge pull request #29603 from Rostepher/remove-diagnostics-module
[Build System: build-script] Remove the diagnostics module from swift_build_support.
2020-02-02 16:58:30 -08:00
Ross Bayer
4450ce365a [Build System: build-script] Remove the diagnostics module from swift_build_support. 2020-02-02 14:30:51 -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
Ross Bayer
ca4fc19a50 [Build System: build-script] Remove the tar module from swift_build_support.
The single function it provided to archive a source diretory has been moved to build-script which was the only caller.
2020-01-26 23:32:34 -08:00
Ross Bayer
3bc3f795a3 [Build System: build-script] Remove the debug module from swift_build_support.
The single function it provided to print the xcodebuild version and SDK versions has been moved to build-script which was the only caller.
2020-01-26 14:31:06 -08:00
Saleem Abdulrasool
e26b21675d Merge pull request #29366 from compnerd/optional-pythonkit-support
build: add support for optionally building PythonKit
2020-01-25 09:15:44 -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
1d0f8d7602 [Build System: build-script] Update the DarwinPlatform.is_embedded method to account for macCatalyst. 2020-01-24 03:11:04 -08:00
Devin Coughlin
9b4a890262 [Utils] Attempt to appease python_lint 2020-01-21 20:27:14 -08:00
Devin Coughlin
89e381ca66 [CMake/Tests] CMake and lit.cfg support for running macCatalyst tests
Add support for testing with macCatalyst to lit.cfg and the test CMake.

This adds lit test features for whether the standard library and runtime was
built with macCatalyst support:

  REQUIRES: maccatalyst_support

The test suite can also be run in two modes: one where the macOS tests
are run as usual (against a zippered standard library, runtime, and overlays)
and another where iOS tests are compiled with the macCatalyst target
triple and executed as macCatalyst processes.

The iOS tests for macCatalyst can be run by passing `--maccatalyst-ios-tests`
to build-script. There are new lit test features to enable a test to specify
whether it supports that environment:

  REQUIRES: OS=maccatalyst
  UNSUPPORTED: OS=macCatalyst
2020-01-21 18:28:17 -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
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
2d1930f583 Merge pull request #29310 from Rostepher/remove-old-which-module
[NFC][Build System: build-script] Remove the old which module in swift_build_support.
2020-01-19 17:09:58 -08:00
Ross Bayer
ac431fa3e1 [Build System: build-script] Remove the old which module in swift_build_support and replace uses with the which function provided in the build_swift shell module. 2020-01-19 03:49:13 -08:00
Ross Bayer
de1759c84f [Build System: build-script] Added a new run_test.py script to utils/swift_build_support which is used to run the unit test suite. 2020-01-19 01:31:21 -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