Commit Graph

110 Commits

Author SHA1 Message Date
swift-ci
0c122a514f Merge pull request #38673 from buttaface/skip-clean 2021-08-30 16:27:14 -07:00
David Zarzycki
20f9be1f9a [testing] Add missing REQUIRES: standalone_build 2021-08-28 12:11:01 -04:00
Michael Gottesman
4f149d07ce [build-script] Split the build-script-impl pipeline into two pipelines so I can put a build-script product pipeline in between.
This is where I am going to put the stage 2 swift. The reason why I need to do
this is that I need libdispatch, foundation, etc on Linux to use the stage2
compiler.
2021-08-26 16:48:25 -07:00
Michael Gottesman
15aff43980 Revert "Revert "[build-script] Use a builder to setup pass pipelines that are then scheduled when using --infer""
This reverts commit 7348395a30.
2021-08-25 19:31:29 -07:00
Mishal Shah
7348395a30 Revert "[build-script] Use a builder to setup pass pipelines that are then scheduled when using --infer" 2021-08-18 08:34:18 -07:00
Michael Gottesman
6d50463656 [build-script] Use a builder to setup pass pipelines that are then scheduled when using --infer
The key thing here is that by using this builder, I am going to be able to split
the build-script-impl pipeline in two and put in a build-script pipeline in
between. This is needed so that on Linux, we can build the stage 2 compiler
before we build any of the build-script-impl libraries that depend on having a
swift compiler.

