Commit Graph

308 Commits

Author SHA1 Message Date
Daniel Rodríguez Troitiño
3fb9a2a7a4 [windows] Fix Python tests in Windows.
- Forward several environment variables to the test environment because
Windows uses them to inform the processes about things like the number
of processors and the architecture.
- Normalize some literal Unix paths to be the same as the results in
Windows, that will have forward slashes and the drive letter.
- Skip some test that use build-script-impl and tests that check for
files being executable (everything is executable in Windows).
- Don't use the owner and group arguments for tar on Windows.
- Hide the stderr output of which. In Windows it prints the full PATH in
case of failures, which is disrupting.
- Quote many paths in Windows in the output of build-script results.
- Provide a version of mock-distcc that can be executed in Windows. The
raw Python script cannot.
- Change the expected results for clang/clang++ to the right values in
Windows (clang-cl in both cases).
2019-06-06 11:30:22 -07:00
Arnold Schwaighofer
959a6acc28 Fix build-script's handling of --test-optimize-none-with-implicit-dynamic 2019-05-31 11:22:09 -07:00
Ross Bayer
1da11512e7 [Build System: build-script] Add new build-script options to specify supported architectures and module-only architectures on Darwin platforms. 2019-05-29 17:50:56 -07:00
Michael Gottesman
5f15385c42 [build-script] Add a presets for building/testing the stdlib standalone against a swift.org toolchain
This hopefully provides an example for other people on how to do this sort of
thing.

The presets are called "stdlib_RDA,standalone{,[,]notest}". It requires one parameter:
toolchain_path which should be the bin directory of your toolchain. Example:

```
build-script --preset=stdlib_RDA,standalone toolchain_path=$MY_TOOLCHAIN/usr/bin
build-script --preset=stdlib_RDA,standalone,notest toolchain_path=$MY_TOOLCHAIN/usr/bin
```
2019-05-28 21:32:04 -07:00
Michael Gottesman
e8807296ae [build-script] Add an option to only run executable tests. Off by default. 2019-05-27 13:51:13 -07:00
Brent Royal-Gordon
a60e0e0c84 Add build-script -a/-A to control assertions
These are super-important in certain circumstances, paritculalry benchmarking, and deserve a shorthand.
2019-05-25 13:19:20 -07:00
Brent Royal-Gordon
af7e2da9ca Replace —print-build-dir with --dump-config
The --dump-config option prints a recursive JSON dump of the BuildScriptInvocation object’s properties, which gives access to essentially all of the knowledge build-script has about the build before it starts performing it. This makes the output more flexible and extensible without severely convoluting the implementation, but doesn’t really give us a stable representation of that data.
2019-05-19 20:58:14 -07:00
Brent Royal-Gordon
85b30c3cc9 Add --print-build-dir option to build-script
If passed, build-script doesn’t build anything; it just prints the full path to the directory the invocation would have built its products in. This is intended to allow you to build tools which take build-script options like --debug and --xcode and use them to determine the build directory you’re currently using.
2019-05-18 13:06:37 -07:00
Julian Lettner
9631700d9e [build][Linux] Create preset to run LLVM's TSan libdispatch tests
Build a separate compiler-rt instance for running the tests. It is built
and tested against an installed toolchain instead of the llvm-build-dir.

Install everything we need to run tests (CMake modules, FileCheck, etc.)
into the toolchain directory.

Add synthetic target 'all' for llvm-install-components. Also we must set
LLVM_INSTALL_UTILS=ON, so the utilities required by tests (e.g.,
FileCheck) are included in the install target.
2019-05-16 13:17:30 -07:00
Davidino Italiano
9c506fe435 [build-script] Fix defaults and unittests. 2019-04-25 14:12:54 -07:00
Davide Italiano
dacf0bb7ac Revert "[build-script] Fix defaults and unittests."
This reverts commit 5b5041ddb0.
2019-04-24 11:30:15 -07:00
Davide Italiano
5b5041ddb0 [build-script] Fix defaults and unittests. 2019-04-10 15:01:07 -07:00
Michael Gottesman
df539948d5 [benchmarks] Add support for building the benchmarks via build-script against the just created toolchain.
Now one can on Darwin/Linux build the benchmarks via swiftpm from build-script by passing in:

```
build-script $NORMAL_ARGS --install-swift --install-swiftpm --install-llbuild --toolchain-benchmarks --swiftpm --llbuild
```

