Commit Graph

525 Commits

Author SHA1 Message Date
Brian Gesiak
4e2ddf8e07 [build-script] Use argparse for coverage default
Rather than manually checking whether a code coverage argument was passed
to the build scipt, use `argparse` to set a default value. This results
in fewer lines of code.
2016-01-20 10:02:50 -05:00
Luke Larson
ba619a9ff2 [CMake] Support code coverage analysis 2016-01-19 18:51:07 -08:00
practicalswift
22d043fcc0 [gardening] Fix violations of non-controversial PEP8 rules.
Fixes:
* blank line at end of file
* closing bracket does not match indentation of opening bracket's line
* continuation line over-indented for hanging indent
* continuation line over-indented for visual indent
* continuation line unaligned for hanging indent
* inline comment should start with '# '
* missing whitespace around arithmetic operator
* missing whitespace around bitwise or shift operator
* multiple imports on one line
* multiple spaces after ':'
* multiple spaces after operator
2016-01-16 00:47:43 +01:00
practicalswift
a2097e6de6 Call rmdir(build_dir) only if build_dir exists (-c option). 2016-01-12 00:35:33 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Brian Gesiak
c65c91d61f [SR-237][build-script] Determine CMake in Python
SR-237 calls for `build-script` and `build-script-impl` to be merged. This
commit takes another step towards that goal by moving the logic that finds
the path to the CMake executable up into `build-script`.

Users of `build-script` were previously able to specify which CMake
they wished to use via `build-script-impl` args, like so:

```
$ utils/build-script -- --cmake=/foo/bar/cmake
```

This commit preserves that behavior, while also allowing users to
specify that path via `build-script` args:

```
$ utils/build-script --cmake=/baz/cmake -- --other --flags
```
2015-12-28 12:37:26 -05:00
Brian Gesiak
ca3e11b2d6 [build-script] Determine HOST_CC in build-script
https://bugs.swift.org/browse/SR-237 calls for `build-script` and
`build-script-impl` to be merged. This commit takes another step towards
that goal by moving the logic that finds the path to the `clang` and
`clang++` executables up into Python-land.

Rather than simply moving all of the logic into `utils/build-script`,
this commit moves relevant functions into a new Python module, named
`swift_build_support`. This has several benefits:

- The logic can be tested. Whereas `build-script-impl` needed to be run
  in order to verify its behavior, the logic extracted out of it into
  `swift_build_support` can be tested in isolation.
- The logic can be split up into several files without polluting the
  `utils` directory, which now contains many different files that are
  unrelated to `build-script`.
