Commit Graph

941 Commits

Author SHA1 Message Date
Karoy Lorentey
e73ef1fd87 [benchmark] Set SWIFT_DETERMINISTIC_HASHING while running benchmarks in regular smoke tests 2021-09-16 20:23:32 -07:00
Doug Gregor
0068722088 Fix the host-specific installation destdir for build-script products.
Prior to this, build-script products that build in the host-specific
directories for cross-compilation would get the wrong path, and
therefore wouldn't get picked up in toolchain builds.
2021-09-10 20:54:46 -07:00
Doug Gregor
d52d4d56af Fix Python lint warning 2021-09-09 14:57:08 -07:00
Doug Gregor
da50b81c4f Prefer just-built compiler when building back-deployed concurrency library 2021-09-09 09:34:17 -07:00
swift-ci
0c122a514f Merge pull request #38673 from buttaface/skip-clean 2021-08-30 16:27:14 -07:00
Doug Gregor
599974367e Enable concurrency back-deployment in the compiler by default.
Remove the option that explicitly enables concurrency back-deployment,
and instead always enable its support in the compiler. Remove the use
of the extraneous CMake option as well.
2021-08-28 22:43:41 -07:00
Doug Gregor
529abeee22 Merge pull request #39061 from DougGregor/concurrency-back-deploy-libraries-ci
Enable concurrency back deployment in CI configurations
2021-08-28 07:47:45 -07:00
Doug Gregor
6d6c2e69bf [build-script] Add --install-back-deploy-concurrency.
Allow the installation of the back-deployment shared libraries for
concurrency via build-script.
2021-08-27 08:58:52 -07:00
Michael Gottesman
e23525601e Merge pull request #38888 from gottesmm/stage2-swift-split-build-script-impl
[build-script] Split the build-script-impl pipeline into two pipelines so I can put a build-script product pipeline in between.
2021-08-27 06:31:35 -07: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
Doug Gregor
602937d06c Clean up build-script test failures and linter errors 2021-08-26 08:49:44 -07:00
Doug Gregor
f2995a3755 Optionally build the compiler and _Concurrency library for back deployment.
When enabling the build of the back-deployable concurrency library via
the build-script option `--back-deploy-concurrency`, also build the
compiler and (main) concurrency library to support older deployment targets.

Building the compiler for older deployment targets is effectively the
same as implicitly passing
`-Xfrontend -enable-experimental-back-deploy-concurrency`. That option
should probably go away.

Building the primary _Concurrency library for back-deployment means
setting the "SwiftStdlib 5.5" availability back to the earlier
deployment targets. This should have no effect on how the _Concurrency
library binary is built, but it does ensure that the right
availability annotations are in the _Concurrency module.
2021-08-26 08:49:44 -07:00
Doug Gregor
3f749dc13b Add an option to build the concurrency library for back deployment.
Introduce an additional build product to build-script to build
back-deployable concurrency libraries. These libraries would need to
be embedded in apps deployed prior to macOS 12/iOS 15 to support
concurrency.

