Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in xcode task when project argument is specified and workspac… #2162

Merged
merged 1 commit into from
Jul 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tasks/Xcode/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": {
"Major": 2,
"Minor": 1,
"Patch": 21
"Patch": 22
},
"demands": [
"xcode"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Xcode/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": {
"Major": 2,
"Minor": 1,
"Patch": 21
"Patch": 22
},
"demands": [
"xcode"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Xcode/xcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async function run() {
var xcb: ToolRunner = tl.createToolRunner(tool);
xcb.argIf(sdk, ['-sdk', sdk]);
xcb.argIf(configuration, ['-configuration', configuration]);
if(ws) {
if(ws && tl.filePathSupplied('xcWorkspacePath')) {
xcb.arg('-workspace');
xcb.pathArg(ws);
}
Expand Down
52 changes: 52 additions & 0 deletions Tests/L0/Xcode/_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,58 @@ describe('Xcode Suite', function() {
})
})

it('run Xcode with project and no workspace', (done) => {
setResponseFile('responseProject.json');

var tr = new trm.TaskRunner('Xcode', true, true);
tr.setInput('actions', 'build');
tr.setInput('configuration', '$(Configuration)');
tr.setInput('sdk', '$(SDK)');
tr.setInput('xcWorkspacePath', '/user/build');
tr.setInput('scheme', '');
tr.setInput('packageApp', 'true');
tr.setInput('signMethod', 'file');
tr.setInput('p12', '/user/build');
tr.setInput('p12pwd', '');
tr.setInput('provProfile', '/user/build');
tr.setInput('removeProfile', 'false');
tr.setInput('unlockDefaultKeychain', 'false');
tr.setInput('defaultKeychainPassword', '');
tr.setInput('iosSigningIdentity', '');
tr.setInput('provProfileUuid', '');
tr.setInput('args', '-project test.xcodeproj');
tr.setInput('cwd', '/user/build');
tr.setInput('outputPattern', 'output/$(SDK)/$(Configuration)');
tr.setInput('xcodeDeveloperDir', '');
tr.setInput('useXctool', 'false');
tr.setInput('xctoolReporter', '');
tr.setInput('publishJUnitResults', 'false');

tr.run()
.then(() => {
assert(tr.ran('/home/bin/xcodebuild -version'), 'xcodebuild for version should have been run.');
assert(tr.ran('/home/bin/xcodebuild -sdk $(SDK) -configuration $(Configuration) ' +
'build DSTROOT=/user/build/output/$(SDK)/$(Configuration)/build.dst ' +
'OBJROOT=/user/build/output/$(SDK)/$(Configuration)/build.obj ' +
'SYMROOT=/user/build/output/$(SDK)/$(Configuration)/build.sym ' +
'SHARED_PRECOMPS_DIR=/user/build/output/$(SDK)/$(Configuration)/build.pch ' +
'-project test.xcodeproj'),
'xcodebuild for building the ios project should have been run.');
assert(tr.ran('/home/bin/xcrun -sdk $(SDK) PackageApplication ' +
'-v /user/build/output/$(SDK)/$(Configuration)/build.sym/Release.iphoneos/fun.app ' +
'-o /user/build/output/$(SDK)/$(Configuration)/build.sym/Release.iphoneos/fun.ipa'),
"xcrun to package the app and generate an .ipa should have been run.");
assert(tr.invokedToolCount == 3, 'should have xcodebuild for version, xcodebuild for build and xcrun for packaging');
assert(tr.resultWasSet, 'task should have set a result');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');
done();
})
.fail((err) => {
done(err);
})
})

it('run Xcode build with test action, publish test results', (done) => {
setResponseFile('responseXctool.json');

Expand Down
2 changes: 1 addition & 1 deletion Tests/L0/Xcode/responseErrorArgs.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"code": 0,
"stdout": "Xcode 7.3.1"
},
"/home/bin/xcodebuild -workspace /user/build build DSTROOT=/user/build/output/$(SDK)/$(Configuration)/build.dst OBJROOT=/user/build/output/$(SDK)/$(Configuration)/build.obj SYMROOT=/user/build/output/$(SDK)/$(Configuration)/build.sym SHARED_PRECOMPS_DIR=/user/build/output/$(SDK)/$(Configuration)/build.pch" : {
"/home/bin/xcodebuild build DSTROOT=/user/build/output/$(SDK)/$(Configuration)/build.dst OBJROOT=/user/build/output/$(SDK)/$(Configuration)/build.obj SYMROOT=/user/build/output/$(SDK)/$(Configuration)/build.sym SHARED_PRECOMPS_DIR=/user/build/output/$(SDK)/$(Configuration)/build.pch": {
"code": 0,
"stdout": "xcodebuild output here"
}
Expand Down
33 changes: 33 additions & 0 deletions Tests/L0/Xcode/responseProject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"which": {
"xcodebuild": "/home/bin/xcodebuild",
"xcrun": "/home/bin/xcrun"
},
"checkPath" : {
"/home/bin/xcodebuild": true,
"/home/bin/xcrun": true
},
"getVariable": {
"build.sourcesDirectory": "/user/build",
"HOME": "/users/test"
},
"glob": {
"/user/build/output/$(SDK)/$(Configuration)/build.sym/**/*.app": [
"/user/build/output/$(SDK)/$(Configuration)/build.sym/Release.iphoneos/fun.app"
]
},
"exec": {
"/home/bin/xcodebuild -version": {
"code": 0,
"stdout": "Xcode 7.3.1"
},
"/home/bin/xcodebuild -sdk $(SDK) -configuration $(Configuration) build DSTROOT=/user/build/output/$(SDK)/$(Configuration)/build.dst OBJROOT=/user/build/output/$(SDK)/$(Configuration)/build.obj SYMROOT=/user/build/output/$(SDK)/$(Configuration)/build.sym SHARED_PRECOMPS_DIR=/user/build/output/$(SDK)/$(Configuration)/build.pch -project test.xcodeproj": {
"code": 0,
"stdout": "xcodebuild output here"
},
"/home/bin/xcrun -sdk $(SDK) PackageApplication -v /user/build/output/$(SDK)/$(Configuration)/build.sym/Release.iphoneos/fun.app -o /user/build/output/$(SDK)/$(Configuration)/build.sym/Release.iphoneos/fun.ipa": {
"code": 0,
"stdout": "xcrun output here"
}
}
}