This is done using the infrastructure that BenL added for sourcekit-lsp.
2019-04-07 13:25:31 -07:00
Daniel Rodríguez Troitiño
9cec482ef3 [android] Allow executing only Android compiler tests.
The manipulation of host-test and skip-android-host was a little
different than the equivalent skip-ios-host and similar variables. These
changes make them closer and allows executing only the compiler tests,
but skip the test that need an Android device to run.

- Disables the upload command of the tests if the subset is the
  non-executable tests. The non-executable test do not need to be
  uploaded, and in the case of Android, a device doesn't need to be
  connected, so trying to connect to one will fail.
- Fix a problem where the swift_interpreter feature was removed without
  first checking if it was really added.
- Only enable the host tests (the compiler tests) in the Android CI
  preset (there's no device attached to that server, but currently only
  the Linux tests were being executed, which doesn't make a lot of
  sense).
- Move the decision about which platform support device/host tests into
  the platform themselves, which allows Android to have device/host
  tests. Also modify a little bit the logic around enabling/disabling
  the test suite to allow running only the host tests of a platform.
- Fix the suffix name for the target of non-executable tests in a couple
  of places.
2019-03-22 14:43:00 -07:00
Arnold Schwaighofer
ddcfb1069a Remove duplicate line I introduced 2019-03-21 13:53:11 -07:00
Arnold Schwaighofer
83cc98d5ec Fix python build scripts 2019-03-21 13:50:47 -07:00
Arnold Schwaighofer
54aff1eec4 Add --test-optimize-none-implicit-dynamic to build-script 2019-03-20 14:34:02 -07:00
Michael Gottesman
0dfaa19f9f [ownership] Rename enable-sil-ownership => verify-sil-ownership.
I have been meaning to do this change for a minute, but kept on putting it off.
This describes what is actually happening and is a better name for the option.
2019-03-18 01:31:44 -07:00
Mishal Shah
e296b6bd5c Add cmake-c-launcher and cmake-cxx-launcher flag to build-script 2019-02-26 17:10:54 -08:00
Ben Langmuir
c51a6c0a89 Disable sourcekit-lsp and indexstore-db on Ubuntu 14.04
We need to decide if we want to support these configurations, and in the
meantime it's better for us to disable them while we stabilize on the
other platforms. Fixes the currently broken build on 14.04.
2019-02-07 15:39:02 -08:00
Mishal Shah
2f7e367ed0 Merge branch 'master' into pkg-build-from-tc-combined 2019-02-05 22:15:03 -08:00
Ben Langmuir
e180006709 [libcxx] Simplify the conditions for building libcxx
Now we build libcxx if and only if --libcxx is passed, like with other
optional products.  This loses the intended "build if sources are
checked out" behaviour, but behaves more predictably.
2019-02-05 16:46:03 -08:00
Ben Langmuir
c034445bd2 [build-script] Fix test_driver_arguments failures 2019-02-04 14:44:42 -08:00
Ben Langmuir
6cc14afec9 [build-script] build and test indexstore-db and sourcekit-lsp
Add support to build-script to build and test the indexstore-db and
sourcekit-lsp projects. A future change will add support for installing
these products and putting them in the toolchain.  To build the new
products, add the `--sourcekit-lsp` or `--indexstore-db` options to a
`build-script` invocation.

We add the notion of a Product that is not part of build-script-impl and
build these products after the install phase of build-script-impl. These
products are built using the installed toolchain - either using the
default location within the build subdirectory, or the user-specified
`--install-dest`. This is somewhat rigid setup, since it requires the
toolchain used to build to be the same as the final installed toolchain
(if any), but it makes for a simpler change to the existing builds while
still making progress towards a toolchain-based build model.

*Note*: currently, if you are not using a preset you will need to
manually specify all of the dependencies (on macOS this is
swiftpm and llbuild, on other platforms you additionally need
libdispatch, icu, foundation, and xctest), and the install flags for the
same projects (`--install-llbuild --install-swiftpm ...`). This is not
particularly user-friendly, but it matches the current behaviour of the
other targets, and there is not yet any infrastructure in build-script
to describe these dependencies.
2019-02-04 14:44:22 -08:00
Ben Langmuir
3656084c11 [build-script] Add install-destdir and set a default value
Promotes this from a build-script-impl-only option and sets a default
value of <build>/toolchain-<target>.
2019-02-04 14:43:45 -08:00
Ben Langmuir
5619138a10 [build-script] Turn on --no-legacy-impl by default
Turns on the `--no-legacy-impl` option to build-script by default; the
old behaviour is temporarily still available as `--legacy-impl`.

This causes build-script to invoke build-script-impl for every
individual build/test/install/etc. action rather than a single global
invocation. For example, a single invocation might be for
`macosx-swift-install`. This will enable the python code in build-script
to drive the overall process and add additional steps in between actions
without the involvement of build-script-impl. It also provides a path to
refactoring the existing actions out of build-script-impl individually.

