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

Users/madhurig/xamarinios #2788

Merged
merged 3 commits into from
Oct 5, 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
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,13 @@
"loc.input.label.provProfile": "Provisioning Profile File",
"loc.input.help.provProfile": "Optional relative path to file containing provisioning profile override to be used for this build.",
"loc.input.label.removeProfile": "Remove Profile After Build",
"loc.input.help.removeProfile": "Specifies that the contents of the Provisioning Profile File should be removed from the build agent after the build is complete. **Only check if you are running one agent per user.**"
"loc.input.help.removeProfile": "Specifies that the contents of the Provisioning Profile File should be removed from the build agent after the build is complete. **Only check if you are running one agent per user.**",
"loc.messages.SignIdNotFound": "Failed to find iOS signing identity. Verify the signing and provisioning information provided.",
"loc.messages.TempKeychainSetupFailed": "Failed to add the temporary keychain to the keychains search path.",
"loc.messages.ProvProfileDetailsNotFound": "Failed to find the details for provisioning profile: %s",
"loc.messages.ProvProfileUUIDNotFound": "Failed to find provisioning profile UUID for provisioning profile: %s",
"loc.messages.TempKeychainDeleteFailed": "Failed to delete temporary keychain %s created during the build.",
"loc.messages.ProvProfileDeleteFailed": "Failed to delete the provisioning profile %s.",
"loc.messages.XamariniOSSucceeded": "XamariniOS task execution completed with no errors.",
"loc.messages.XamariniOSFailed": "XamariniOS task failed with error %s. For guidance on setting up the build definition, see https://go.microsoft.com/fwlink/?LinkId=760847."
}
52 changes: 52 additions & 0 deletions Tasks/XamariniOS/Tests/L0.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// npm install mocha --save-dev
// typings install dt~mocha --save --global

import * as path from 'path';
import * as assert from 'assert';
import * as ttm from 'vsts-task-lib/mock-test';

describe('XamariniOS L0 Suite', function () {
before(() => {

});

after(() => {

});

it('XamariniOS signing with identifiers', (done:MochaDone) => {
this.timeout(1000);

let tp = path.join(__dirname, 'L0SignWithIds.js');
let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();

assert(tr.ran('/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone ' +
'/p:Codesignkey=testSignIdentity /p:CodesignProvision=testUUID'),
'xbuild should have run with codesign for IDs');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');

done();
});

it('XamariniOS signing with files', (done:MochaDone) => {
this.timeout(1000);

let tp = path.join(__dirname, 'L0SignWithFiles.js');
let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);

tr.run();

assert(tr.ran('/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone ' +
'/p:CodesignKeychain=/user/build/_xamariniostasktmp.keychain ' +
'/p:Codesignkey=iPhone Developer: XamariniOS Tester (HE432Y3E2Q) /p:CodesignProvision=testuuid'),
'xbuild should have run with codesigning with files');
assert(tr.stderr.length == 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');

done();
});

});
116 changes: 116 additions & 0 deletions Tasks/XamariniOS/Tests/L0SignWithFiles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@

import ma = require('vsts-task-lib/mock-answer');
import tmrm = require('vsts-task-lib/mock-run');
import path = require('path');

let taskPath = path.join(__dirname, '..', 'XamariniOS.js');
let tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);

process.env['HOME']='/user/home'; //replace with mock of setVariable when task-lib has the support

tr.setInput('solution', 'src/project.sln'); //path
tr.setInput('configuration', 'Release');
tr.setInput('args', '');
tr.setInput('packageApp', ''); //boolean
tr.setInput('forSimulator', ''); //boolean
tr.setInput('signMethod', 'file');
tr.setInput('unlockDefaultKeychain', ''); //boolean
tr.setInput('defaultKeychainPassword', '');
tr.setInput('p12', '/user/build/cert.p12'); //path
tr.setInput('p12pwd', 'p12password');
tr.setInput('iosSigningIdentity', '');
tr.setInput('provProfileUuid', '');
tr.setInput('provProfile', '/user/build/testuuid.mobileprovision'); //path
tr.setInput('removeProfile', ''); //boolean
tr.setInput('cwd', '/user/build');

