File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
main/java/jenkins/plugins/clangscanbuild
test/java/jenkins/plugins/clangscanbuild/commands Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -64,11 +64,17 @@ public void setInstallations( ClangScanBuildToolInstallation[] clangInstallation
64
64
save ();
65
65
}
66
66
67
+ public FormValidation doCheckTarget ( @ QueryParameter String value ) throws IOException , ServletException {
68
+ if ( value .length () == 0 ) return FormValidation .error ( "You must provide a target." );
69
+ return FormValidation .ok ();
70
+ }
71
+
72
+
67
73
public FormValidation doCheckTargetSdk ( @ QueryParameter String value ) throws IOException , ServletException {
68
74
if ( value .length () == 0 ) return FormValidation .error ( "You must provide a target SDK. You can execute 'xcodebuild -showsdks' from Terminal.app to see allowed values." );
69
75
return FormValidation .ok ();
70
76
}
71
-
77
+
72
78
// CONFIG
73
79
public FormValidation doCheckConfig ( @ QueryParameter String value ) throws IOException , ServletException {
74
80
if ( value .length () == 0 ) return FormValidation .warning ( "If no build configuration is provided, the project's 'active' build configuration will be used automatically." );
Original file line number Diff line number Diff line change 1
1
package jenkins .plugins .clangscanbuild .commands ;
2
2
3
3
import hudson .FilePath ;
4
+ import hudson .model .Failure ;
4
5
import hudson .util .ArgumentListBuilder ;
5
6
import jenkins .plugins .clangscanbuild .CommandExecutor ;
6
7
@@ -68,11 +69,10 @@ public int execute( BuildContext context ) throws Exception {
68
69
}
69
70
}else {
70
71
// Xcode standalone project
71
- if ( isNotBlank ( getTarget () ) ){
72
- args .add ( "-target" , getTarget () );
73
- }else {
74
- args .add ( "-activetarget" );
72
+ if ( isBlank ( getTarget () ) ){
73
+ throw new Failure ("No target specified" );
75
74
}
75
+ args .add ( "-target" , getTarget () );
76
76
}
77
77
78
78
//These items can be provided with a target or can be used to override a workspace/scheme
Original file line number Diff line number Diff line change @@ -21,10 +21,11 @@ public void onlyRequiredOptionsSet() throws Exception{
21
21
command .setClangOutputFolder ( new FilePath ( new File ( "OutputFolder" ) ) );
22
22
command .setClangScanBuildPath ( "/ScanBuild" );
23
23
command .setProjectDirectory ( new FilePath ( new File ( "/ProjectDir" ) ) );
24
+ command .setTarget ( "myTarget" );
24
25
25
26
String actual = buildCommandAndReturn ( command );
26
27
27
- String expected = "/ScanBuild -k -v -v -o OutputFolder xcodebuild -activetarget -configuration Debug clean analyze" ;
28
+ String expected = "/ScanBuild -k -v -v -o OutputFolder xcodebuild -target myTarget -configuration Debug clean analyze" ;
28
29
Assert .assertEquals ( expected , actual );
29
30
}
30
31
You can’t perform that action at this time.
0 commit comments