Skip to content

Commit e925365

Browse files
authored
Merge pull request github#13087 from github/redsun82/swift-autobuilder-no-swift
Swift: surface errors about no viable swift targets found
2 parents 85841f6 + 5fcc5e1 commit e925365

File tree

34 files changed

+2292
-64
lines changed

34 files changed

+2292
-64
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"helpLinks": [
3+
"https://docs.github.com/en/enterprise-server/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning",
4+
"https://docs.github.com/en/enterprise-server/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language"
5+
],
6+
"plaintextMessage": "No viable Swift Xcode target was found but a Swift package was detected. Swift Package Manager builds are not yet supported by the autobuilder.\n\nSet up a manual build command.",
7+
"severity": "error",
8+
"source": {
9+
"extractorName": "swift",
10+
"id": "swift/autobuilder/spm-not-supported",
11+
"name": "Swift Package Manager build unsupported by autobuild"
12+
},
13+
"visibility": {
14+
"cliSummaryTable": true,
15+
"statusPage": true,
16+
"telemetry": true
17+
}
18+
}
Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 56;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
57B14B1A2A0A512A002820C5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 57B14B192A0A512A002820C5 /* main.m */; };
11+
/* End PBXBuildFile section */
12+
13+
/* Begin PBXCopyFilesBuildPhase section */
14+
57B14B142A0A512A002820C5 /* CopyFiles */ = {
15+
isa = PBXCopyFilesBuildPhase;
16+
buildActionMask = 2147483647;
17+
dstPath = /usr/share/man/man1/;
18+
dstSubfolderSpec = 0;
19+
files = (
20+
);
21+
runOnlyForDeploymentPostprocessing = 1;
22+
};
23+
/* End PBXCopyFilesBuildPhase section */
24+
25+
/* Begin PBXFileReference section */
26+
57B14B162A0A512A002820C5 /* hello-objective */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "hello-objective"; sourceTree = BUILT_PRODUCTS_DIR; };
27+
57B14B192A0A512A002820C5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
28+
/* End PBXFileReference section */
29+
30+
/* Begin PBXFrameworksBuildPhase section */
31+
57B14B132A0A512A002820C5 /* Frameworks */ = {
32+
isa = PBXFrameworksBuildPhase;
33+
buildActionMask = 2147483647;
34+
files = (
35+
);
36+
runOnlyForDeploymentPostprocessing = 0;
37+
};
38+
/* End PBXFrameworksBuildPhase section */
39+
40+
/* Begin PBXGroup section */
41+
57B14B0D2A0A512A002820C5 = {
42+
isa = PBXGroup;
43+
children = (
44+
57B14B182A0A512A002820C5 /* hello-objective */,
45+
57B14B172A0A512A002820C5 /* Products */,
46+
);
47+
sourceTree = "<group>";
48+
};
49+
57B14B172A0A512A002820C5 /* Products */ = {
50+
isa = PBXGroup;
51+
children = (
52+
57B14B162A0A512A002820C5 /* hello-objective */,
53+
);
54+
name = Products;
55+
sourceTree = "<group>";
56+
};
57+
57B14B182A0A512A002820C5 /* hello-objective */ = {
58+
isa = PBXGroup;
59+
children = (
60+
57B14B192A0A512A002820C5 /* main.m */,
61+
);
62+
path = "hello-objective";
63+
sourceTree = "<group>";
64+
};
65+
/* End PBXGroup section */
66+
67+
/* Begin PBXNativeTarget section */
68+
57B14B152A0A512A002820C5 /* hello-objective */ = {
69+
isa = PBXNativeTarget;
70+
buildConfigurationList = 57B14B1D2A0A512A002820C5 /* Build configuration list for PBXNativeTarget "hello-objective" */;
71+
buildPhases = (
72+
57B14B122A0A512A002820C5 /* Sources */,
73+
57B14B132A0A512A002820C5 /* Frameworks */,
74+
57B14B142A0A512A002820C5 /* CopyFiles */,
75+
);
76+
buildRules = (
77+
);
78+
dependencies = (
79+
);
80+
name = "hello-objective";
81+
productName = "hello-objective";
82+
productReference = 57B14B162A0A512A002820C5 /* hello-objective */;
83+
productType = "com.apple.product-type.tool";
84+
};
85+
/* End PBXNativeTarget section */
86+
87+
/* Begin PBXProject section */
88+
57B14B0E2A0A512A002820C5 /* Project object */ = {
89+
isa = PBXProject;
90+
attributes = {
91+
BuildIndependentTargetsInParallel = 1;
92+
LastUpgradeCheck = 1430;
93+
TargetAttributes = {
94+
57B14B152A0A512A002820C5 = {
95+
CreatedOnToolsVersion = 14.3;
96+
};
97+
};
98+
};
99+
buildConfigurationList = 57B14B112A0A512A002820C5 /* Build configuration list for PBXProject "hello-objective" */;
100+
compatibilityVersion = "Xcode 14.0";
101+
developmentRegion = en;
102+
hasScannedForEncodings = 0;
103+
knownRegions = (
104+
en,
105+
Base,
106+
);
107+
mainGroup = 57B14B0D2A0A512A002820C5;
108+
productRefGroup = 57B14B172A0A512A002820C5 /* Products */;
109+
projectDirPath = "";
110+
projectRoot = "";
111+
targets = (
112+
57B14B152A0A512A002820C5 /* hello-objective */,
113+
);
114+
};
115+
/* End PBXProject section */
116+
117+
/* Begin PBXSourcesBuildPhase section */
118+
57B14B122A0A512A002820C5 /* Sources */ = {
119+
isa = PBXSourcesBuildPhase;
120+
buildActionMask = 2147483647;
121+
files = (
122+
57B14B1A2A0A512A002820C5 /* main.m in Sources */,
123+
);
124+
runOnlyForDeploymentPostprocessing = 0;
125+
};
126+
/* End PBXSourcesBuildPhase section */
127+
128+
/* Begin XCBuildConfiguration section */
129+
57B14B1B2A0A512A002820C5 /* Debug */ = {
130+
isa = XCBuildConfiguration;
131+
buildSettings = {
132+
ALWAYS_SEARCH_USER_PATHS = NO;
133+
CLANG_ANALYZER_NONNULL = YES;
134+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
135+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
136+
CLANG_ENABLE_MODULES = YES;
137+
CLANG_ENABLE_OBJC_ARC = YES;
138+
CLANG_ENABLE_OBJC_WEAK = YES;
139+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
140+
CLANG_WARN_BOOL_CONVERSION = YES;
141+
CLANG_WARN_COMMA = YES;
142+
CLANG_WARN_CONSTANT_CONVERSION = YES;
143+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
144+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
145+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
146+
CLANG_WARN_EMPTY_BODY = YES;
147+
CLANG_WARN_ENUM_CONVERSION = YES;
148+
CLANG_WARN_INFINITE_RECURSION = YES;
149+
CLANG_WARN_INT_CONVERSION = YES;
150+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
151+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
152+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
153+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
154+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
155+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
156+
CLANG_WARN_STRICT_PROTOTYPES = YES;
157+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
158+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
159+
CLANG_WARN_UNREACHABLE_CODE = YES;
160+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
161+
COPY_PHASE_STRIP = NO;
162+
DEBUG_INFORMATION_FORMAT = dwarf;
163+
ENABLE_STRICT_OBJC_MSGSEND = YES;
164+
ENABLE_TESTABILITY = YES;
165+
GCC_C_LANGUAGE_STANDARD = gnu11;
166+
GCC_DYNAMIC_NO_PIC = NO;
167+
GCC_NO_COMMON_BLOCKS = YES;
168+
GCC_OPTIMIZATION_LEVEL = 0;
169+
GCC_PREPROCESSOR_DEFINITIONS = (
170+
"DEBUG=1",
171+
"$(inherited)",
172+
);
173+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
174+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
175+
GCC_WARN_UNDECLARED_SELECTOR = YES;
176+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
177+
GCC_WARN_UNUSED_FUNCTION = YES;
178+
GCC_WARN_UNUSED_VARIABLE = YES;
179+
MACOSX_DEPLOYMENT_TARGET = 13.2;
180+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
181+
MTL_FAST_MATH = YES;
182+
ONLY_ACTIVE_ARCH = YES;
183+
SDKROOT = macosx;
184+
};
185+
name = Debug;
186+
};
187+
57B14B1C2A0A512A002820C5 /* 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 = 13.2;
232+
MTL_ENABLE_DEBUG_INFO = NO;
233+
MTL_FAST_MATH = YES;
234+
SDKROOT = macosx;
235+
};
236+
name = Release;
237+
};
238+
57B14B1E2A0A512A002820C5 /* Debug */ = {
239+
isa = XCBuildConfiguration;
240+
buildSettings = {
241+
CODE_SIGN_STYLE = Automatic;
242+
PRODUCT_NAME = "$(TARGET_NAME)";
243+
};
244+
name = Debug;
245+
};
246+
57B14B1F2A0A512A002820C5 /* Release */ = {
247+
isa = XCBuildConfiguration;
248+
buildSettings = {
249+
CODE_SIGN_STYLE = Automatic;
250+
PRODUCT_NAME = "$(TARGET_NAME)";
251+
};
252+
name = Release;
253+
};
254+
/* End XCBuildConfiguration section */
255+
256+
/* Begin XCConfigurationList section */
257+
57B14B112A0A512A002820C5 /* Build configuration list for PBXProject "hello-objective" */ = {
258+
isa = XCConfigurationList;
259+
buildConfigurations = (
260+
57B14B1B2A0A512A002820C5 /* Debug */,
261+
57B14B1C2A0A512A002820C5 /* Release */,
262+
);
263+
defaultConfigurationIsVisible = 0;
264+
defaultConfigurationName = Release;
265+
};
266+
57B14B1D2A0A512A002820C5 /* Build configuration list for PBXNativeTarget "hello-objective" */ = {
267+
isa = XCConfigurationList;
268+
buildConfigurations = (
269+
57B14B1E2A0A512A002820C5 /* Debug */,
270+
57B14B1F2A0A512A002820C5 /* Release */,
271+
);
272+
defaultConfigurationIsVisible = 0;
273+
defaultConfigurationName = Release;
274+
};
275+
/* End XCConfigurationList section */
276+
};
277+
rootObject = 57B14B0E2A0A512A002820C5 /* Project object */;
278+
}