// provide answers for task mock
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"getVariable": {
"HOME": "/user/home"
},
"which": {
"xbuild": "/home/bin/xbuild",
"nuget": "/home/bin/nuget",
"security": "/usr/bin/security",
"/usr/libexec/PlistBuddy": "/usr/libexec/PlistBuddy",
"rm": "/bin/rm",
"cp": "/bin/cp"
},
"exec": {
"/home/bin/nuget restore src/project.sln": {
"code": 0,
"stdout": "nuget restore"
},
"/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /p:CodesignKeychain=/user/build/_xamariniostasktmp.keychain /p:Codesignkey=iPhone Developer: XamariniOS Tester (HE432Y3E2Q) /p:CodesignProvision=testuuid": {
"code": 0,
"stdout": "xbuild"
},
"/usr/bin/security create-keychain -p _xamariniostask_TmpKeychain_Pwd#1 /user/build/_xamariniostasktmp.keychain" : {
"code": 0,
"stdout": "temporary keychain created"
},
"/usr/bin/security set-keychain-settings -lut 7200 /user/build/_xamariniostasktmp.keychain": {
"code": 0,
"stdout": "set-keychain-settings on temporary keychain output"
},
"/usr/bin/security unlock-keychain -p _xamariniostask_TmpKeychain_Pwd#1 /user/build/_xamariniostasktmp.keychain": {
"code": 0,
"stdout": "temporary keychain unlocked"
},
"/usr/bin/security import /user/build/cert.p12 -P p12password -A -t cert -f pkcs12 -k /user/build/_xamariniostasktmp.keychain": {
"code": 0,
"stdout": "p12 imported into temporary keychain"
},
"/usr/bin/security find-identity -v -p codesigning /user/build/_xamariniostasktmp.keychain" : {
"code": 0,
"stdout": "1) 5229BFC905F473E52FAD51208174528106966930 \"iPhone Developer: XamariniOS Tester (HE432Y3E2Q)\"\n 1 valid identities found"
},
"/usr/bin/security cms -D -i /user/build/testuuid.mobileprovision": {
"code": 0,
"stdout": "prov profile details here"
},
"/usr/libexec/PlistBuddy -c Print UUID _xcodetasktmp.plist": {
"code": 0,
"stdout": "testuuid"
},
"/bin/rm -f _xcodetasktmp.plist": {
"code": 0,
"stdout": "delete output here"
},
"/usr/bin/security list-keychain -d user" : {
"code": 0,
"stdout": "/User/test/Library/Keychains/login.keychain \n /user/build/_xamariniostasktmp.keychain"
},
"/usr/bin/security list-keychain -d user -s /user/build/_xamariniostasktmp.keychain /User/test/Library/Keychains/login.keychain /user/build/_xamariniostasktmp.keychain": {
"code": 0,
"stdout": "list-keychain output here"
},
"/bin/cp -f /user/build/testuuid.mobileprovision /user/home/Library/MobileDevice/Provisioning Profiles/testuuid.mobileprovision" : {
"code": 0,
"stdout": "provisioning profile copied"
}
},
"checkPath" : {
"/home/bin/xbuild": true,
"/home/bin/nuget": true,
"src/project.sln": true,
"/usr/bin/security": true,
"/usr/libexec/PlistBuddy": true,
"/bin/rm": true,
"/bin/cp": true
},
"exist": {
"/user/build/cert.p12": true,
"/user/build/testuuid.mobileprovision": true
},
"stats": {
"/user/build": {
"isFile": false
}
}
};
tr.setAnswers(a);

tr.run();

55 changes: 55 additions & 0 deletions Tasks/XamariniOS/Tests/L0SignWithIds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

import ma = require('vsts-task-lib/mock-answer');
import tmrm = require('vsts-task-lib/mock-run');
import path = require('path');

let taskPath = path.join(__dirname, '..', 'XamariniOS.js');
let tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath);

process.env['HOME']='/user/home'; //replace with mock of setVariable when task-lib has the support

tr.setInput('solution', 'src/project.sln'); //path
tr.setInput('configuration', 'Release');
tr.setInput('args', '');
tr.setInput('packageApp', ''); //boolean
tr.setInput('forSimulator', ''); //boolean
tr.setInput('signMethod', 'id');
tr.setInput('unlockDefaultKeychain', ''); //boolean
tr.setInput('defaultKeychainPassword', '');
tr.setInput('p12', ''); //path
tr.setInput('p12pwd', '');
tr.setInput('iosSigningIdentity', 'testSignIdentity');
tr.setInput('provProfileUuid', 'testUUID');
tr.setInput('provProfile', ''); //path
tr.setInput('removeProfile', ''); //boolean

