Commit Graph

397 Commits

Author SHA1 Message Date
SpringsUp
652062a2ec [build-script] Perform validation after defaults propagation 2016-06-10 08:04:54 +02:00
Brian Gesiak
ee51b7a6f6 [Android] Add testing support
This adds support for running tests for the stdlib built
for Android, both on the host machine and on an Android device.

The Android variant of Swift may be built and tested using
the following `build-script` invocation:

```
$ utils/build-script \
  -R \                                           # Build in ReleaseAssert mode.
  -T \                                           # Run all tests.
  --android \                                    # Build for Android.
  --android-deploy-device-path /data/local/tmp \ # Temporary directory on the device where Android tests are run.
  --android-ndk ~/android-ndk-r10e \             # Path to an Android NDK.
  --android-ndk-version 21 \
  --android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \
  --android-icu-uc-include ~/libicu-android/armeabi-v7a/icu/source/common \
  --android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \
  --android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/
```

See docs/Testing.rst for more details.
2016-06-09 13:03:28 -04:00
Brian Gesiak
344d6e264e [build-script] Fix Python error for Android
https://github.com/apple/swift/pull/2880 appends a `Target` instance
to an array of strings when building Android. This causes a syntax
error when building Android. Fix the error to repair the Android
build.
2016-06-09 12:48:06 -04:00
Dmitri Gribenko
af9932b732 build-script: don't disable iOS device tests based on the host variable
Running on-device tests is not supported for iOS, tvOS and watchOS.
2016-06-08 21:28:51 -07:00
Daniel Dunbar
d51507879a [build-script] Several PEP8 fixes. 2016-06-08 17:23:27 -07:00
Daniel Dunbar
bb9fc675c7 [build-script] Switch over to computing targets in build-script.
- Introduces a new `HostSpecificConfiguration` which holds the computed
   information for each host we need to use.

 - This relies on the functionality to pass host-specific variables to the
   script via environment variables.

 - The computation itself has been cleaned up a tiny bit (mostly via using
   the factored out platform/target properties), but is otherwise a straight
   port of the logic from `build-script-impl`.

 - This commit does not yet remove that code from `build-script-impl`; instead
   it validates that the two implementations are computing the same result.
   This is useful right now for testing the validity of the port.
2016-06-08 17:23:00 -07:00
Daniel Dunbar
6df6ae707a [build-script] Add a couple more options at the build-script layer. 2016-06-08 17:23:00 -07:00
Daniel Dunbar
bf75c8f50a [build-script] Create explicit Platform and Target types.
- This is so that we can have a place to attach the additional metadata we need
   on platform or target specific behaviors.
2016-06-08 17:23:00 -07:00
Daniel Dunbar
ca2d64a52c [build-script] Add infrastructure for passing host-specific variables.
- This isn't yet used, but we need an easy way for `build-script` to
   pass host-specific variables down to `build-script-impl`.

 - I don't think it is worth complicating the main argument parsing
   logic with a syntax for passing associative arrays on the command
   line, so this just passes them via environment variables.

 - Part of SR-237.
2016-06-08 17:23:00 -07:00
Daniel Dunbar
c03943ca23 [build-script] Lift --cross-compile-hosts to build-script level. 2016-06-08 17:22:24 -07:00
Daniel Dunbar
754521bb9c [build-script] Factor out helper for validating the args. 2016-06-08 08:52:59 -07:00
Daniel Dunbar
893d353eb1 [build-script] Factor out logic for computing the impl arg list. 2016-06-08 08:47:34 -07:00
Daniel Dunbar
6d928dc9b4 [build-script] Factor out logic for applying argument defaults. 2016-06-08 08:37:18 -07:00
Daniel Dunbar
0cdad67e36 [build-script] Factor out an Invocation helper object.
- This is an object designed to represent a single invocation of the build
   script, primarily for use in decomposing the main program flow into its
   distinct conceptual pieces.
2016-06-08 08:37:18 -07:00
Michael Gottesman
2e7d88e5b0 [build-script][lto] Migrate the num_*_parallel_lto_link_jobs code from build-script-impl into build support.
rdar://24717107
2016-06-07 20:59:13 -06:00
Michael Gottesman
a5d817257a [build-script-impl] Rename swift-enable-lto => swift-tools-enable-lto
This makes it clear to the user that they are enabling lto only for swift tools,
not for the swift standard library/runtime.

