| 1036 | } |
| 1037 | |
| 1038 | static Result computeArtifactPath(const Build::Action& action, StringView projectName, |
| 1039 | Build::TargetType::Type targetType, String& executablePath) |
| 1040 | { |
| 1041 | String buildDirectory = StringEncoding::Utf8; |
| 1042 | SC_TRY(computeBuildDirectoryName(action, buildDirectory)); |
| 1043 | |
| 1044 | String artifactName = StringEncoding::Utf8; |
| 1045 | switch (targetType) |
| 1046 | { |
| 1047 | case Build::TargetType::ConsoleExecutable: |
| 1048 | case Build::TargetType::GUIApplication: |
| 1049 | if (action.parameters.platform == Build::Platform::Windows) |
| 1050 | { |
| 1051 | SC_TRY(StringBuilder::format(artifactName, "{}.exe", projectName)); |
| 1052 | } |
| 1053 | else |
| 1054 | { |
| 1055 | SC_TRY(artifactName.assign(projectName)); |
| 1056 | } |
| 1057 | break; |
| 1058 | case Build::TargetType::SharedLibrary: |
| 1059 | if (action.parameters.platform == Build::Platform::Windows) |
| 1060 | { |
| 1061 | SC_TRY(StringBuilder::format(artifactName, "{}.dll", projectName)); |
| 1062 | } |
| 1063 | else if (action.parameters.platform == Build::Platform::Apple) |
| 1064 | { |
| 1065 | SC_TRY(StringBuilder::format(artifactName, "{}.dylib", projectName)); |
| 1066 | } |
| 1067 | else |
| 1068 | { |
| 1069 | SC_TRY(StringBuilder::format(artifactName, "{}.so", projectName)); |
| 1070 | } |
| 1071 | break; |
| 1072 | case Build::TargetType::StaticLibrary: |
| 1073 | if (action.parameters.platform == Build::Platform::Windows) |
| 1074 | { |
| 1075 | SC_TRY(StringBuilder::format(artifactName, "{}.lib", projectName)); |
| 1076 | } |
| 1077 | else if (projectName.startsWith("lib")) |
| 1078 | { |
| 1079 | SC_TRY(StringBuilder::format(artifactName, "{}.a", projectName)); |
| 1080 | } |
| 1081 | else |
| 1082 | { |
| 1083 | SC_TRY(StringBuilder::format(artifactName, "lib{}.a", projectName)); |
| 1084 | } |
| 1085 | break; |
| 1086 | } |
| 1087 | |
| 1088 | SC_TRY(Path::join(executablePath, {action.parameters.directories.outputsDirectory.view(), buildDirectory.view(), |
| 1089 | artifactName.view()})); |
| 1090 | return Result(true); |
| 1091 | } |
| 1092 | |
| 1093 | static Result computeExecutablePath(const Build::Action& action, StringView projectName, String& executablePath) |
| 1094 | { |
no test coverage detected