swift/integration-tests/osx-only/autobuilder/no-swift-with-spm/hello-objective.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// swift-tools-version:5.0
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// main.m
3+
// hello-objective
4+
//
5+
// Created by ec2-user on 5/9/23.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
int main(int argc, const char * argv[]) {
11+
@autoreleasepool {
12+
// insert code here...
13+
NSLog(@"Hello, World!");
14+
}
15+
return 0;
16+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from create_database_utils import *
2+
from diagnostics_test_utils import *
3+
4+
run_codeql_database_create([], lang='swift', keep_trap=True, db=None, runFunction=runUnsuccessfully)
5+
check_diagnostics()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"helpLinks": [
3+
"https://docs.github.com/en/enterprise-server/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning",
4+
"https://docs.github.com/en/enterprise-server/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-language"
5+
],
6+
"plaintextMessage": "All targets found within Xcode projects or workspaces either have no Swift sources or are tests.\n\nSet up a manual build command.",
7+
"severity": "error",
8+
"source": {
9+
"extractorName": "swift",
10+
"id": "swift/autobuilder/no-swift-target",
11+
"name": "No Swift compilation target found"
12+
},
13+
"visibility": {
14+
"cliSummaryTable": true,
15+
"statusPage": true,
16+
"telemetry": true
17+
}
18+
}

0 commit comments

Comments
 (0)