Commit Graph

339 Commits

Author SHA1 Message Date
Brent Royal-Gordon
d9700def2a Placate linter 2019-05-22 15:58:24 -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
b38834621a Provide shorter name for --expand-build-script-invocation
Adds an --expand-invocation argument, which is now the preferred name for this feature. Leaves the original name in place in case someone is using it in a script.
2019-05-19 16:21:02 -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
Brent Royal-Gordon
26c7f5c5b9 Make --expand-build-script-invocation scriptable
The previous commit moved the note containing the output to stderr. This change prints it on stdout again, but now with no human-consumption prefix so it can be directly executed by tools.
2019-05-18 12:54:47 -07:00
Julian Lettner
4dcb49d8e7 Merge pull request #24330 from apple/preset-for-llvm-tsan-libdispatch-tests
[build][Linux] Create preset to run LLVM's TSan libdispatch tests
2019-05-17 10:32:55 -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
Daniel Rodríguez Troitiño
5c0e743fa5 [build-script] Introduce ProductBuilder. Transform Ninja to use it.
ProductBuilder allows us to tackle the different way than the different
products need to be build. The builders follow a very simple interface,
but inside them the details are hidden.

Previously the Ninja product was both a Product and ProductBuilder. The
methods that did the build have moved into ProductBuilder to match the
future ProductBuilders.
2019-05-13 12:36:29 -07:00
swift-ci
cfc03f85b6 Merge pull request #23955 from gottesmm/pr-098e8d08913c6672dcb8933d89afcd7c9f900dbd 2019-04-11 12:13:52 -07:00
swift-ci
0de62cb148 Merge pull request #23915 from drodriguez/build-script-host-specific-configuration-take-2 2019-04-11 12:05:11 -07:00
Michael Gottesman
4a6154b4c4 [build-script] Rename ToolchainBenchmarks -> Benchmarks.
This is a better name for the internal interface. The outside option is still
--toolchain-benchmarks to distinguish it from the normal --benchmarks which is
part of swift's cmake.
2019-04-11 10:38:27 -07:00
Daniel Rodríguez Troitiño
5f3c2bf3ce [build-script] Split execute_one_impl_action.
execute_one_impl_action is checking for the validity of its arguments, when it
can be enforced by the structure by using smaller focused methods that trickle
down into a common function.

This structure will eventually allow different builders to participate in a
script invocation. Each builder will be told to build/test/install, and they
will not have to deal with anything else. The content of these smaller methods
will end up as part of the builder that uses build-script-impl.
2019-04-09 17:22:43 -07:00
Daniel Rodríguez Troitiño
536a19a1ec [build-script] Move parts of BuildScriptInvocation into HostSpecificConfiguration.
The calculation of the plaforms to build/test were only used by HostSpeficicConfiguration, but were done in BuildScriptInvocation, and to make things work, the full BuildScriptInvocation object was passed down onto HostSpecificConfiguration. The changes in this commit move the code into HostSpecificConfiguration, and only pass `args` into it to let itself calculate the platforms to build/test.

This will allow in the future that HostSpecificConfiguration can to be removed from the main script file, can be tested and can be used by several parts of the build script process. During a transition period, it will be useful for the builder that delegates to build-script-impl, but in the end, it might only be useful for the Swift builder.
2019-04-09 16:23:30 -07:00
Daniel Rodríguez Troitiño
8cf291dd51 Merge pull request #23865 from drodriguez/build-script-host-specific-configuration-take-1
[build-script] Move some calculations into independent methods.
2019-04-09 14:43:03 -07:00
Daniel Rodríguez Troitiño
a8297b84bd [build-script] Rename all do_* methods to simply *.
As proposed in #23822, the do_* methods should only be using the * parts. Because all building should have the same names, this commit removes the prefix from all the method instances.
2019-04-08 15:51:27 -07:00
Daniel Rodríguez Troitiño
394bd9e277 [build-script] Move some calculations into independent methods.
Move the calculations of platforms_to_skip_build, platforms_to_skip_test, platforms_archs_to_skip_test, and platforms_to_skip_test_host to their own independent functions. Each function deal with one of them and they are pure functions, which should improve readability a little.
2019-04-08 11:36:36 -07:00
Saleem Abdulrasool
bc9c79a080 Revert "[build-script] Move HostSpecificConfiguration out of main script."
This reverts commit b9e17a7656.