rdar://24717107
2016-06-07 19:03:03 -07:00
Michael Gottesman
87a0ad1fd6 [build-script] Add an option to build-script called --lto that unifies the triggering of ltoing llvm/swift tools.
Also change the relevant build-presets to use this flag instead of touching
build-script-impl directly.

rdar://24717107
2016-06-07 19:03:03 -07:00
practicalswift
8df3859ce7 [gardening] Fix recently introduced typos. 2016-06-05 11:11:44 +02:00
rintaro ishizaki
0d6e1b1154 [build-script] Introduce "concat" argument action
Get rid of unnecessary list of list argument.
2016-06-05 00:53:05 +09:00
Daniel Dunbar
1a694dc86c [build-script-impl] Add support for performing isolated actions.
- This adds a new argument `--only-execute <name>` which can be used by
   `build-script` to invoke the `build-script-impl` to perform each different
   action, while moving the high-level operation loop into the `build-script`
   itself. This should make incremental refactoring of the individual actions
   into `build-script` easier.

 - This is part of SR-237.
2016-06-03 08:42:21 -07:00
Daniel Dunbar
bb81448152 [utils] Rename print_command argument.
- Based on review feedback in PR#2836.
2016-06-02 08:53:48 -07:00
Daniel Dunbar
76a39000b4 Merge pull request #2836 from ddunbar/eliminate-SwiftBuildSupport-subprocess-functions
[build-script] Eliminate swift build support subprocess functions
2016-06-02 08:35:37 -07:00
rintaro ishizaki
5959dd2aa1 [build-script] Reject user-supplied '--common-cmake-options' argument
build-script doesn't support manually supplied `--common-cmake-options`.

Introduced argparse action 'arguments.action.unavailable'
2016-06-02 16:17:44 +09:00
Daniel Dunbar
3d06deefe4 [utils] Inline caffeinate logic into sole client.
- This eliminates the last client of `SwiftBuildSupport.check_call`, which is
   now replaced by `swift_build_support.shell.call`.

 - Part of SR-237.
2016-06-01 22:43:37 -07:00
Daniel Dunbar
ad9f12d8ff [utils] Introduce swift_build_support.diagnostics.
- This uses more Clang/Swift-style diagnostics, and adds a convenient wrapper
   `fatal()` which happens to match what almost all clients of the previous
   `print_with_argv0` wanted to do (i.e., fail with a fatal error).

 - As part of this, I also tried to make the diagnostics more consistent and use
   "diagnostic style" casing/punctuation.

 - Part of SR-237.
2016-06-01 16:28:42 -07:00
Daniel Dunbar
95e35130db [utils] Move quote_shell_command into swift_build_support. 2016-06-01 15:55:25 -07:00
Rintaro Ishizaki
552590eee6 [build-script] Introduce -n, --dry-run feature
If -n or --dry-run is specified in command line arguments, print the commands
that would be executed to stdout, but do not execute them.

Supported in build-script and build-toolchain.

utils/build-script -n -Rt
utils/build-script -n --preset=buildbot_incremental,tools=RA,stdlib=RA
utils/build-toolchain -n local.swift
2016-05-31 12:45:05 +09:00
Dmitri Gribenko
d54bb62e94 Merge pull request #2497 from karwa/refactored-build-script
Refactored build-script-impl for cross-compiling support
2016-05-30 14:22:55 -07:00
Dmitri Gribenko
de26657ca7 Merge pull request #2773 from rintaro/build-script-args-type
[build-script] Modularize argparse types
2016-05-30 13:42:34 -07:00
SpringsUp
0b6790ced2 SDK Autodetection now happens in build script
The old 'swift-sdks' option is migrated for presets
2016-05-30 09:04:10 +02:00
SpringsUp
9d822cda8a Refactored built-script-impl:
- Use consistent terminology for target platforms, disambiguate uses of
  'deployment_target' in to 'host' and 'stdlib_targets'
- Changed parameters to build script:
  - install-prefix no longer has to include toolchain-prefix on OSX
  - swift-sdks has been replaced by stdlib-deployment-targets
  - built-stdlib-deployment-targets lets you restrict which of the
    stdlib-deployment targets are built
- Calculate stdlib_targets per host, to facilitate future cross-compiling
- Only use executables from LOCAL_HOST
- Only execute testable targets of the LOCAL_HOST
- Remove some cases of switching on 'uname' to facilitate future
  cross-compiling
