Start cross-compiling the new Swift Testing library on the CI for the… · finagolfin/swift-android-sdk@eb1567b (original) (raw)

`@@ -10,6 +10,43 @@ index 16e05052609..7ab8cebfab8 100755

`

10

10

``

11

11

` cmake_options=(

`

12

12

` -DENABLE_SWIFT=YES

`

``

13

`+

diff --git a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py b/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py

`

``

14

`+

index 324d1a77eea..e88601a8701 100644

`

``

15

`+

--- a/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py

`

``

16

`+

+++ b/swift/utils/swift_build_support/swift_build_support/products/swift_testing.py

`

``

17

`+

@@ -13,6 +13,9 @@

`

``

18

`+

import os

`

``

19

+

``

20

`+

from build_swift.build_swift.versions import Version

`

``

21

`+

+from ..host_specific_configuration \

`

``

22

`+

`

``

23

`+

+from ..targets import StdlibDeploymentTarget

`

``

24

+

``

25

`+

from . import cmake_product

`

``

26

`+

from . import product

`

``

27

`+

@@ -115,6 +117,22 @@ class SwiftTestingCMakeShim(cmake_product.CMakeProduct):

`

``

28

`+

FIXME: If we build macros for the builder, specify the path.

`

``

29

`+

self.cmake_options.define('SwiftTesting_MACRO', 'NO')

`

``

30

+

``

31

`+

`

``

32

`+

`

``

33

`+

`

``

34

`+

`

``

35

`+

`

``

36

`+

`

``

37

`+

`

``

38

`+

`

``

39

`+

`

``

40

`+

`

``

41

`+

`

``

42

`+

`

``

43

`+

`

``

44

`+

`

``

45

`+

`

``

46

`+

`

``

47

`+

self.generate_toolchain_file_for_darwin_or_linux(

`

``

48

`+

host_target, override_macos_deployment_version=override_deployment_version)

`

``

49

`+

self.build_with_cmake([], self.args.build_variant, [],

`

13

50

`diff --git a/swift-corelibs-foundation/Sources/Foundation/Process.swift b/swift-corelibs-foundation/Sources/Foundation/Process.swift

`

14

51

`index 758dd1df..02970992 100644

`

15

52

`--- a/swift-corelibs-foundation/Sources/Foundation/Process.swift

`

`@@ -39,3 +76,61 @@ index 758dd1df..02970992 100644

`

39

76

` #endif

`

40

77

` try _throwIfPosixError(posix_spawnattr_init(&spawnAttrs))

`

41

78

` try _throwIfPosixError(posix_spawnattr_setflags(&spawnAttrs, .init(POSIX_SPAWN_SETPGROUP)))

`

``

79

`+

diff --git a/swift-testing/CMakeLists.txt b/swift-testing/CMakeLists.txt

`

``

80

`+

index 1be9a4b..bd7b1bd 100644

`

``

81

`+

--- a/swift-testing/CMakeLists.txt

`

``

82

`+

+++ b/swift-testing/CMakeLists.txt

`

``

83

`+

@@ -28,6 +28,7 @@ list(APPEND CMAKE_MODULE_PATH

`

``

84

`+

${PROJECT_SOURCE_DIR}/cmake/modules

`

``

85

`+

${PROJECT_SOURCE_DIR}/cmake/modules/shared)

`

``

86

+

``

87

`+

+set(CMAKE_SHARED_LINKER_FLAGS "")

`

``

88

`+

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

`

``

89

`+

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

`

``

90

`+

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

`

``

91

`+

diff --git a/swift-testing/Sources/Testing/CMakeLists.txt b/swift-testing/Sources/Testing/CMakeLists.tx

`

``

92

`+

index e40cb1b..ff2f920 100644

`

``

93

`+

--- a/swift-testing/Sources/Testing/CMakeLists.txt

`

``

94

`+

+++ b/swift-testing/Sources/Testing/CMakeLists.txt

`

``

95

`+

@@ -110,7 +110,10 @@ target_link_libraries(Testing PRIVATE

`

``

96

`+

if(NOT APPLE)

`

``

97

`+

if(NOT CMAKE_SYSTEM_NAME STREQUAL WASI)

`

``

98

`+

target_link_libraries(Testing PUBLIC

`

``

99

`+

`

``

100

`+

`

``

101

`+

`

``

102

`+

`

``

103

`+

`

``

104

`+

endif()

`

``

105

`+

target_link_libraries(Testing PUBLIC

`

``

106

`+

Foundation)

`

``

107

`+

diff --git a/swift-testing/cmake/modules/SwiftModuleInstallation.cmake b/swift-testing/cmake/modules/SwiftModuleInstallation.cmake

`

``

108

`+

index 1553725..d9f9e5b 100644

`

``

109

`+

--- a/swift-testing/cmake/modules/SwiftModuleInstallation.cmake

`

``

110

`+

+++ b/swift-testing/cmake/modules/SwiftModuleInstallation.cmake

`

``

111

`+

@@ -75,6 +75,10 @@ function(_swift_testing_install_target module)

`

``

112

`+

set(module_triple_command "${CMAKE_Swift_COMPILER}" -print-target-info)

`

``

113

`+

if(CMAKE_Swift_COMPILER_TARGET)

`

``

114

`+

list(APPEND module_triple_command -target ${CMAKE_Swift_COMPILER_TARGET})

`

``

115

`+

`

``

116

`+

`

``

117

`+

`

``

118

`+

`

``

119

`+

endif()

`

``

120

`+

execute_process(COMMAND ${module_triple_command} OUTPUT_VARIABLE target_info_json)

`

``

121

`+

string(JSON module_triple GET "${target_info_json}" "target" "moduleTriple")

`

``

122

`+

diff --git a/swift-testing/cmake/modules/TargetTriple.cmake b/swift-testing/cmake/modules/TargetTriple.cmake

`

``

123

`+

index e087cc4..02f3a95 100644

`

``

124

`+

--- a/swift-testing/cmake/modules/TargetTriple.cmake

`

``

125

`+

+++ b/swift-testing/cmake/modules/TargetTriple.cmake

`

``

126

`+

@@ -10,6 +10,10 @@

`

``

127

`+

set(SWT_TARGET_INFO_COMMAND "${CMAKE_Swift_COMPILER}" -print-target-info)

`

``

128

`+

if(CMAKE_Swift_COMPILER_TARGET)

`

``

129

`+

list(APPEND SWT_TARGET_INFO_COMMAND -target ${CMAKE_Swift_COMPILER_TARGET})

`

``

130

`+

+else()

`

``

131

`+

`

``

132

`+

`

``

133

`+

`

``

134

`+

endif()

`

``

135

`+

execute_process(COMMAND ${SWT_TARGET_INFO_COMMAND} OUTPUT_VARIABLE SWT_TARGET_INFO_JSON)

`

``

136

`+

string(JSON SWT_TARGET_TRIPLE GET "${SWT_TARGET_INFO_JSON}" "target" "unversionedTriple")

`