Unfortunately, this caused conflicts on the Apple internal CI.
Reverting this for now.  This can be split up into smaller patches to
make it easier to merge.
2019-04-08 10:40:59 -07:00
Saleem Abdulrasool
9fb7fc0d60 Merge pull request #23810 from drodriguez/build-script-move-host-specific-configuration
[build-script] Move HostSpecificConfiguration out of main script.
2019-04-08 08:33:38 -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
b9e17a7656 [build-script] Move HostSpecificConfiguration out of main script.
This will allow using HostSpecificConfiguration from other parts that
are not the main script in the future.

Additionally, a lot of code that was part of BuildScriptInvocation has
been moved into HostSpeficiaConfiguration because nobody else needed it,
and HostSpecificConfiguration was highly coupled with the Invocation
object (through one of its arguments). This should make the
Configuration object a better citizen in other scenarios.
2019-04-04 19:21:42 -07:00
Daniel Rodríguez Troitiño
a92eff843e [build-script] Move call_without_sleeping into the shell module 2019-04-04 15:21:43 -07:00
Andrew Trick
266365a880 build-script fix for --extra-swift-args.
Passing an empty string to this option either as
"--extra-swift-args=''" or "--extra-swift-args ''" would cause
build-script-impl to fail to parse some arbitrary number of other
options.

This is impossible to debug from the build log because all of the
build-script-impl options still show up in the log. So, cutting and
pasting the build-script-impl command actually works.

Turns out this is why build-script build and install stages never
worked for me, beyond running cmake.
2019-03-27 14:33:05 -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
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
Mishal Shah
e296b6bd5c Add cmake-c-launcher and cmake-cxx-launcher flag to build-script 2019-02-26 17:10:54 -08:00
Brent Royal-Gordon
541b17a593 Fix build-script SwiftEvolve support (#22148) 2019-02-12 16:09:58 -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
1b2677fc72 Revert "Revert "[build-script] Add Product for libc++"" 2019-02-05 08:57:44 -08:00
Ben Langmuir
4587ba30b9 Revert "[build-script] Add Product for libc++" 2019-02-04 14:58:03 -08:00
Ben Langmuir
953cb4cb05 Fixup rebase conflicts 2019-02-04 14:44:43 -08:00
Ben Langmuir
9bbd28725a [build-script] Fix pylint warnings from indexstoredb/sourcekitlsp 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
a20050ab30 [build-script] Add Product for libc++
In a non-legacy-impl world, this is needed to trigger
building/installing libc++.

https://bugs.swift.org/browse/SR-9861
2019-02-04 10:26:36 -08:00
Ben Langmuir
dc2ea3ebbb Merge pull request #21772 from benlangmuir/no-legacy-rebase
[build-script] Turn on --no-legacy-impl by default
2019-01-24 09:14:41 -08:00
Xi Ge
08e5028c49 build-script: allow users to specify build-dir under the preset mode. 2019-01-23 11:21:24 -08:00
Ben Langmuir
08eabb46c6 Update --*-cmake-options to use format() 2019-01-22 15:37:50 -08:00
Ben Langmuir
5dbe28bf13 Update for feedback 2019-01-22 15:37:50 -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
Xi Ge
ced5044991 build-script: add a flag to separately install SwiftSyntax artifacts.
This flag '--swiftsyntax-install-prefix' could be used in the preset mode
to specify an installation dir. If we are building SwiftSyntax without building
the rest of the compiler, we'll install the SwiftSyntax modules and dylibs
with lib_InternalSwiftSyntaxParser.dylib to the given directory directly, ignoring
the conventional toolchain locations.
2019-01-22 11:59:39 -08:00
Xi Ge
eefa0b1595 build-script: add a flag to build libSwiftSyntaxParser only. 2019-01-17 16:05:46 -08:00
Mishal Shah
bb87845874 Merge pull request #21866 from apple/ninja-status-format
Update ninja status format to [%f/%t][%p][%es]
2019-01-14 22:13:28 -08:00
Mishal Shah
29077ad1e1 Update ninja status format to [%f/%t][%p][%es] 2019-01-14 18:08:50 -08: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
Daniel Rodríguez Troitiño
82c91cc80d Add missing option to CI preset for Android.
Also, fix a typo in the build script instructions.
2018-11-27 10:51:05 -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