Discussed as part of https://forums.swift.org/t/rfc-building-swift-packages-in-build-script/18920

The --no-legacy-impl flag was originally disabled by default because of
concerns about the performance of null builds due to the increased
number of script invocations. There is a small optimization in this
commit to use `tr` when processing command-line options instead of
bash's builtin substitution, which eliminates most of the overhead.
After this change, a null build of llvm+swift changes from 1.6 s to
2.1 s on Linux, and from 5 s to 6 s on macOS.  Non-null builds and
builds that involve more build products than just llvm+swift (e.g.
corelibs) are basically unaffected since they are not correctly
incremental to begin with.

The changes to build-script-impl in this commit are to fix the behaviour
of --no-legacy-impl, which had bitrotted since it was introduced. These
changes are to make various parts of the script not rely on variables
defined in "earlier" parts of the script, which is good hygiene in
general.
2019-01-22 15:37:50 -08:00
Gwynne Raskind
542d02a60e Merge pull request #21911 from gwynne/replace-deprecated-assertEquals
Replace deprecated Python unit test method usage
2019-01-18 10:06:13 -06:00
Xi Ge
eefa0b1595 build-script: add a flag to build libSwiftSyntaxParser only. 2019-01-17 16:05:46 -08:00
Gwynne Raskind
09b4159cb2 Global replace of "assertEquals" with "assertEqual" in compliance with deprecation of assertEquals name in Python 2.7 2019-01-16 04:06:38 -06:00
Brent Royal-Gordon
9dd5d1293c Rework swift-stress-tester repo building (#21523)
This change makes build-script-impl use a new, shared version of swift-stress-tester’s build-script-helper.py which also supports building swift-evolve. It also adds the necessary flags and variables to build swift-evolve from build-script.
2019-01-09 14:03:35 -08:00
swift-ci
ac8b89abb5 Merge pull request #20082 from drodriguez/android-aarch64-build-script 2018-11-26 19:34:24 -08:00
Mishal Shah
bae265e308 Revert "Revert "[build-script] Update build-script to support building and installing the SourceKit stress tester"" 2018-11-12 11:08:36 -08:00
Mishal Shah
e7d501c2bd Revert "[build-script] Update build-script to support building and installing the SourceKit stress tester" 2018-11-11 17:49:35 -08:00
Nathan Hawes
506307c626 [build-script] Update build-script with a new --skstresstester flag to support building and installing the SourceKit stress tester
This makes use of a helper script in the stress tester repo to do the actual
build and install: https://github.com/apple/swift-stress-tester/blob/master/SourceKitStressTester/Utilities/build-script-helper.py
2018-11-07 09:14:39 -08:00
Daniel Rodríguez Troitiño
555e085d78 [build-script] Support for Android aarch64
Support for Android aarch64 in many parts of the build-script. Most of
the changes are reuse variables/parameters that already existed for
Android ARMv7. There is also a new parameter to specify the ICU
data library, which is used by #19503.

With this one can build either armv7 or aarch64, since building both
at the same time requires more changes like #19432 (and probably
more work to support two set of paths).
2018-10-26 12:24:40 -07:00
Alex Hoppen
8a6030b96b Add build-script infrastructure to build swiftSyntax in its own repository 2018-08-30 11:46:22 -07:00
Andrew Breckenridge
f43f5cbc37 [Preset] Add defaults for android ndk & arm directories 2018-06-21 10:49:40 -07:00
Michael Gottesman
ad3e05d82e [build-script] Add support for building the compiler with sanitizer coverage so we can make libFuzzer based fuzzers for swift compiler tools. 2018-05-02 17:39:18 -07:00
Michael Gottesman
e071e46068 Add build-script flag --enable-exclusivity-checking to enable exclusivity checking always when we compile stdlibCore.
It is off by default.

rdar://39335800
2018-04-11 09:23:06 -07:00
David Zarzycki
dc22a4d54b [build-script] Track underlying CMake/lit changes 2018-03-21 06:47:37 -04:00
Michael Gottesman
e567bc9028 [+0-all-args] Enable +0 normal arguments.
rdar://34222540
2018-03-19 20:25:31 -07:00
Vedant Kumar
9db99a0a24 build-script: Implement support for --(no-)lldb-assertions
* LLDB assertions are on by default, like swift assertions

* LLDB assertions can be enabled/disabled globally with the --assertions
  and --no-assertions options