The built-script option `--back-deploy-concurrency` can be provided to
build these back-deployment libraries. They are built in addition to
the normal concurrency libraries, as a separate product that installs
into `lib/swift-5.5/<platform>` within the toolchain. The macro
`SWIFT_CONCURRENCY_BACK_DEPLOYMENT` is set when building the
concurrency library, so that we can adapt the implementation to older
OS's.
2021-08-26 08:49:43 -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
Michael Gottesman
c86e3af454 [build-script] Refactor out BuildScriptInvocation into its own file and out of the top level build-script file.
This shrinks the number of lines in build-script by 50% and just makes it easier
to read. It will also enable me to refactor parts of it into pieces without
touching the main build-script file. This is really library code... build-script
itself doesn't care about how BuildScriptInvocation is actually implemented
under the hood.
2021-08-15 20:01:58 -07:00
Michael Gottesman
04adce1541 Merge pull request #38853 from gottesmm/pr-d8c550901b98bd6c923d361cead9546d950350b9
[build-script] Specify CMAKE_RANLIB when building a CMakeProduct.
2021-08-12 16:03:21 -07:00
Michael Gottesman
db01f33d88 [build-script] Specify CMAKE_RANLIB when building a CMakeProduct.
When I perform the stage2 build, the first C-libdispatch seems to require this.
2021-08-12 11:45:17 -07:00
Eric Miotto
3ebb554690 [build] Restore previous semantics of stdlib-deployment-targets test (#38848)
For historical reasons, we configure and build standard library targets
differently depending on whether `stdlib-deployment-targets` is no set or set to
`[]`.

Add a test to make this need more explicit.

Addresses rdar://81651877
2021-08-12 07:08:30 -07:00
Michael Gottesman
2333cbcf21 [cmark] Start always cross compiling cmark on Linux. 2021-08-08 20:31:41 -07:00
Michael Gottesman
d0ad980931 [build-script] Implement setattr on StageArgs.
In case people want to override staged args in funky ways.
2021-08-05 14:54:41 -07:00
Michael Gottesman
c3d094074a [build-script] Make sure that StageArgs are never passed a StageArgs as their args.
No good reason to do this and simplifies the state space.
2021-08-05 14:08:26 -07:00
Michael Gottesman
719b112bce [build-script] Add is_verbose support to cmake_product. 2021-08-04 13:43:11 -07:00
Michael Gottesman
ae6714f2e5 [build-script] Update host specific configuration to handle multiple stage compilers.
The key thing here is that certain options (such as the stdlib deployment
targets and what to build/test) now use stage_dependent_args meaning that when
we us a stage2 compiler we will automagically look up the same argument name,
but with '_stage2' as a postfix.
2021-08-04 13:43:11 -07:00
Michael Gottesman
18f84f266d [build-script] Introduce infrastructure for auto-prefixing stage2 options.
This will let me introduce a stage generic swift implementation that adds a
postfix '_stage2' to certain stage specific options. This ensures we can have a
single swift build-script product implementation for both stage1 and stage2
compilers.
2021-08-04 13:30:40 -07:00
Michael Gottesman
c7001f91d8 [build-script] Provide infrastructure for CMakeProduct subclasses to opt into using the just built swift toolchain. 2021-08-04 13:30:40 -07:00
Eric Miotto
3504310fee [build] ensure benchmark toolchain tests use the just built libraries (#38158)
The binaries would prefer the dylibs shipped in the OS to the ones just built -- employ `DYLD_LIBRARY_PATH` to pick up the latter instead.

The main purpose of this change is to unblock the generation of nightly
toolchains.

Addresses rdar://79788142
2021-07-07 07:10:51 -07:00
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
Mishal Shah
d914ac25ee Update the macOS arch list to x86_64 and arm64 2021-06-15 23:02:02 -07:00
Dario Rexin
7ca2301841 Merge pull request #37852 from drexin/wip-fix-skip-test-cmark
[Build] Fix --skip-test-cmark
2021-06-11 14:04:15 -07:00
swift-ci
a61eb7e72b Merge pull request #37855 from adrian-prantl/typo 2021-06-10 17:29:44 -07:00
Dario Rexin
ca5e721857 [Build] Fix name of EarlySwiftDriverTestCase (#37853) 2021-06-10 09:43:42 -07:00
Adrian Prantl
63ab220d71 Fix typo 2021-06-09 15:37:47 -07:00
Dario Rexin
4d71ffaccd [Build] Add tests for CMark.should_test 2021-06-09 14:08:41 -07:00
Dario Rexin
3331529f4c [Build] Fix --skip-test-cmark
rdar://79094449
2021-06-09 13:45:37 -07:00
Varun Gandhi
60a09da5bb Merge pull request #37751 from varungandhi-apple/vg-fix-xcode-config-flag
Add missing --config flag when building with --xcode.
2021-06-03 08:57:59 -07:00
Varun Gandhi
526b0ef546 Add missing --config flag when building with --xcode.
Fixes SR-14701.
2021-06-02 16:20:12 -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
Konrad `ktoso` Malawski
6008b32789 [Distributed] initial distributed support, fixed availability (#37650)
* [Distributed] Initial distributed checking

* [Distributed] initial types shapes and conform to DistributedActor

* [Distributed] Require Codable params and return types

* [Distributed] initial synthesis of fields and constructors

* [Distributed] Field and initializer synthesis

* [Distributed] Codable requirement on distributed funcs; also handle <T: Codable>

* [Distributed] handle generic type params which are Codable in dist func

[Distributed] conformsToProtocol after all

* [Distributed] Implement remote flag on actors

* Implement remote flag on actors

* add test

* actor initializer that sets remote flag

[Distributed] conformances getting there

* [Distributed] dont require async throws; cleanup compile tests

* [Distributed] do not synthesize default implicit init, only our special ones

* [Distributed] properly synth inits and properties; mark actorTransport as _distributedActorIndependent

Also:

- do not synthesize default init() initializer for dist actor

* [Distributed] init(transport:) designated and typechecking

* [Distributed] dist actor initializers MUST delegate to local-init

* [Distributed] check if any ctors in delegation call init(transport:)

* [Distributed] check init(transport:) delegation through many inits; ban invoking init(resolve:using:) explicitly

* [Distributed] disable IRGen test for now

* [Distributed] Rebase cleanups

* [Concurrent] transport and address are concurrent value

* [Distributed] introduce -enable-experimental-distributed flag

* rebase adjustments again

* rebase again...

* [Distributed] distributed functions are implicitly async+throws outside the actor

* [Distributed] implicitly throwing and async distributed funcs

* remove printlns

* add more checks to implicit function test

* [Distributed] resolve initializer now marks the isRemote actor flag

* [Distributed] distributedActor_destroy invoked instead, rather than before normal

* [Distributed] Generate distributed thunk for actors

* [distributed] typechecking for _remote_ functions existing, add tests for remote funcs

* adding one XFAIL'ed task & actor lifetime test

The `executor_deinit1` test fails 100% of the time
(from what I've seen) so I thought we could track
and see when/if someone happens to fix this bug.

Also, added extra coverage for #36298 via `executor_deinit2`

* Fix a memory issue with actors in the runtime system, by @phausler

* add new test that now passes because of patch by @phausler

See previous commit in this PR.
Test is based on one from rdar://74281361

* fix all tests that require the _remote_ function stubs

* Do not infer @actorIndependent onto `let` decls

* REVERT_ME: remove some tests that hacky workarounds will fail

* another flaky test, help build toolchain

* [Distributed] experimental distributed implies experimental concurrency

* [Distributed] Allow distributed function that are not marked async or throws

* [Distributed] make attrs SIMPLE to get serialization generated

* [Distributed] ActorAddress must be Hashable

* [Distributed] Implement transport.actorReady call in local init

* cleanup after rebase

* [Distributed] add availability attributes to all distributed actor code

* cleanup - this fixed some things

* fixing up

* fixing up

* [Distributed] introduce new Distributed module

* [Distributed] diagnose when missing 'import _Distributed'

* [Distributed] make all tests import the module

* more docs on address

* [Distributed] fixup merge issues

* cleanup: remove unnecessary code for now SIMPLE attribute

* fix: fix getActorIsolationOfContext

* [Distributed] cmake: depend on _concurrency module

* fixing tests...

* Revert "another flaky test, help build toolchain"

This reverts commit 83ae6654dd.

* remove xfail

* clenup some IR and SIL tests

* cleanup

* [Distributed] fix cmake test and ScanDependencies/can_import_with_map.swift

* [Distributed] fix flags/build tests

* cleanup: use isDistributed wherever possible

* [Distributed] don't import Dispatch in tests

* dont link distributed in stdlib unittest

* trying always append distributed module

* cleanups

* [Distributed] move all tests to Distributed/ directory

* [lit] try to fix lit test discovery

* [Distributed] update tests after diagnostics for implicit async changed

* [Distributed] Disable remote func tests on Windows for now

* Review cleanups

* [Distributed] fix typo, fixes Concurrency/actor_isolation_objc.swift

* [Distributed] attributes are DistributedOnly (only)

* cleanup

* [Distributed] cleanup: rely on DistributedOnly for guarding the keyword

* Update include/swift/AST/ActorIsolation.h

Co-authored-by: Doug Gregor <dgregor@apple.com>

* introduce isAnyThunk, minor cleanup

* wip

* [Distributed] move some type checking to TypeCheckDistributed.cpp

* [TypeCheckAttr] remove extra debug info

* [Distributed/AutoDiff] fix SILDeclRef creation which caused AutoDiff issue

* cleanups

* [lit] remove json import from lit test suite, not needed after all

* [Distributed] distributed functions only in DistributedActor protocols

* [Distributed] fix flag overlap & build setting

* [Distributed] Simplify noteIsolatedActorMember to not take bool distributed param

* [Distributed] make __isRemote not public

* [Distributed] Fix availability and remove actor class tests

* [actorIndependent] do not apply actorIndependent implicitly to values where it would be illegal to apply

* [Distributed] disable tests until issue fixed

Co-authored-by: Dario Rexin <drexin@apple.com>
Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
Co-authored-by: Doug Gregor <dgregor@apple.com>
2021-05-28 07:22:03 +09:00
Dario Rexin
672d5aa9c6 [Build] Fix Python 2 incompatibility in cmake_product.py (#37659) 2021-05-26 21:58:48 -07: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
Michael Gottesman
6f4ef7cee2 [build-script] Begin tracking ar in build-script toolchains and start passing -DCMAKE_AR to cmake.
I am currently working on being able to build cmake build-script projects as
always being cross compiled by using toolchain files (1). CMake expects in means
that I need to be able to specify CMAKE_AR in said toolchain.

(1) We still build for the host machine (of course), but instead of building it
normally with cmake, we build it as if we are cross compiling meaning we are
cross compiling for the host on the host. This makes it so that the host build
is no longer different from cross compilation builds making Swift's cross
compilation build more robust since it will be tested and less mysterious.
2021-05-21 16:09:19 -07:00
Konrad `ktoso` Malawski
0c75bd2a39 Revert Initial distributed, some issues to be fixed first (#37556)
* Revert "[Distributed] disable tests until issue fixed"

This reverts commit 0a04278920.

* Revert "[Distributed] Initial `distributed` actors and functions and new module (#37109)"

This reverts commit 814ede0cf3.
2021-05-21 19:28:48 +09:00
Konrad `ktoso` Malawski
814ede0cf3 [Distributed] Initial distributed actors and functions and new module (#37109)
* [Distributed] Initial distributed checking

* [Distributed] initial types shapes and conform to DistributedActor

* [Distributed] Require Codable params and return types

* [Distributed] initial synthesis of fields and constructors

* [Distributed] Field and initializer synthesis

* [Distributed] Codable requirement on distributed funcs; also handle <T: Codable>

* [Distributed] handle generic type params which are Codable in dist func

[Distributed] conformsToProtocol after all

* [Distributed] Implement remote flag on actors

* Implement remote flag on actors

* add test

* actor initializer that sets remote flag

[Distributed] conformances getting there

* [Distributed] dont require async throws; cleanup compile tests

* [Distributed] do not synthesize default implicit init, only our special ones

* [Distributed] properly synth inits and properties; mark actorTransport as _distributedActorIndependent

Also:

- do not synthesize default init() initializer for dist actor

* [Distributed] init(transport:) designated and typechecking

* [Distributed] dist actor initializers MUST delegate to local-init

* [Distributed] check if any ctors in delegation call init(transport:)

* [Distributed] check init(transport:) delegation through many inits; ban invoking init(resolve:using:) explicitly

* [Distributed] disable IRGen test for now

* [Distributed] Rebase cleanups

* [Concurrent] transport and address are concurrent value

* [Distributed] introduce -enable-experimental-distributed flag

* rebase adjustments again

* rebase again...

* [Distributed] distributed functions are implicitly async+throws outside the actor

* [Distributed] implicitly throwing and async distributed funcs

* remove printlns

* add more checks to implicit function test

* [Distributed] resolve initializer now marks the isRemote actor flag

* [Distributed] distributedActor_destroy invoked instead, rather than before normal

* [Distributed] Generate distributed thunk for actors

* [distributed] typechecking for _remote_ functions existing, add tests for remote funcs

* adding one XFAIL'ed task & actor lifetime test

The `executor_deinit1` test fails 100% of the time
(from what I've seen) so I thought we could track
and see when/if someone happens to fix this bug.

Also, added extra coverage for #36298 via `executor_deinit2`

* Fix a memory issue with actors in the runtime system, by @phausler

* add new test that now passes because of patch by @phausler

See previous commit in this PR.
Test is based on one from rdar://74281361

* fix all tests that require the _remote_ function stubs

* Do not infer @actorIndependent onto `let` decls

* REVERT_ME: remove some tests that hacky workarounds will fail

* another flaky test, help build toolchain

* [Distributed] experimental distributed implies experimental concurrency

* [Distributed] Allow distributed function that are not marked async or throws

* [Distributed] make attrs SIMPLE to get serialization generated

* [Distributed] ActorAddress must be Hashable

* [Distributed] Implement transport.actorReady call in local init

* cleanup after rebase

* [Distributed] add availability attributes to all distributed actor code

* cleanup - this fixed some things

* fixing up

* fixing up

* [Distributed] introduce new Distributed module

* [Distributed] diagnose when missing 'import _Distributed'

* [Distributed] make all tests import the module

* more docs on address

* [Distributed] fixup merge issues

* cleanup: remove unnecessary code for now SIMPLE attribute

* fix: fix getActorIsolationOfContext

* [Distributed] cmake: depend on _concurrency module

* fixing tests...

* Revert "another flaky test, help build toolchain"

This reverts commit 83ae6654dd.

* remove xfail

* clenup some IR and SIL tests

* cleanup

* [Distributed] fix cmake test and ScanDependencies/can_import_with_map.swift

* [Distributed] fix flags/build tests

* cleanup: use isDistributed wherever possible

* [Distributed] don't import Dispatch in tests

* dont link distributed in stdlib unittest

* trying always append distributed module

* cleanups

* [Distributed] move all tests to Distributed/ directory

* [lit] try to fix lit test discovery

* [Distributed] update tests after diagnostics for implicit async changed

* [Distributed] Disable remote func tests on Windows for now

* Review cleanups

* [Distributed] fix typo, fixes Concurrency/actor_isolation_objc.swift

* [Distributed] attributes are DistributedOnly (only)

* cleanup

* [Distributed] cleanup: rely on DistributedOnly for guarding the keyword

* Update include/swift/AST/ActorIsolation.h

Co-authored-by: Doug Gregor <dgregor@apple.com>

* introduce isAnyThunk, minor cleanup

* wip

* [Distributed] move some type checking to TypeCheckDistributed.cpp

* [TypeCheckAttr] remove extra debug info

* [Distributed/AutoDiff] fix SILDeclRef creation which caused AutoDiff issue

* cleanups

* [lit] remove json import from lit test suite, not needed after all

* [Distributed] distributed functions only in DistributedActor protocols

* [Distributed] fix flag overlap & build setting

* [Distributed] Simplify noteIsolatedActorMember to not take bool distributed param

* [Distributed] make __isRemote not public

Co-authored-by: Dario Rexin <drexin@apple.com>
Co-authored-by: Kavon Farvardin <kfarvardin@apple.com>
Co-authored-by: Doug Gregor <dgregor@apple.com>
2021-05-21 09:12:29 +09:00
Michael Gottesman
7e2a7caf94 Merge pull request #37376 from gottesmm/pr-748eab9d443feab33ff8ffa601f0bf92e0ba0d7a
[build-script] Remove old name swift-dt from source for swift-inspect.
2021-05-18 15:27:18 -07:00