// provide answers for task mock
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"getVariable": {
"HOME": "/user/home"
},
"which": {
"xbuild": "/home/bin/xbuild",
"nuget": "/home/bin/nuget"
},
"exec": {
"/home/bin/nuget restore src/project.sln": {
"code": 0,
"stdout": "nuget restore"
},
"/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /p:Codesignkey=testSignIdentity /p:CodesignProvision=testUUID": {
"code": 0,
"stdout": "xbuild"
}
},
"checkPath" : {
"/home/bin/xbuild": true,
"/home/bin2/xbuild": true,
"/home/bin/nuget": true,
"src/project.sln": true
}
};
tr.setAnswers(a);

tr.run();

50 changes: 0 additions & 50 deletions Tasks/XamariniOS/createkeychain.sh

This file was deleted.

14 changes: 12 additions & 2 deletions Tasks/XamariniOS/make.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{
"cp": [
"common": [
{
"source": "xcode-task-utils.js"
"module": "../Common/ios-signing-common",
"type": "node",
"compile": true
}
],
"rm": [
{
"items": [
"node_modules/ios-signing-common/node_modules/vsts-task-lib"
],
"options": "-Rf"
}
]
}
5 changes: 4 additions & 1 deletion Tasks/XamariniOS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
},
"homepage": "https://github.com/microsoft/vsts-tasks#readme",
"dependencies": {
"vsts-task-lib": "0.7.4"
"vsts-task-lib": "0.9.20"
},
"devDependencies": {
"mocha": "^3.1.0"
}
}
14 changes: 12 additions & 2 deletions Tasks/XamariniOS/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 0,
"Patch": 24
"Minor": 1,
"Patch": 0
},
"demands": [
"Xamarin.iOS"
Expand Down Expand Up @@ -182,5 +182,15 @@
"target": "xamarinios.js",
"argumentFormat": ""
}
},
"messages": {
"SignIdNotFound": "Failed to find iOS signing identity. Verify the signing and provisioning information provided.",
"TempKeychainSetupFailed": "Failed to add the temporary keychain to the keychains search path.",
"ProvProfileDetailsNotFound": "Failed to find the details for provisioning profile: %s",
"ProvProfileUUIDNotFound": "Failed to find provisioning profile UUID for provisioning profile: %s",
"TempKeychainDeleteFailed": "Failed to delete temporary keychain %s created during the build.",
"ProvProfileDeleteFailed": "Failed to delete the provisioning profile %s.",
"XamariniOSSucceeded": "XamariniOS task execution completed with no errors.",
"XamariniOSFailed": "XamariniOS task failed with error %s. For guidance on setting up the build definition, see https://go.microsoft.com/fwlink/?LinkId=760847."
}
}
14 changes: 12 additions & 2 deletions Tasks/XamariniOS/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 0,
"Patch": 24
"Minor": 1,
"Patch": 0
},
"demands": [
"Xamarin.iOS"
Expand Down Expand Up @@ -182,5 +182,15 @@
"target": "xamarinios.js",
"argumentFormat": ""
}
},
"messages": {
"SignIdNotFound": "ms-resource:loc.messages.SignIdNotFound",
"TempKeychainSetupFailed": "ms-resource:loc.messages.TempKeychainSetupFailed",
"ProvProfileDetailsNotFound": "ms-resource:loc.messages.ProvProfileDetailsNotFound",
"ProvProfileUUIDNotFound": "ms-resource:loc.messages.ProvProfileUUIDNotFound",
"TempKeychainDeleteFailed": "ms-resource:loc.messages.TempKeychainDeleteFailed",
"ProvProfileDeleteFailed": "ms-resource:loc.messages.ProvProfileDeleteFailed",
"XamariniOSSucceeded": "ms-resource:loc.messages.XamariniOSSucceeded",
"XamariniOSFailed": "ms-resource:loc.messages.XamariniOSFailed"
}
}
2 changes: 1 addition & 1 deletion Tasks/XamariniOS/typings/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference path="globals/mocha/index.d.ts" />
/// <reference path="globals/node/index.d.ts" />
/// <reference path="globals/q/index.d.ts" />
// TODO: remove after moving to latest task lib
/// <reference path="vsts-task-lib.d.ts" />
Loading