Partially addresses: rdar://38524846
2018-03-15 20:45:02 -07:00
Ankit Aggarwal
b3b24eb928 [build-script] Add plumbing for llbuild assertions
This adds two flags to the build script to enable/disable assertions in
llbuild: --llbuild-assertions, --no-llbuild-assertions

The default value is taken from the global assertions flag.
2018-03-08 16:22:40 -08:00
Ross Bayer
4edb8d9baa [build-script] Presets Module (#14422)
* Implemented a presets module which includes a more robust and easy to understand parser. Moved the swift-sdks migration code to a new migration module and added testing for both the presets and migration modules. Also converted build-script to use the new presets parser.

* Switched the expansion algorithm to resolve mixins in-place (little known feature) and also changed the parser to skip all non-preset sections. Tests are included for these two behaviors.

* Re-worked the presets error hierarchy to have more descriptive and information packed exception classes. Also re-worked the PresetParser to catch duplicate preset declarations and duplicate options in a single preset. There's some special shim-code to handle the disconnect between the Python 2 ConfigParser module and the Python 3 update which adds DuplicateOptionError.
2018-02-26 11:26:22 -08:00
Ross Bayer
a43604498b [build-script] Respect TOOLCHAINS environment variable (#14202)
* Respect the TOOLCHAINS environment variable if set when deciding the darwin xcrun toolchain.

* Updated test/lit.cfg to respect the TOOLCHAINS environment variable when deciding the xcrun toolchain for Darwin platforms, rather than hardcoding the default.

* Fixed the default darwin xcrun toolchain logic.
2018-01-30 13:20:55 -08:00
Connor Wakamo
806c01d0a9 [build-script] Merged the PlaygroundLogger and PlaygroundSupport products.
These don't make sense to build separately, and indeed it's likely that PlaygroundLogger will soon depend on PlaygroundSupport.
As a result, build them as one product (playgroundsupport) in build-script.
Aside from removing the playgroundlogger product, this otherwise continues to build PlaygroundLogger and PlaygroundSupport the same way.

This is for <rdar://problem/36512531>.
2018-01-23 23:29:20 -08:00
Vedant Kumar
330e47d869 build-script: Build lldb with CMake on Darwin
build-script can already build lldb on Darwin using its Xcode project,
but it's useful to support the CMake build as well.

The CMake build allows incremental rebuilds with build-script. I expect
this to significantly cut down on iteration time.

Taking advantage of CMake also lets lldb piggyback on existing support
for sanitizers -- or exciting new build configurations we don't know
about yet -- without having to update the Xcode project file.

rdar://problem/36751944
2018-01-22 19:00:32 -08:00
Michael Gottesman
8c0908aac5 [cmake][build-script] Add support for building the runtime with +0 normal args.
I am upstreaming some changes to the runtime to support +0 normal arguments.

rdar://34222540
2017-12-30 21:58:25 -05:00
Ross Bayer
5a8a25e59e [build-script] Argument Builder DSL Conversion: Episode 3 (#13231)
* Updated the PathType and StorePathAction classes to allow for asserting if a path contains an executable.

* Converted the top-level argument group to use the new builder DSL.

* Updated tests for StorePathType to not actually test the functionality of the PathType class.

* Implemented a CompilerVersion type to mimic the existing wrapper in swift_build_support and return a more detailed object from ClangVersionType and SwiftVersionType.

* Updated action tests.

* Fixed a filter() mistake.

* Code review.
2017-12-06 12:36:48 -08:00
Ross Bayer
85abdcd62d Argparse "Overlay" Module (#12873)
* Implemented a wrapper module around the standard argparse package, exposing the same interface with some extras on top, including a new builder type with expressive DSL for constructing complex argument parsers.

* Fixed imports in build_swift/argparse/__init__.py to make flake8 happy.

* More re-formmating to meet the exacting standards of the python_lint script.

* Added doc-strings to all the modules in the build_swift argparse overlay.

* Implemented a new BoolType for the argparse module which handles boolean-like values and replaces the hard-coded boolean values in the _ToggleAction class.

* Fixed the mess of imports in the tests sub-package to favor relative imports, so now the unit-tests will actually run as expected. The README has also been updated with a better command for executing the unit-test suite.

* Updated the add_positional method on the ArgumentParser builder class to only take a single action or default to the store action.

* Cleaned up the set_defaults method.

* Added validation test to run the build_swift unit-tests.

* Updated validation-test for the build_swift unit-test suite to use %utils.

* Fixed hard-coded default values in the expected_options module used for generating argument parser tests.

* Updated the comment in the Python validation test to run the build_swift unit-tests.
2017-11-27 21:49:44 -08:00