2016-05-30 08:58:16 +02:00
Dmitri Gribenko
34aae893ef Merge pull request #2771 from rintaro/build-script-usage
[build-script] Simplify usage message of build-script
2016-05-29 22:29:43 -07:00
Rintaro Ishizaki
4ebfc085d3 [build-script] Modularize argparse types 2016-05-30 13:42:09 +09:00
Rintaro Ishizaki
4ae3d34e13 [build-script] Simplify usage message of build-script
usage:
  build-script [-h | --help] [OPTION ...]
  build-script --preset=NAME [SUBSTITUTION ...]
2016-05-26 22:31:43 +09:00
Rintaro Ishizaki
fe0dd085bf [build-script] Set umask
As build-script-impl.
2016-05-26 22:15:17 +09:00
Rintaro Ishizaki
36898fc933 [build-script][SR-237] Migrate Ninja build to Python
Migrated impl args:
--build-ninja
--darwin-deployment-version-{osx,ios,tvos,watchos}

Removed impl args:
--build-ninja

Added impl args:
--ninja-bin
2016-05-26 10:29:53 +09:00
rintaro ishizaki
b1109c6344 [build-script] Provide centralized command line and file system interface for build-script. 2016-05-26 10:29:53 +09:00
Dmitri Gribenko
690d98a078 Merge pull request #2635 from practicalswift/typo-fixes-20160521
[gardening] Fix recently introduced typos.
2016-05-21 21:56:00 -07:00
Dmitri Gribenko
439811b022 build-script: re-enable tvOS builds that were accidentally disabled by a build-script refactoring 2016-05-21 20:52:40 -07:00
Dmitri Gribenko
559829fadd Merge pull request #2562 from rintaro/build-script-tweak-args
[SR-237][build-script] Migrate --skip-{variant} --skip-build-{variant} arguments
2016-05-21 19:48:59 -07:00
practicalswift
ef4f925977 [gardening] Fix recently introduced typos. 2016-05-21 13:02:00 +02:00
rintaro ishizaki
00617f92dd [build-script] Factor out calculation of args.build_subdir
To make it testable.

Also, introduced Workspace object as a ground work for merging
build-script-impl into build-script.
2016-05-19 14:59:31 +09:00
Rintaro Ishizaki
8d7a150ba1 [build-script][SR-237] Migrate --skip-{variant} --skip-build-{variant}
Eliminate some arguments tweaks from build-script-impl

Migreated:
  --skip-ios
  --skip-tvos
  --skip-watchos
  --skip-build-ios
  --skip-build-ios-device
  --skip-build-ios-simulator
  --skip-build-tvos
  --skip-build-tvos-device
  --skip-build-tvos-simulator
  --skip-build-watchos
  --skip-build-watchos-device
  --skip-build-watchos-simulator
  --skip-build-android

Removed from impl:
  // These args were merely shorthands for:
  //   --skip-build-{variant}-{device,simulator}
  //   --skip-test-{variant}-{host,simulator}
  --skip-ios
  --skip-tvos
  --skip-watchos
  --skip-build-ios
  --skip-build-tvos
  --skip-build-watchos
2016-05-16 10:22:22 +09:00
Rintaro Ishizaki
2988223805 [build-script] Canonicalize argument processing
Strictly separate "argument tweak" and "build-script-lmpl args generation"
* tweak `args` - set default, propagate default
* (Do something in `build-script`)
* build `build_script_impl_args`
2016-05-16 10:22:22 +09:00
swift-ci
354f6ea842 Merge pull request #2352 from rintaro/build-script-refactor-toolchain 2016-05-15 18:15:57 -07:00
rintaro ishizaki
966bbcce0d [build-script] Simpified code 2016-05-16 01:07:38 +09:00
Jordan Rose
5043bb6516 build-script: Make it easier to one-off modify a preset invocation.
...by putting the command it "expands to" on its own line, with empty
lines before and after, for easier copy/pasting.

No behavioral change.
2016-05-12 14:13:15 -07:00
Dmitri Gribenko
01f5c118ba Merge pull request #2365 from rintaro/build-script-long-test-swiftonly
[build-script] Don't run other products tests in "only_long" mode.
2016-05-08 22:06:36 -07:00
practicalswift
343cf6e876 [gardening] Fix recently introduced PEP-8 violation. (#2439) 2016-05-06 23:32:28 -07:00
Bouke Haarsma
269bd1dc2c [SwiftPM] Build with foundation 2016-05-05 22:28:05 +02:00