Commit Graph

397 Commits

Author SHA1 Message Date
Daniel Rodríguez Troitiño
073e44d6e8 Merge pull request #29296 from buttaface/droid
[android] Get build scripts working natively, fix tests and install
2020-02-24 21:05:47 -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
Butta
3f4109b3a2 [android] Get build scripts working natively, fix tests and install
The build scripts assume Android cross-compilation using the NDK, so avoid
that configuration if building on an Android host. Fix or disable some tests,
and don't install a glibc.modulemap without a native sysroot prefix.
2020-02-05 11:36:33 +05:30
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
39d28fcf4a Merge pull request #29500 from atrick/fix-skip-build
Fix the build-script --skip-build option.
2020-01-28 17:12:11 -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
Ross Bayer
c10b904bdc [Build System: build-script] Move the static methods from the BuildScriptInvocation class to the top level of build-script. 2020-01-27 15:09:07 -08:00
Ross Bayer
23b936c9af [Build System: build-script] Re-organize build-script into more logical sections. 2020-01-27 12:35:50 -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
603a47266e [Build System: build-script] Allow users to enable distcc via the USE_DISTCC environment variable. 2020-01-24 01:59:54 -08:00
Devin Coughlin
e9df206b9d Merge pull request #29017 from devincoughlin/maccatalyst
Build system and availability support for macCatalyst
2020-01-21 22:52:48 -08:00
swift-ci
c40b298368 Merge pull request #29337 from brentdax/dump-fire 2020-01-21 22:50:21 -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
Brent Royal-Gordon
cf8b045f0e Fix build-script --dump-config
The Version object used __slots__ instead of __dict__, so it was not serializable. Update JSONDumper to stringify objects if vars() won’t work.

This change does not update any tests because build-script does not currently have a way to write full-script integration tests.
2020-01-21 14:00:41 -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
2e73fd7d11 Merge pull request #29266 from Rostepher/remove-old-arguments-module
[NFC][Build System: build-script] Remove swift_build_support arguments module.
2020-01-17 02:15:04 -08:00
Ross Bayer
31f063b8b8 [Build System: build-script] Remove the old arguments module hiding in swift_build_support in favor of the more featureful one living in build_swift. 2020-01-17 00:30:17 -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
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
Eric Miotto
e5e274333f Add support for flag in driver_arguments 2019-12-03 12:09:05 -08:00
Alex Hoppen
869f8b4344 Merge pull request #28005 from ahoppen/unified-build
Build SwiftSyntax and the stress tester using a unified build
2019-11-04 20:02:58 -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
Alex Hoppen
5764b77226 Build SwiftSyntax and the stress tester using a unified build
This avoids recompiling SwiftSyntax for every dependent project.
SwiftEvolve will be added to the unified build next.
2019-11-02 19:48:11 -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
282d0de82f Merge pull request #27871 from ahoppen/swiftsyntax_build_support
Migrate building SwiftSyntax to swift_build_support
2019-10-29 08:45:41 -07:00
Vedant Kumar
157cb2a654 [build-script] Forward --skip-local-build to build-script-impl
Otherwise, build-script-impl ignores --skip-local-build.
2019-10-28 12:20:38 -07:00
Alex Hoppen
7ed085cb55 [build-script] Migrate SwiftSyntax to swift_build_support 2019-10-25 15:58:07 -07:00
Xi Ge
7bb0e9b2dd python: fix lint issues 2019-10-24 12:20:10 -07:00
Alex Hoppen
ea2d44e5b6 [build-script] Don't build stdlib for iOS if --skip-build-ios is passed 2019-10-22 14:32:16 -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
Alex Hoppen
39c3f39b82 [build-script] Add function to compute toolchain path 2019-10-18 18:14:25 -07:00
Alex Hoppen
7be52d3852 [build-script] Extract logic determining whether to test/install a product to separate function
Previously, you were to check if a build/test/install is necessary in
the builds/test/install method which is easy to miss. This gives the
check more visibility.
2019-10-18 10:00:29 -07:00
Jonas Devlieghere
f2215943d8 [build-script] Remove support for building LLDB with Xcode
(cherry picked from commit 0c0c0ee794)
2019-08-23 14:13:17 -07:00
Simon Evans
ec396dc4f0 Linux: Build CMake if the checked out version is newer than the installed version.
- For Linux only, if the checked out CMake repository is a newer version
  than the installed CMake version or CMake is not installed, build and
  use CMake from source.

- This does not affect macOS build or set any minimum required CMake
  version in CMakeLists.txt
2019-08-22 22:51:09 +01:00
Arnold Schwaighofer
257ef70157 Revert "Linux: Build CMake if the checked out version is newer than the installed version." 2019-08-22 14:00:51 -07:00
Simon Evans
ded44f5ba5 Linux: Build CMake if the checked out version is newer than the installed version.
- For Linux only, if the checked out CMake repository is a newer version
  than the installed CMake version or CMake is not installed, build and
  use CMake from source.

- This does not affect macOS build or set any minimum required CMake
  version in CMakeLists.txt
2019-08-21 12:05:36 +01: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
Michael Gottesman
5ac5d435f9 [build-script] Fix a python lint error. 2019-07-22 17:19:20 -07:00
Ben Langmuir
7f3a1e2f62 [build-script] Pass ninja path to indexstore-db/sourcekit-lsp 2019-07-22 11:44:58 -07:00