2015-12-27 02:35:32 -05:00
practicalswift
22e10737e2 Fix typos 2015-12-26 01:19:40 +01:00
Brian Gesiak
a45a4260d8 [python] Use PEP-0008 compliant code headers
Running the Python style guide checker
[`pep8`](https://pypi.python.org/pypi/pep8) on the Python code headers
in this repository results in the following error being emitted:

    $ pep8 utils/build-script
    utils/build-script:1:1: E265 block comment should start with '# '
    utils/build-script:3:1: E266 too many leading '#' for block comment
    utils/build-script:5:1: E266 too many leading '#' for block comment
    utils/build-script:6:1: E266 too many leading '#' for block comment
    utils/build-script:8:1: E266 too many leading '#' for block comment
    utils/build-script:9:1: E266 too many leading '#' for block comment
    utils/build-script:11:1: E265 block comment should start with '# '
    utils/build-script:11:80: E501 line too long (80 > 79 characters)

The problem is that the code header used in most Python files in the
repository:

1. Do not place a space in between `#` and the rest of the comment.
2. Contains some lines that just barely exceed the recommend length
   limit.

In addition, not all code headers in the repository follow the same
template.

This commit moves all Python code headers to the following template:

    # subfolder/file_name.py - Very brief description -*- python -*--
    #
    # This source file is part of the Swift.org open source project
    #
    # Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
    # Licensed under Apache License v2.0 with Runtime Library Exception
    #
    # See http://swift.org/LICENSE.txt for license information
    # See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
    #
    # -----------------------------------------------------------------------------
    #
    # This file contains stuff that I am describing here in the header and will
    # be sure to keep up to date.
    #
    # ----------------------------------------------------------------------------
2015-12-24 11:35:53 -05:00
Dmitri Gribenko
51e7da9f01 Merge pull request #760 from modocache/sr-237-build-script-impl-merge-build-jobs
[build-script] Do not determine build jobs in impl
2015-12-23 20:53:23 -08:00
Brian Gesiak
25af095446 [build-script] Do not determine build jobs in impl
Begins work on SR-237.

Rather than determining the number of jobs to use for `make` or
`dsymutil` from within build-script-impl, this change passed in those
values from above.

Furthermore, because we can determine the number of build jobs via a
builtin Python function, we figure out the number of jobs to use from
within `utils/build-script`. Now, by default, the same number of jobs
will be used to build this project as there are cores on the host
machine. Users may still specify a different number, as before, using
the `--jobs` option.

This introduces a behavioral change. Before, running
`utils/build-script` would run something like the following `cmake`
command:

```
cmake --build /build/Ninja-DebugAssert/llvm-macosx-x86_64 -- all
```

Notice the lack of jobs specified. The new default is something like
the following:

```
cmake --build /build/Ninja-DebugAssert/llvm-macosx-x86_64 -- -j8 all
```

Notice that the number of jobs is exlicitly passed to the command.
2015-12-23 23:24:33 -05:00
practicalswift
a8cabe6cbf Use explicit imports. 2015-12-24 00:19:30 +01:00
Brian Gesiak
adf6fef8d2 [build-script] Add flag to export compile commands
CMake supports generation of compilation databases. These have many uses, not
least of which is in supporting code-completion engines like
https://github.com/Valloric/YouCompleteMe.

Add the `--export-compile-commands` flag to `utils/build-script`.
Setting this flag passes `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to CMake,
which results in a `compile_commands.json` file being generated along
with built products like `cmark`, `llvm`, and `swift`.
2015-12-13 23:04:43 -05:00
Meador Inge
c4052ebfbd Add a way to specify the number of build jobs
This change adds a '-j' option to the top-level
build script.  The computed defaults may not
always be suitable.

Tested by building for Ninja (default), Make (-m), and XCode (-x).
I also verified the jobs count via a process monitor.
2015-12-04 15:36:00 -06:00
lowell!
867769b5a5 Verb tense fix in utils/build-script help output 2015-12-04 06:13:38 -08:00
Todd Fiala
02a493b838 Revert "Error out on invalid LLDB build configurations on OS X."
This reverts commit b08610bc3e.

The check for LLDB build variant really needs to happen in
build-script-impl.  build-script can still take options after
the '--' separator that may control the final determination
of the LLDB build variant.  These weren't all being considered
by the logic in build-script.
2015-12-03 22:57:16 -08:00
Todd Fiala
b08610bc3e Error out on invalid LLDB build configurations on OS X.
https://bugs.swift.org/browse/SR-18
2015-12-03 15:22:17 -08:00
Ted Kremenek
511c436544 Merge pull request #102 from udp/freebsd
FreeBSD build support.

This unblocks work on a FreeBSD port.
2015-12-03 13:35:04 -08:00
James McLaughlin
9da5899652 Consistently use env(1) to resolve bash and python paths 2015-12-03 20:55:27 +00:00
Adam Treat
6d6e6ab71c Update the build script with correct directory names for corelibs 2015-12-03 15:55:19 -05:00
Philippe Hausler
159eab1e24 install Foundation via the ninja script and add the test phase for Foundation
The configuration script for Foundation respects debug and release builds so a new option for foundation-build-type has been added to control the build variant of Foundation.
Resolve the FIXME for adding a mechanism for a custom invocation of running the Foundation unit tests
Foundation now has an install target provided from the generated ninja script such that the potentially error prone install script is dramatically simplified into a single encapsulation of a ninja phony target of "install"; so adopt this new target for installation
2015-11-18 14:59:17 -08:00
Mishal Awadah
14d490e5d8 [build-script] Add Foundation support.
Adds support for building and installing Foundation, notably on Linux.
2015-11-10 12:12:58 -08:00
Mishal Awadah
5230a07f4c [build-script] Add XCTest
Add support for building and installing XCTest, primarily on Linux.
2015-11-09 17:10:00 -08:00
Argyrios Kyrtzidis
64ccc3f6dc [utils/build] Changes in build scripts to avoid treating SourceKit as a separate repo and build. 2015-11-04 23:19:20 -08:00
David Farler
4ac9c80809 Add back remaining files for building and testing in Open Source 2015-10-31 00:19:20 -07:00