Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
Add support for names containing space characters in workspace, proje…
Browse files Browse the repository at this point in the history
…cts or schemes.
  • Loading branch information
Ignacio Bonafonte committed Mar 13, 2020
1 parent e844254 commit 3bdb9a3
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1005,17 +1005,17 @@ async function run() {

if (workspace) {
console.log(`Workspace selected: ${workspace}`);
projectParameter = "-workspace " + workspace;
projectParameter = "-workspace " + `"${workspace}"`;
} else if (xcodeproj) {
console.log(`Project selected: ${xcodeproj}`);
projectParameter = "-project " + xcodeproj;
projectParameter = "-project " + `"${xcodeproj}"`;
} else if (fs.existsSync("Package.swift")) {
if (core.getInput("forceSPM") === "true") {
await swiftPackageRun(extraParameters, codePathEnabled, agentVersion);
return;
} else {
xcodeproj = await generateProjectFromSPM();
projectParameter = "-project " + xcodeproj;
projectParameter = "-project " + `"${xcodeproj}"`;
}
} else {
core.setFailed(
Expand Down Expand Up @@ -1051,18 +1051,17 @@ async function run() {
" -configuration " +
configuration +
" -scheme " +
scheme +
`"${scheme}"` +
" -sdk " +
sdk +
" -derivedDataPath " +
derivedDataPath +
' -destination "' +
destination +
'"' +
" -destination " +
`"${destination}" ` +
extraParameters;
const result = await exec.exec(buildCommand, null, null);

uploadSymbols(projectParameter, scheme, dsn, scopeFrameworkToolsPath);
uploadSymbols(projectParameter, dsn, scopeFrameworkToolsPath);

//Fol all testruns that are configured
let testRuns = await getXCTestRuns();
Expand All @@ -1072,7 +1071,7 @@ async function run() {
//modify xctestrun with Scope variables

let plutilExportCommand =
"plutil -convert json -o " + testrunJson + " " + testRun;
"plutil -convert json -o " + testrunJson + ` "${testRun}"`;
await exec.exec(plutilExportCommand, null, null);

let jsonString = fs.readFileSync(testrunJson, "utf8");
Expand Down Expand Up @@ -1108,7 +1107,7 @@ async function run() {
"xcodebuild test-without-building " +
codeCoverParam +
" -xctestrun " +
testRun +
`"${testRun}"` +
' -destination "' +
destination +
'"' +
Expand All @@ -1130,14 +1129,13 @@ async function run() {
" " +
projectParameter +
" -scheme " +
scheme +
`"${scheme}"` +
" -sdk " +
sdk +
" -derivedDataPath " +
derivedDataPath +
' -destination "' +
destination +
'"' +
" -destination " +
`"${destination}" ` +
extraParameters;
let auxOutput = "";
const options = {};
Expand Down Expand Up @@ -1199,6 +1197,7 @@ async function swiftPackageRun(extraParameters, codePathEnabled, agentVersion) {
" " +
" -Xswiftc -framework -Xswiftc ScopeAgent -Xlinker -rpath -Xlinker " +
scopeMacFrameworkPath +
" " +
extraParameters;

let testError;
Expand Down Expand Up @@ -1430,7 +1429,7 @@ const downloadFile = async (url, path) => {
});
};

function uploadSymbols(projectParameter, scheme, dsn, scopeFrameworkToolsPath) {
function uploadSymbols(projectParameter, dsn, scopeFrameworkToolsPath) {
let runScriptCommand =
"sh -c " + scopeDir + scopeFrameworkToolsPath + "upload_symbols";
exec.exec(runScriptCommand, null, {
Expand Down Expand Up @@ -1534,8 +1533,7 @@ async function insertEnvVariable(name, value, file, target) {
name +
'" -string ' +
value +
" " +
file;
` "${file}"`;
await exec.exec(insertCommand, null, null);
}
}
Expand Down

0 comments on commit 3bdb9a3

Please sign in to comment.