This should be an NFCI change. I am relying on our build system unit tests to
ensure that I am not changing any real behavior.
2021-08-17 19:54:03 -07:00
Butta
9d1736c123 [build] Add flags to allow skipping rebuilding the corelibs
Add three new flags, '--skip-clean-libdispatch', '--skip-clean-foundation', and
'--skip-clean-xctest', that leave the previous builds of those products in place.
2021-08-16 17:19:56 +05:30
Eric Miotto
2c6d762d19 Use existing CMake in some build-script tests (#38842)
This will prevent the tests to rebuild CMake (especially under Linux)
and cause transient issues.

This is similar to what was done for #37611
2021-08-12 07:12:47 -07:00
Mishal Shah
0ebceda18b Mark android_cross_compile.test unsupported for iOS, tvOS, and watchOS 2021-07-06 15:25:39 -07:00
Butta
de148ada38 [build] disable failing Android cross-compilation test on macOS 2021-07-01 03:17:05 +05:30
Varun Gandhi
a07b4761b3 Merge pull request #33724 from buttaface/core
[build] Add the flags to enable cross-compiling the corelibs
2021-06-30 09:31:51 -07:00
Michael Gottesman
d829de1e25 [build-script] Use a toolchain file and always cross compile cmark.
NOTE: We still build for the host platform always, but even in that case within
cmark itself, we are cross compiling it.
2021-06-28 19:26:10 -07:00
Butta
a4ff4db508 [build] Add the flags to enable cross-compiling the corelibs
Pass the Swift and CMake flags needed to cross-compile Foundation and so on, with
the first example of Android. Add a new flag, --cross-compile-deps-path, which is
used to search for cross-compiled libraries, like libcurl, that the corelibs
depend on. Also add a new flag, --common-swift-flags, to pass additional Swift
flags to the corelibs.
2021-06-29 06:41:41 +05:30
Michael Gottesman
acfe645755 [cmake] Disable libswift and cmake tests when building using the Xcode generator.
We should re-enable this once it is clear that there aren't issues with the
Xcode generator/host side swift cmake. The Ninja generator (the default) still
is enabled.
2021-06-20 13:30:29 -07:00
Michael Gottesman
98ab14d9ef [cmake] Rather than forcing parts of the build that don't depend on LLVM to define LLVM_COMMON_DEPENDS, just have add_swift_host_library respect the global if it is set. 2021-06-08 14:42:16 -07:00
Michael Gottesman
294f9b5ebe [cmake] Disable swift-cmake tests on non-Darwin platforms.
The reason why I am doing this is that we do not yet have on all of the
non-Darwin bots swift host toolchain files. So we can't test this code path on
those platforms and thus can not guarantee correctness. The result is that on
those other platforms if someone /does/ have a host toolchain with a swift
binary in it, failures may result breaking other people's builds.
2021-06-04 13:27:49 -07:00
Michael Gottesman
ef2b9d8631 [cmake] On Darwin, teach add_swift_host_tool how to find swift's SDK/compat libs, fix the rpath of tools, and add tests.
There are three things going on here (note all on Darwin):

1. If one compiles a swift static library and links the static library into a
   cxx executable, the cxx executable will need the -L flags to find the
   appropriate libraries in the SDK/toolchain.

2. I fixed an rpath issue where due to old code I didn't understand/propagated
   forward, we were setting the rpath to be the -L directory in the appropriate
   SDK. After reasoning about this a little bit I realized that this was code
   that was actually intended to be used for target libraries (for which the
   given rpath would be correct). On the host side though on Darwin, we want to
   use the rpath for the standard stabilized stdlib on the system.

3. I added Build System Unittests to ensure that this keeps on working. I also
   added test cases that I should have added before. I just had never thought
   about how to test this and I realized this method would work and would
   prevent regressions while I am waiting for a new swiftc with driver fixes to
   land.
2021-06-01 22:01:39 -07:00
Artem Chikin
71fb04aed6 Merge pull request #37349 from artemcm/InferEarlyDriver
[Build Script] Fix `--infer` with `earlyswiftdriver`.
2021-06-01 15:54:50 -07:00
Artem Chikin
3511d5f4f5 [Build Script] Fix --infer with earlyswiftdriver.
In the original implementation (https://github.com/apple/swift/pull/36377), using `--infer` accidentally disables the `earlyswiftdriver` product (`before_impl_product_classes` set to always empty). This change fixes that and makes sure early SwiftDriver is always built, regardless of whether or not `--infer` is used.

This change also ensures that `install_all` setting triggered by `--infer` does not affect products which specify `is_ignore_install_all_product` to return True. This is useful for products which should not be installed into the toolchain (corresponding build products that use the just-built toolchain are the products that get installed, e.g. `swiftdriver` to `earlyswiftdriver`).
2021-06-01 13:13:04 -07:00
Dario Rexin
da880d9c86 [Build] Pass '--reconfigure' to build-script-impl (#37677)
We recently started using the flag in build-script and forgot to pass it on the build-script-impl

rdar://78578996
2021-05-27 22:34:24 -07:00
Eric Miotto
06a2a71728 [test] Isolate build-script calls in skip-local-build.test-sh (#37611)
...and reenable `llvm-targets-options.test` (previously disabled in #37573).

This will align `skip-local-build.test-sh` with the behaviour of the
other BuildSystem tests, by

* ensuring we use the `cmake` exposed in `lit.cfg`, so that under Linux we
don't attempt to rebuild it
* using a separate build folder for `build-script` invocations, so that
side effects will not affect the main invocation and other lit tests.

I expect these changes to prevent `llvm-targets-options.test` to fail in Linux
presets with an error related to cmake, e.g.

```
build-script: error: argument --cmake: /home/buildnode/jenkins/workspace/
oss-swift-package-linux-ubuntu-18_04/build/cmake-linux-x86_64/bin/cmake is not an executable
```

Addresses rdar://78320684
2021-05-25 10:09:06 -07:00
Eric Miotto
d70b15d7fe Reenable llvm-targets-options.test
This was previously disabled in #37573.
2021-05-24 20:14:26 +00:00
Eric Miotto
7379f455bf [test] Isolate build-script calls in skip-local-build.test-sh
This will align skip-local-build.test-sh with the behaviour of the
other BuildSystem tests, by

* ensuring we use the cmake exposed in lit.cfg, so that under Linux we
don't attempt to rebuild it
* using a separate build folder for build-script invocations, so that
side effects will not affect the main invocation and other lit tests.

I expect these changes to prevent llvm-targets-options.test to fail in
Linux presets with an error related to cmake, e.g.

```
build-script: error: argument --cmake:
/home/buildnode/jenkins/workspace/
oss-swift-package-linux-ubuntu-18_04/build/cmake-linux-x86_64/bin/cmake
is not an executable
```

Addresses rdar://78320684
2021-05-24 20:13:22 +00:00
Dario Rexin
7cfabf51f1 Revert "Revert "[Build] Make cmark build a build-script product (#37102)""
This reverts commit 3150086b0f.
2021-05-24 07:03:12 -07:00
Ben Langmuir
3150086b0f Revert "[Build] Make cmark build a build-script product (#37102)"
This reverts commit 3c19cc432d.
2021-05-23 09:02:29 -07:00
Dario Rexin
3c19cc432d [Build] Make cmark build a build-script product (#37102) 2021-05-22 09:04:45 -07:00
Ben Langmuir
a2127a24d4 Disable validation-test/BuildSystem/llvm-targets-options.test on Linux
This has failed a couple of times in CI with an error about cmake not
being an executable. Disbale until we can fix it.

rdar://78320684
2021-05-21 11:50:37 -07:00
Eric Miotto
0675da8b41 [test] pass host-target to build-script... (#37488)
... in tests related to symbol generation.

This is to ensure that the dry run invocations of `build-script` use the
same value as `%target-cpu` and prevent failures when running validation
tests for an architecture different from the current one.

Addresses rdar://78141544
2021-05-19 07:06:02 -07:00
Eric Miotto
c3f8dacdf0 [Build] allow to generate symbols for a subset of binaries (#37120)
This would be needed to reduce overall build times in scenarios when
generating symbols for all binaries is too expensive and/or not needed.

At the same time, introduce tests around the logic that handles symbols.

Addresses rdar://76865276
2021-05-13 07:32:41 -07:00
Eric Miotto
1e5f790d06 [Build] allow to generate symbols for a subset of binaries
This would be needed to reduce overall build times in scenarios when
generating symbols for all binaries is too expensive and/or not needed.

Addresses rdar://76865276
2021-05-12 10:02:41 -07:00
Eric Miotto
b903a6cc65 Put symbol generation logic under test
...before adding the logic to filter paths

In particular:
* print the list of files that `cpio` copies, so we can test explicitly
  which files end up in the symroot (and also see those when asking for
  a toolchain in PR testing)
* use `find` instead of `grep` to filter files we want symbols generated
  for -- this is to avoid the script failing when there are no symbol to
  process, especially in lit tests
* remove an unnecessary check for `swift-api-digester` -- this is now a
  symlink to `swift-frontend` and we only process regular files.

Supports rdar://76865276
2021-05-12 09:52:30 -07:00
Artem Chikin
ae2e856f9b Revert "Merge pull request #37114 from apple/revert-36377-NewDriverDefault"
This reverts commit 937e1a365c, reversing
changes made to a5440a8abd.
2021-04-28 15:11:36 -07:00
Artem Chikin
1e44ed00eb Revert "Always build SwiftDriver and use it as default compiler driver" 2021-04-28 11:20:21 -07:00
Artem Chikin
23452d5bad Merge pull request #36377 from artemcm/NewDriverDefault
Always build SwiftDriver and use it as default compiler driver
2021-04-27 09:53:06 -07:00
Artem Chikin
c2dc8e3d07 Always build (and use) the new SwiftDriver as the default compiler driver.
This will make sure that compiler developers are using the new driver when they build the compiler locally and use it.

- Adds a new build-script product category: before_build_script_impl for products we wish to build before the impl products.
- Adds a new EarlySwiftDriver product to that category, which gets built with the host toolchain.
- Adds an escape hatch: --skip-early-swift-driver
- Adjusts the swift CMake configuration with an additional step: swift_create_early_driver_symlinks which (if one was built) creates symlinks in the swift build bin directory to the EarlySwiftDriver swift-driver and swift-help executables.
- Adds a new test subset : only_early_swiftdriver, which will get built into a corresponding CMake test target: check-swift-only_early_swiftdriver-* which runs a small subset of driver-related tests against the Early SwiftDriver.
  - This subset is run always when the compiler itself is tested (--test is specified)
  - With an escape disable-switch: --skip-test-early-swift-driver
  - All tests outside of only_early_swiftdriver are forced to run using the legacy C++ driver (to ensure it gets tested, still).

NOTE: SwiftDriver product (no 'Early') is still the main product used to build the driver for toolchain installation into and for executing the product's own tests. This change does not affect that.
2021-04-26 12:17:32 -07:00
Eric Miotto
3a551f8fcc [build] allow to specify ninja targets to build for LLVM (#36910)
This is meant to support scenarios in which we need to build as little as
LLVM as possible for performance reasons (e.g. when enabling LTO).

While LLVM CMake build system offers options in this sense,
in our investigation they turned out not to be suitable,
since either they are not granular enough (`LLVM_INCLUDE/BUILD` flags)
or they require active opt out for any new tool added
(`*_BUILD_*_TOOL` flags)

When using this mechanism, there is the possibility to specify different
targets to use for cross-compile hosts.

Supports rdar://32019390
2021-04-15 12:45:00 -07:00
Eric Miotto
d350a0525e [build] Clean llbuild before building by default (#36686)
Introduce a new parameter `--skip-llbuild-clean` to prevent this from
happening.

This mimicks similar logic in place for `swiftpm`, `swift-driver`
(#33563)  and `xctest` (#19512)

Addresses rdar://75057069
2021-04-05 07:19:40 -07:00
Dario Rexin
bcd6416c89 Revert "[Concurrency] Build C only libdispatch before Swift on non-Darwin pla… (#35738)" (#35789)
This reverts commit 74e59ab77f.
2021-02-05 13:51:39 -08:00
Dario Rexin
74e59ab77f [Concurrency] Build C only libdispatch before Swift on non-Darwin pla… (#35738)
* [Concurrency] Build C only libdispatch before Swift on non-Darwin platforms

_Concurrency depends on libdispatch and since it is not available by
default on non-Darwin platforms, it needs to be built before the Swift
project, so that the dependency can be resolved.

* Fix clibdispatch installation and BuildSystem tests

* Fix build system tests on Darwin and formatting
2021-02-04 17:15:30 -08:00
Eric Miotto
187f4dbaf8 [Build] Add option to alter default location of module cache in Linux (#35711)
This is meant to support parallel CI runs on the same Linux bot, so that
they don't share the module cache and reduce (hopefully) the likelihood
of issues related to invalid signatures.

When the option is enabled, the environment variable `XDG_CACHE_HOME`
is explicitly set in `build-script` and should be inherited by all the
child processes.
Currently we don't check the operating system before setting the
variable (since it should be a noop for other OSes).

Addresses rdar://73887745
2021-02-03 07:32:29 -08:00
Eric Miotto
8fc2598167 [build-script] Allow to tune dsymutil parallelism (#34795)
This should enable scaling when using machines with large amount of
RAM.

To better support machines with lower spec, process one binary per
dsymutil invocation (reverting #34149).

Add some (limited) facilities to gather the time taken to execute
dsymutil to better assist in tuning the parameter -- these are printed in
JSON format in the log to allow for easier scraping

```
{ "command": "dsymutil", "start": "2020-11-18T18:10:47" }
{ "command": "dsymutil", "end": "2020-11-18T18:14:45" }
```

Addresses rdar://71018443
2020-12-01 07:11:10 -08:00
Robert Widmann
161fa16cf8 Revert "Turn on Verbose Output For Test"
This reverts commit c34212aa20.
2020-08-29 17:20:49 -07:00
Robert Widmann
c34212aa20 Turn on Verbose Output For Test 2020-08-29 09:40:09 -07:00
Andrew Trick
4b6641f15f Merge pull request #32860 from buttaface/skip-build
[build] Fix --skip-build-llvm so that its minimal targets, like tblgen, are still built
2020-07-20 20:43:18 -07:00
Butta
c969814a11 [build] Fix --skip-build-llvm so that its minimal targets, like tblgen, are still built 2020-07-18 03:45:17 +05:30
Butta
09e30ef00c [test] Enable standalone_build feature properly and fix three tests
Two tests were mislabeled and a third needed its output reordered.
2020-07-18 03:10:31 +05:30
Michael Gottesman
a7b3e37471 [build-script] Print out inferred products/build order when --verbose-build is enabled. 2020-06-11 22:23:17 -07:00
David Zarzycki
f171358eb5 [testing] Add missing REQUIRES: standalone_test 2020-06-11 08:54:13 -04:00
David Zarzycki
537b103012 [testing] add missing REQUIRES: standalone_build 2020-06-10 05:58:24 -04:00
Michael Gottesman
a313f62522 [build-script] Add option --infer to infer dependencies.
This causes build-script to use the conservative dependency information that I
committed. When one uses this option, it is assumed that one wants to also
install all built products.

Some notes:

1. I included an extra --install-all option so without --infer enabled
   one can enable this sort of install everything that we want to
   build behavior.

2. I added %cmake as a lit variable. I did this so I could specify in
   my build-system unit tests that on Linux they should use the just
   built cmake (if we built cmake due to an old cmake being on the
   system). Otherwise, the build system unit tests took way too
   long. These are meant to be dry-runs, so building this cmake again
   is just wasteful and doesn't make sense.

3. I unified how we handle cmark, llvm, swift with the rest of the
   build products by making them conditional on build_* variables, but
   to preserve current behavior I made it so that they are just
   enabled by default unlike things like
   llbuild/swiftpm/foundation/etc. This was necessary since previously
   we would just pass these flags to build-script-impl and
   build-script didn't know about them. Now I taught build-script
   about them so I can manipulate these skip-build-{cmark,llvm,swift}
   and then just pass them down to build-script-impl if appropriate
   rather than relying on build-script-impl to control if these are
   built.

Once this lands, I think we are at a good enough place with
build-script until we get rid of build-script-impl in terms of high
value QoI that will imnprove productivity. Once build-script-impl is
destroyed, we can start paring back what build-script itself does.
2020-06-09 11:04:43 -07:00