mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Swift: separate installation of dependencies and autobuilding
`pod install` could generate Xcode projects files needed for autobuilding, so it's better to install dependencies first, and then do re-scan to pick up the new files.
This commit is contained in:
@@ -54,6 +54,11 @@ static bool buildSwiftPackages(const std::vector<std::filesystem::path>& swiftPa
|
|||||||
return any_successful;
|
return any_successful;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void installDependencies(const CLIArgs& args) {
|
||||||
|
auto structure = scanProjectStructure(args.workingDir);
|
||||||
|
installDependencies(structure, args.dryRun);
|
||||||
|
}
|
||||||
|
|
||||||
static bool autobuild(const CLIArgs& args) {
|
static bool autobuild(const CLIArgs& args) {
|
||||||
auto structure = scanProjectStructure(args.workingDir);
|
auto structure = scanProjectStructure(args.workingDir);
|
||||||
auto& xcodeTargets = structure.xcodeTargets;
|
auto& xcodeTargets = structure.xcodeTargets;
|
||||||
@@ -82,7 +87,6 @@ static bool autobuild(const CLIArgs& args) {
|
|||||||
return false;
|
return false;
|
||||||
} else if (!xcodeTargets.empty()) {
|
} else if (!xcodeTargets.empty()) {
|
||||||
LOG_INFO("Building Xcode target: {}", xcodeTargets.front());
|
LOG_INFO("Building Xcode target: {}", xcodeTargets.front());
|
||||||
installDependencies(structure, args.dryRun);
|
|
||||||
auto buildSucceeded = buildXcodeTarget(xcodeTargets.front(), args.dryRun);
|
auto buildSucceeded = buildXcodeTarget(xcodeTargets.front(), args.dryRun);
|
||||||
// If build failed, try to build Swift packages
|
// If build failed, try to build Swift packages
|
||||||
if (!buildSucceeded && !swiftPackages.empty()) {
|
if (!buildSucceeded && !swiftPackages.empty()) {
|
||||||
@@ -113,6 +117,7 @@ static CLIArgs parseCLIArgs(int argc, char** argv) {
|
|||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
auto args = parseCLIArgs(argc, argv);
|
auto args = parseCLIArgs(argc, argv);
|
||||||
|
installDependencies(args);
|
||||||
auto success = autobuild(args);
|
auto success = autobuild(args);
|
||||||
codeql::Log::flush();
|
codeql::Log::flush();
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user