Created
July 29, 2019 18:07
-
-
Save TsuyoshiUshio/3792489dcbbfa97f2152da6c8c2d5955 to your computer and use it in GitHub Desktop.
XCode custom task sample
This file contains hidden or 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
| import ma = require('azure-pipelines-task-lib/mock-answer'); | |
| import tmrm = require('azure-pipelines-task-lib/mock-run'); | |
| import path = require('path'); | |
| let taskPath = path.join(__dirname, '..', 'xcode.js'); | |
| let tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); | |
| process.env['HOME'] = '/users/test'; //replace with mock of setVariable when task-lib has the support | |
| // Xcode task defaults used for version 5 | |
| tr.setInput('actions', 'build'); | |
| tr.setInput('configuration', '$(Configuration)'); | |
| tr.setInput('sdk', '$(SDK)'); | |
| tr.setInput('xcWorkspacePath', '**/*.xcodeproj/*.xcworkspace'); | |
| tr.setInput('scheme', 'myscheme'); | |
| tr.setInput('packageApp', 'false'); | |
| tr.setInput('signingOption', 'default'); | |
| tr.setInput('signingIdentity', ''); | |
| tr.setInput('provisioningProfileUuid', ''); | |
| tr.setInput('args', ''); | |
| tr.setInput('cwd', '/user/build'); | |
| tr.setInput('xcodeVersion', 'default'); | |
| tr.setInput('xcodeDeveloperDir', ''); | |
| tr.setInput('publishJUnitResults', 'false'); | |
| // provide answers for task mock | |
| let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{ | |
| "which": { | |
| "xcodebuild": "/home/bin/xcodebuild" | |
| }, | |
| "checkPath" : { | |
| "/home/bin/xcodebuild": true | |
| }, | |
| "getVariable": { | |
| "build.sourcesDirectory": "/user/build", | |
| "HOME": "/users/test" | |
| }, | |
| "findMatch": { | |
| "**/*.xcodeproj/*.xcworkspace": [ | |
| "/user/build/fun.xcodeproj/project.xcworkspace" | |
| ], | |
| "**/*.app": [ | |
| "/user/build/output/$(SDK)/$(Configuration)/build.sym/Release.iphoneos/fun.app" | |
| ] | |
| }, | |
| "exec": { | |
| "/home/bin/xcodebuild -version": { | |
| "code": 0, | |
| "stdout": "Xcode 7.2.1" | |
| }, | |
| "/home/bin/xcodebuild -sdk $(SDK) -configuration $(Configuration) -workspace /user/build/fun.xcodeproj/project.xcworkspace -scheme myscheme build": { | |
| "code": 0, | |
| "stdout": "xcodebuild output here" | |
| } | |
| } | |
| }; | |
| tr.setAnswers(a); | |
| tr.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment