Skip to content

Commit

Permalink
Remove signing setup from Xamarin iOS task (#6853)
Browse files Browse the repository at this point in the history
* Remove signing setup from Xamarin iOS task

* PR feedback
  • Loading branch information
Madhuri Gummalla authored Apr 2, 2018
1 parent c870d33 commit f66bc31
Show file tree
Hide file tree
Showing 18 changed files with 197 additions and 636 deletions.
26 changes: 4 additions & 22 deletions Tasks/XamariniOS/Strings/resources.resjson/en-US/resources.resjson
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"loc.helpMarkDown": "[More Information](https://go.microsoft.com/fwlink/?LinkID=613729)",
"loc.description": "Build an iOS app with Xamarin on macOS",
"loc.instanceNameFormat": "Build Xamarin.iOS solution $(solution)",
"loc.releaseNotes": "iOS signing set up has been removed from the task. Use `Secure Files` with supporting tasks `Install Apple Certificate` and `Install Apple Provisioning Profile` to setup signing. Updated options to work better with `Visual Studio for Mac`.",
"loc.group.displayName.sign": "Signing & Provisioning",
"loc.group.displayName.advanced": "Advanced",
"loc.input.label.solution": "Solution",
Expand All @@ -21,33 +22,14 @@
"loc.input.help.args": "Additional command line arguments that should be used to build.",
"loc.input.label.cwd": "Working directory",
"loc.input.help.cwd": "Working directory in which builds will run. When empty, the root of the repository is used.",
"loc.input.label.buildTool": "Build tool",
"loc.input.label.mdtoolLocation": "Build tool path",
"loc.input.help.mdtoolLocation": "Optionally supply the path to xbuild (the Xamarin Studio mono build tool) or MSBuild (the Visual Studio for Mac build tool). When empty, the default xbuild or MSBuild path is used.",
"loc.input.label.signMethod": "Override using",
"loc.input.help.signMethod": "If the build should use a signing or provisioning method that is different than the default, choose that method here. Choose 'File Contents' to use a P12 certificate and provisioning profile. Choose 'Identifiers' to retrieve signing settings from the default Keychain and pre-installed profiles. Leave the corresponding fields blank if you do not wish to override default build settings.",
"loc.input.label.buildToolLocation": "Build tool path",
"loc.input.help.buildToolLocation": "Optionally supply the full path to MSBuild (the Visual Studio for Mac build tool). When empty, the default MSBuild path is used.",
"loc.input.label.iosSigningIdentity": "Signing identity",
"loc.input.help.iosSigningIdentity": "Optionally override the signing identity that will be used to sign the build. If nothing is entered, the setting in the Xcode project will be used. You may need to select 'Unlock Default Keychain' if you use this option.",
"loc.input.label.unlockDefaultKeychain": "Unlock default keychain",
"loc.input.help.unlockDefaultKeychain": "Resolve \"User interaction is not allowed\" errors by unlocking the default keychain.",
"loc.input.label.defaultKeychainPassword": "Default keychain password",
"loc.input.help.defaultKeychainPassword": "Password to unlock the default keychain when that option is set.",
"loc.input.help.iosSigningIdentity": "Optionally override the signing identity that will be used to sign the build. If nothing is entered, the setting in the project will be used.",
"loc.input.label.provProfileUuid": "Provisioning profile UUID",
"loc.input.help.provProfileUuid": "Optional UUID of an installed provisioning profile to be used for this build.",
"loc.input.label.p12": "P12 certificate file",
"loc.input.help.p12": "Optional relative path to a PKCS12-formatted P12 certificate file containing a signing certificate to be used for this build.",
"loc.input.label.p12pwd": "P12 password",
"loc.input.help.p12pwd": "Password to the P12 certificate file, if specified. Use a build variable to encrypt this value.",
"loc.input.label.provProfile": "Provisioning profile file",
"loc.input.help.provProfile": "Optional relative path to a file containing the 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 enable this 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": "Xamarin.iOS task execution completed with no errors.",
"loc.messages.XamariniOSFailed": "Xamarin.iOS task failed with error %s. For guidance on setting up the build definition, see https://go.microsoft.com/fwlink/?LinkId=760847.",
"loc.messages.MSB_Build0": "Build {0}",
Expand Down
54 changes: 26 additions & 28 deletions Tasks/XamariniOS/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,9 @@ describe('XamariniOS L0 Suite', function () {

tr.run();

assert(tr.ran('/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone ' +
assert(tr.ran('/home/bin/msbuild 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', function (done: MochaDone) {
this.timeout(2500);

const tp = path.join(__dirname, 'L0SignWithFiles.js');
const tr = 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');
'msbuild 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');

Expand All @@ -58,8 +40,8 @@ describe('XamariniOS L0 Suite', function () {
tr.run();

assert(!tr.ran('/home/bin/nuget restore src/project.sln'), 'nuget restore should not have run');
assert(tr.ran('/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone'),
'xbuild should have run');
assert(tr.ran('/home/bin/msbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone'),
'msbuild should have run');
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');

Expand All @@ -74,11 +56,11 @@ describe('XamariniOS L0 Suite', function () {

tr.run();

assert(tr.ran('/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean'),
'xbuild /t:Clean should have run');
assert(tr.ran('/home/bin/msbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean'),
'msbuild /t:Clean should have run');
assert(tr.ran('/home/bin/nuget restore src/project.sln'), 'nuget restore should have run');
assert(tr.ran('/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone'),
'xbuild should have run');
assert(tr.ran('/home/bin/msbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone'),
'msbuild should have run');
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');

Expand Down Expand Up @@ -135,7 +117,7 @@ describe('XamariniOS L0 Suite', function () {
assert(tr.warningIssues.length === 0, 'should not have issued any warnings');
assert(tr.errorIssues.length === 0, 'should not have produced any errors');
assert(tr.succeeded, 'task should have succeeded');
assert(tr.ran('/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone'));
assert(tr.ran('/home/bin/msbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone'));

done();
});
Expand All @@ -153,7 +135,7 @@ describe('XamariniOS L0 Suite', function () {
assert(tr.warningIssues[0] === 'loc_mock_MultipleSolutionsFound src/1.sln');
assert(tr.errorIssues.length === 0, 'should not have produced any errors');
assert(tr.succeeded, 'task should have succeeded');
assert(tr.ran('/home/bin/xbuild src/1.sln /p:Configuration=Release /p:Platform=iPhone'));
assert(tr.ran('/home/bin/msbuild src/1.sln /p:Configuration=Release /p:Platform=iPhone'));

done();
});
Expand All @@ -174,4 +156,20 @@ describe('XamariniOS L0 Suite', function () {

done();
});

it('XamariniOS fallback to xbuild when msbuild is not found', function (done: MochaDone) {
this.timeout(1000);

const tp = path.join(__dirname, 'L0FallbackXbuild.js');
const tr = new ttm.MockTestRunner(tp);

tr.run();

assert(tr.ran('/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone'),
'xbuild should have run');
assert(tr.stderr.length === 0, 'should not have written to stderr');
assert(tr.succeeded, 'task should have succeeded');

done();
});
})
23 changes: 10 additions & 13 deletions Tasks/XamariniOS/Tests/L0CleanBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,39 @@ tr.setInput('clean', 'true');
tr.setInput('packageApp', ''); //boolean
tr.setInput('forSimulator', ''); //boolean
tr.setInput('runNugetRestore', 'true'); //boolean
tr.setInput('signMethod', 'file');
tr.setInput('unlockDefaultKeychain', ''); //boolean
tr.setInput('defaultKeychainPassword', '');
tr.setInput('p12', ''); //path
tr.setInput('p12pwd', '');
tr.setInput('iosSigningIdentity', '');
tr.setInput('provProfileUuid', '');
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",
"msbuild": "/home/bin/msbuild",
"nuget": "/home/bin/nuget"
},
"exec": {
"/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean": {
"/home/bin/msbuild /version /nologo": {
"code": 0,
"stdout": "xbuild"
"stdout": "15.1.0.0"
},
"/home/bin/msbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean": {
"code": 0,
"stdout": "msbuild"
},
"/home/bin/nuget restore src/project.sln": {
"code": 0,
"stdout": "nuget restore"
},
"/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone": {
"/home/bin/msbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone": {
"code": 0,
"stdout": "xbuild"
"stdout": "msbuild"
}
},
"checkPath" : {
"/user/build": true,
"/home/bin/xbuild": true,
"/home/bin/msbuild": true,
"/home/bin/nuget": true,
"src/project.sln": true
},
Expand Down
50 changes: 50 additions & 0 deletions Tasks/XamariniOS/Tests/L0FallbackXbuild.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

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('runNugetRestore', 'false'); //boolean
tr.setInput('iosSigningIdentity', '');
tr.setInput('provProfileUuid', '');

// provide answers for task mock
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"getVariable": {
"HOME": "/user/home"
},
"which": {
"xbuild": "/home/bin/xbuild"
},
"exec": {
"/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean": {
"code": 0,
"stdout": "xbuild"
},
"/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone": {
"code": 0,
"stdout": "xbuild"
}
},
"checkPath" : {
"/user/build": true,
"/home/bin/xbuild": true,
"src/project.sln": true
},
"findMatch" : {
"src/project.sln": ["src/project.sln"]
}
};
tr.setAnswers(a);

tr.run();

8 changes: 0 additions & 8 deletions Tasks/XamariniOS/Tests/L0MSBuildDefault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,8 @@ tr.setInput('clean', 'true');
tr.setInput('packageApp', ''); //boolean
tr.setInput('forSimulator', ''); //boolean
tr.setInput('runNugetRestore', 'true'); //boolean
tr.setInput('signMethod', 'file');
tr.setInput('unlockDefaultKeychain', ''); //boolean
tr.setInput('defaultKeychainPassword', '');
tr.setInput('p12', ''); //path
tr.setInput('p12pwd', '');
tr.setInput('iosSigningIdentity', '');
tr.setInput('provProfileUuid', '');
tr.setInput('provProfile', ''); //path
tr.setInput('removeProfile', ''); //boolean
tr.setInput('buildTool', 'msbuild');

// provide answers for task mock
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
Expand Down
10 changes: 1 addition & 9 deletions Tasks/XamariniOS/Tests/L0MSBuildLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,9 @@ tr.setInput('clean', 'true');
tr.setInput('packageApp', ''); //boolean
tr.setInput('forSimulator', ''); //boolean
tr.setInput('runNugetRestore', 'true'); //boolean
tr.setInput('signMethod', 'file');
tr.setInput('unlockDefaultKeychain', ''); //boolean
tr.setInput('defaultKeychainPassword', '');
tr.setInput('p12', ''); //path
tr.setInput('p12pwd', '');
tr.setInput('iosSigningIdentity', '');
tr.setInput('provProfileUuid', '');
tr.setInput('provProfile', ''); //path
tr.setInput('removeProfile', ''); //boolean
tr.setInput('buildTool', 'msbuild');
tr.setInput('mdtoolLocation', '/home/bin/msbuild');
tr.setInput('buildToolLocation', '/home/bin/msbuild');

// provide answers for task mock
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
Expand Down
23 changes: 10 additions & 13 deletions Tasks/XamariniOS/Tests/L0MultipleWildcardMatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,39 @@ tr.setInput('clean', 'true');
tr.setInput('packageApp', ''); //boolean
tr.setInput('forSimulator', ''); //boolean
tr.setInput('runNugetRestore', 'true'); //boolean
tr.setInput('signMethod', 'file');
tr.setInput('unlockDefaultKeychain', ''); //boolean
tr.setInput('defaultKeychainPassword', '');
tr.setInput('p12', ''); //path
tr.setInput('p12pwd', '');
tr.setInput('iosSigningIdentity', '');
tr.setInput('provProfileUuid', '');
tr.setInput('provProfile', ''); //path
tr.setInput('removeProfile', ''); //boolean

// provide answers for task mock
const a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"getVariable": {
"HOME": "/user/home"
},
"which": {
"xbuild": "/home/bin/xbuild",
"msbuild": "/home/bin/msbuild",
"nuget": "/home/bin/nuget"
},
"exec": {
"/home/bin/xbuild src/1.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean": {
"/home/bin/msbuild /version /nologo": {
"code": 0,
"stdout": "xbuild"
"stdout": "15.1.0.0"
},
"/home/bin/msbuild src/1.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean": {
"code": 0,
"stdout": "msbuild"
},
"/home/bin/nuget restore src/1.sln": {
"code": 0,
"stdout": "nuget restore"
},
"/home/bin/xbuild src/1.sln /p:Configuration=Release /p:Platform=iPhone": {
"/home/bin/msbuild src/1.sln /p:Configuration=Release /p:Platform=iPhone": {
"code": 0,
"stdout": "xbuild"
"stdout": "msbuild"
}
},
"checkPath": {
"/user/build": true,
"/home/bin/xbuild": true,
"/home/bin/msbuild": true,
"/home/bin/nuget": true,
"**/*.sln": true
},
Expand Down
23 changes: 10 additions & 13 deletions Tasks/XamariniOS/Tests/L0NoWildcardMatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,39 @@ tr.setInput('clean', 'true');
tr.setInput('packageApp', ''); //boolean
tr.setInput('forSimulator', ''); //boolean
tr.setInput('runNugetRestore', 'true'); //boolean
tr.setInput('signMethod', 'file');
tr.setInput('unlockDefaultKeychain', ''); //boolean
tr.setInput('defaultKeychainPassword', '');
tr.setInput('p12', ''); //path
tr.setInput('p12pwd', '');
tr.setInput('iosSigningIdentity', '');
tr.setInput('provProfileUuid', '');
tr.setInput('provProfile', ''); //path
tr.setInput('removeProfile', ''); //boolean

// provide answers for task mock
const a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
"getVariable": {
"HOME": "/user/home"
},
"which": {
"xbuild": "/home/bin/xbuild",
"msbuild": "/home/bin/msbuild",
"nuget": "/home/bin/nuget"
},
"exec": {
"/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean": {
"/home/bin/msbuild /version /nologo": {
"code": 0,
"stdout": "xbuild"
"stdout": "15.1.0.0"
},
"/home/bin/msbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean": {
"code": 0,
"stdout": "msbuild"
},
"/home/bin/nuget restore src/project.sln": {
"code": 0,
"stdout": "nuget restore"
},
"/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone": {
"/home/bin/msbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone": {
"code": 0,
"stdout": "xbuild"
"stdout": "msbuild"
}
},
"checkPath": {
"/user/build": true,
"/home/bin/xbuild": true,
"/home/bin/msbuild": true,
"/home/bin/nuget": true,
"src/project.sln": true
},
Expand Down
Loading

0 comments on commit f66bc31

Please sign in to comment.