-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "legacy" parameter required by Xcode 16 (#97)
* Add "legacy" parameter required by Xcode 16 * Add XcodeResultLegacyRunner to check xcoderesulttool version and add legacy flag if needed
- Loading branch information
1 parent
e6b330c
commit 97eb40c
Showing
10 changed files
with
234 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...in/src/main/java/fr/insideapp/sonarqube/apple/xcode/legacy/XcodeResultLegacyRunnable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* SonarQube Apple Plugin - Enables analysis of Swift and Objective-C projects into SonarQube. | ||
* Copyright © 2022 inside|app (contact@insideapp.fr) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package fr.insideapp.sonarqube.apple.xcode.legacy; | ||
|
||
import fr.insideapp.sonarqube.apple.commons.cli.SingleCommandLineToolRunner; | ||
import org.sonar.api.scanner.ScannerSide; | ||
|
||
@ScannerSide | ||
public abstract class XcodeResultLegacyRunnable extends SingleCommandLineToolRunner { | ||
protected XcodeResultLegacyRunnable(String command) { | ||
super(command); | ||
} | ||
|
||
public abstract boolean check(); | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
...ugin/src/main/java/fr/insideapp/sonarqube/apple/xcode/legacy/XcodeResultLegacyRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* SonarQube Apple Plugin - Enables analysis of Swift and Objective-C projects into SonarQube. | ||
* Copyright © 2022 inside|app (contact@insideapp.fr) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package fr.insideapp.sonarqube.apple.xcode.legacy; | ||
|
||
import org.sonar.api.scanner.ScannerSide; | ||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
@ScannerSide | ||
public final class XcodeResultLegacyRunner extends XcodeResultLegacyRunnable { | ||
|
||
private static final Integer MIN_VERSION = 23_021; | ||
|
||
private static final Pattern PATTERN = Pattern.compile("xcresulttool version (?<version>\\d+),.*"); | ||
|
||
public XcodeResultLegacyRunner() { | ||
super("xcrun"); | ||
} | ||
|
||
protected String[] arguments() { | ||
return new String[]{ | ||
"xcresulttool", "version" | ||
}; | ||
} | ||
|
||
public boolean check() { | ||
String result = run(arguments()).trim(); | ||
Matcher versionMatcher = PATTERN.matcher(result); | ||
if (versionMatcher.find()) { | ||
try { | ||
int version = Integer.parseInt(versionMatcher.group("version")); | ||
return version >= MIN_VERSION; | ||
} catch (NumberFormatException e) { | ||
return false; | ||
} | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
.../src/test/java/fr/insideapp/sonarqube/apple/xcode/legacy/XcodeResultLegacyRunnerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* SonarQube Apple Plugin - Enables analysis of Swift and Objective-C projects into SonarQube. | ||
* Copyright © 2022 inside|app (contact@insideapp.fr) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package fr.insideapp.sonarqube.apple.xcode.legacy; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public final class XcodeResultLegacyRunnerTest { | ||
|
||
private XcodeResultLegacyRunner runner; | ||
|
||
@Before | ||
public void prepare() { | ||
runner = new XcodeResultLegacyRunner(); | ||
} | ||
|
||
@Test | ||
public void arguments() { | ||
String[] options = runner.arguments(); | ||
assertThat(options).isEqualTo(new String[]{ | ||
"xcresulttool", | ||
"version", | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters