Skip to content

Commit db0fc37

Browse files
authored
Merge pull request #15004 from github/alexdenisov/fix-swift-autobuilder-bug
Swift: fix autobuilder bug when Xcode failure breaks the whole autobuild process
2 parents 9fa20f5 + 8f3d318 commit db0fc37

File tree

9 files changed

+361
-7
lines changed

9 files changed

+361
-7
lines changed

swift/integration-tests/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
.build
3+
build
34
Packages
45
xcuserdata/
56
DerivedData/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
| Package.swift:0:0:0:0 | Package.swift |
2+
| Sources/hello-world/hello_world.swift:0:0:0:0 | Sources/hello-world/hello_world.swift |
3+
| codeql-swift-autobuild-test/AppDelegate.swift:0:0:0:0 | codeql-swift-autobuild-test/AppDelegate.swift |
4+
| file://:0:0:0:0 | |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import swift
2+
3+
from File f
4+
select f
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// swift-tools-version:5.5
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "hello-world",
8+
products: [
9+
// Products define the executables and libraries a package produces, and make them visible to other packages.
10+
.library(
11+
name: "hello-world",
12+
targets: ["hello-world"]),
13+
],
14+
targets: [
15+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
16+
// Targets can depend on other targets in this package, and on products in packages this package depends on.
17+
.target(
18+
name: "hello-world",
19+
dependencies: []),
20+
]
21+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public struct hello_world {
2+
public private(set) var text = "Hello, World!"
3+
4+
public init() {
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,310 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 56;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
46D4896F291B98000029E1E2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46D4896E291B98000029E1E2 /* AppDelegate.swift */; };
11+
/* End PBXBuildFile section */
12+
13+
/* Begin PBXFileReference section */
14+
46D4896B291B98000029E1E2 /* codeql-swift-autobuild-test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "codeql-swift-autobuild-test.app"; sourceTree = BUILT_PRODUCTS_DIR; };
15+
46D4896E291B98000029E1E2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
16+
/* End PBXFileReference section */
17+
18+
/* Begin PBXFrameworksBuildPhase section */
19+
46D48968291B98000029E1E2 /* Frameworks */ = {
20+
isa = PBXFrameworksBuildPhase;
21+
buildActionMask = 2147483647;
22+
files = (
23+
);
24+
runOnlyForDeploymentPostprocessing = 0;
25+
};
26+
/* End PBXFrameworksBuildPhase section */
27+
28+
/* Begin PBXGroup section */
29+
46D48962291B98000029E1E2 = {
30+
isa = PBXGroup;
31+
children = (
32+
46D4896D291B98000029E1E2 /* codeql-swift-autobuild-test */,
33+
46D4896C291B98000029E1E2 /* Products */,
34+
);
35+
sourceTree = "<group>";
36+
};
37+
46D4896C291B98000029E1E2 /* Products */ = {
38+
isa = PBXGroup;
39+
children = (
40+
46D4896B291B98000029E1E2 /* codeql-swift-autobuild-test.app */,
41+
);
42+
name = Products;
43+
sourceTree = "<group>";
44+
};
45+
46D4896D291B98000029E1E2 /* codeql-swift-autobuild-test */ = {
46+
isa = PBXGroup;
47+
children = (
48+
46D4896E291B98000029E1E2 /* AppDelegate.swift */,
49+
);
50+
path = "codeql-swift-autobuild-test";
51+
sourceTree = "<group>";
52+
};
53+
/* End PBXGroup section */
54+
55+
/* Begin PBXNativeTarget section */
56+
46D4896A291B98000029E1E2 /* codeql-swift-autobuild-test */ = {
57+
isa = PBXNativeTarget;
58+
buildConfigurationList = 46D4897A291B98020029E1E2 /* Build configuration list for PBXNativeTarget "codeql-swift-autobuild-test" */;
59+
buildPhases = (
60+
46D48967291B98000029E1E2 /* Sources */,
61+
46D48968291B98000029E1E2 /* Frameworks */,
62+
46D48969291B98000029E1E2 /* Resources */,
63+
);
64+
buildRules = (
65+
);
66+
dependencies = (
67+
);
68+
name = "codeql-swift-autobuild-test";
69+
productName = "codeql-swift-autobuild-test";
70+
productReference = 46D4896B291B98000029E1E2 /* codeql-swift-autobuild-test.app */;
71+
productType = "com.apple.product-type.application";
72+
};
73+
/* End PBXNativeTarget section */
74+
75+
/* Begin PBXProject section */
76+
46D48963291B98000029E1E2 /* Project object */ = {
77+
isa = PBXProject;
78+
attributes = {
79+
BuildIndependentTargetsInParallel = 1;
80+
LastSwiftUpdateCheck = 1400;
81+
LastUpgradeCheck = 1400;
82+
TargetAttributes = {
83+
46D4896A291B98000029E1E2 = {
84+
CreatedOnToolsVersion = 14.0;
85+
};
86+
};
87+
};
88+
buildConfigurationList = 46D48966291B98000029E1E2 /* Build configuration list for PBXProject "codeql-swift-autobuild-test" */;
89+
compatibilityVersion = "Xcode 14.0";
90+
developmentRegion = en;
91+
hasScannedForEncodings = 0;
92+
knownRegions = (
93+
en,
94+
);
95+
mainGroup = 46D48962291B98000029E1E2;
96+
productRefGroup = 46D4896C291B98000029E1E2 /* Products */;
97+
projectDirPath = "";
98+
projectRoot = "";
99+
targets = (
100+
46D4896A291B98000029E1E2 /* codeql-swift-autobuild-test */,
101+
);
102+
};
103+
/* End PBXProject section */
104+
105+
/* Begin PBXResourcesBuildPhase section */
106+
46D48969291B98000029E1E2 /* Resources */ = {
107+
isa = PBXResourcesBuildPhase;
108+
buildActionMask = 2147483647;
109+
files = (
110+
);
111+
runOnlyForDeploymentPostprocessing = 0;
112+
};
113+
/* End PBXResourcesBuildPhase section */
114+
115+
/* Begin PBXSourcesBuildPhase section */
116+
46D48967291B98000029E1E2 /* Sources */ = {
117+
isa = PBXSourcesBuildPhase;
118+
buildActionMask = 2147483647;
119+
files = (
120+
46D4896F291B98000029E1E2 /* AppDelegate.swift in Sources */,
121+
);
122+
runOnlyForDeploymentPostprocessing = 0;
123+
};
124+
/* End PBXSourcesBuildPhase section */
125+
126+
/* Begin XCBuildConfiguration section */
127+
46D48978291B98020029E1E2 /* Debug */ = {
128+
isa = XCBuildConfiguration;
129+
buildSettings = {
130+
ALWAYS_SEARCH_USER_PATHS = NO;
131+
CLANG_ANALYZER_NONNULL = YES;
132+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
133+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
134+
CLANG_ENABLE_MODULES = YES;
135+
CLANG_ENABLE_OBJC_ARC = YES;
136+
CLANG_ENABLE_OBJC_WEAK = YES;
137+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
138+
CLANG_WARN_BOOL_CONVERSION = YES;
139+
CLANG_WARN_COMMA = YES;
140+
CLANG_WARN_CONSTANT_CONVERSION = YES;
141+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
142+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
143+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
144+
CLANG_WARN_EMPTY_BODY = YES;
145+
CLANG_WARN_ENUM_CONVERSION = YES;
146+
CLANG_WARN_INFINITE_RECURSION = YES;
147+
CLANG_WARN_INT_CONVERSION = YES;
148+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
149+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
150+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
151+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
152+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
153+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
154+
CLANG_WARN_STRICT_PROTOTYPES = YES;
155+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
156+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
157+
CLANG_WARN_UNREACHABLE_CODE = YES;
158+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
159+
COPY_PHASE_STRIP = NO;
160+
DEBUG_INFORMATION_FORMAT = dwarf;
161+
ENABLE_STRICT_OBJC_MSGSEND = YES;
162+
ENABLE_TESTABILITY = YES;
163+
GCC_C_LANGUAGE_STANDARD = gnu11;
164+
GCC_DYNAMIC_NO_PIC = NO;
165+
GCC_NO_COMMON_BLOCKS = YES;
166+
GCC_OPTIMIZATION_LEVEL = 0;
167+
GCC_PREPROCESSOR_DEFINITIONS = (
168+
"DEBUG=1",
169+
"$(inherited)",
170+
);
171+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
172+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
173+
GCC_WARN_UNDECLARED_SELECTOR = YES;
174+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
175+
GCC_WARN_UNUSED_FUNCTION = YES;
176+
GCC_WARN_UNUSED_VARIABLE = YES;
177+
MACOSX_DEPLOYMENT_TARGET = 11.0;
178+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
179+
MTL_FAST_MATH = YES;
180+
ONLY_ACTIVE_ARCH = YES;
181+
SDKROOT = macosx;
182+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
183+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
184+
};
185+
name = Debug;
186+
};
187+
46D48979291B98020029E1E2 /* Release */ = {
188+
isa = XCBuildConfiguration;
189+
buildSettings = {
190+
ALWAYS_SEARCH_USER_PATHS = NO;
191+
CLANG_ANALYZER_NONNULL = YES;
192+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
193+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
194+
CLANG_ENABLE_MODULES = YES;
195+
CLANG_ENABLE_OBJC_ARC = YES;
196+
CLANG_ENABLE_OBJC_WEAK = YES;
197+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
198+
CLANG_WARN_BOOL_CONVERSION = YES;
199+
CLANG_WARN_COMMA = YES;
200+
CLANG_WARN_CONSTANT_CONVERSION = YES;
201+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
202+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
203+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
204+
CLANG_WARN_EMPTY_BODY = YES;
205+
CLANG_WARN_ENUM_CONVERSION = YES;
206+
CLANG_WARN_INFINITE_RECURSION = YES;
207+
CLANG_WARN_INT_CONVERSION = YES;
208+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
209+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
210+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
211+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
212+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
213+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
214+
CLANG_WARN_STRICT_PROTOTYPES = YES;
215+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
216+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
217+
CLANG_WARN_UNREACHABLE_CODE = YES;
218+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
219+
COPY_PHASE_STRIP = NO;
220+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
221+
ENABLE_NS_ASSERTIONS = NO;
222+
ENABLE_STRICT_OBJC_MSGSEND = YES;
223+
GCC_C_LANGUAGE_STANDARD = gnu11;
224+
GCC_NO_COMMON_BLOCKS = YES;
225+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
226+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
227+
GCC_WARN_UNDECLARED_SELECTOR = YES;
228+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
229+
GCC_WARN_UNUSED_FUNCTION = YES;
230+
GCC_WARN_UNUSED_VARIABLE = YES;
231+
MACOSX_DEPLOYMENT_TARGET = 11.0;
232+
MTL_ENABLE_DEBUG_INFO = NO;
233+
MTL_FAST_MATH = YES;
234+
SDKROOT = macosx;
235+
SWIFT_COMPILATION_MODE = wholemodule;
236+
SWIFT_OPTIMIZATION_LEVEL = "-O";
237+
};
238+
name = Release;
239+
};
240+
46D4897B291B98020029E1E2 /* Debug */ = {
241+
isa = XCBuildConfiguration;
242+
buildSettings = {
243+
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
244+
CODE_SIGN_STYLE = Automatic;
245+
COMBINE_HIDPI_IMAGES = YES;
246+
CURRENT_PROJECT_VERSION = 1;
247+
GENERATE_INFOPLIST_FILE = YES;
248+
INFOPLIST_KEY_NSHumanReadableCopyright = "";
249+
INFOPLIST_KEY_NSMainStoryboardFile = Main;
250+
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
251+
LD_RUNPATH_SEARCH_PATHS = (
252+
"$(inherited)",
253+
"@executable_path/../Frameworks",
254+
);
255+
MARKETING_VERSION = 1.0;
256+
PRODUCT_BUNDLE_IDENTIFIER = "com.github.codeql-swift-autobuild-test";
257+
PRODUCT_NAME = "$(TARGET_NAME)";
258+
SWIFT_EMIT_LOC_STRINGS = YES;
259+
SWIFT_VERSION = 5.0;
260+
};
261+
name = Debug;
262+
};
263+
46D4897C291B98020029E1E2 /* Release */ = {
264+
isa = XCBuildConfiguration;
265+
buildSettings = {
266+
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
267+
CODE_SIGN_STYLE = Automatic;
268+
COMBINE_HIDPI_IMAGES = YES;
269+
CURRENT_PROJECT_VERSION = 1;
270+
GENERATE_INFOPLIST_FILE = YES;
271+
INFOPLIST_KEY_NSHumanReadableCopyright = "";
272+
INFOPLIST_KEY_NSMainStoryboardFile = Main;
273+
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
274+
LD_RUNPATH_SEARCH_PATHS = (
275+
"$(inherited)",
276+
"@executable_path/../Frameworks",
277+
);
278+
MARKETING_VERSION = 1.0;
279+
PRODUCT_BUNDLE_IDENTIFIER = "com.github.codeql-swift-autobuild-test";
280+
PRODUCT_NAME = "$(TARGET_NAME)";
281+
SWIFT_EMIT_LOC_STRINGS = YES;
282+
SWIFT_VERSION = 5.0;
283+
};
284+
name = Release;
285+
};
286+
/* End XCBuildConfiguration section */
287+
288+
/* Begin XCConfigurationList section */
289+
46D48966291B98000029E1E2 /* Build configuration list for PBXProject "codeql-swift-autobuild-test" */ = {
290+
isa = XCConfigurationList;
291+
buildConfigurations = (
292+
46D48978291B98020029E1E2 /* Debug */,
293+
46D48979291B98020029E1E2 /* Release */,
294+
);
295+
defaultConfigurationIsVisible = 0;
296+
defaultConfigurationName = Release;
297+
};
298+
46D4897A291B98020029E1E2 /* Build configuration list for PBXNativeTarget "codeql-swift-autobuild-test" */ = {
299+
isa = XCConfigurationList;
300+
buildConfigurations = (
301+
46D4897B291B98020029E1E2 /* Debug */,
302+
46D4897C291B98020029E1E2 /* Release */,
303+
);
304+
defaultConfigurationIsVisible = 0;
305+
defaultConfigurationName = Release;
306+
};
307+
/* End XCConfigurationList section */
308+
};
309+
rootObject = 46D48963291B98000029E1E2 /* Project object */;
310+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Cocoa
2+
3+
#error("Expected to fail")
4+
5+
@main
6+
class AppDelegate: NSObject, NSApplicationDelegate {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from create_database_utils import *
2+
3+
runSuccessfully(['xcodebuild', 'clean'])
4+
runSuccessfully(['swift', 'package', 'clean'])
5+
run_codeql_database_create([], lang='swift', keep_trap=True)

0 commit comments

Comments
 (0)