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

Remove signing setup from Xamarin iOS task #6853

Merged
merged 2 commits into from
Apr 2, 2018
Merged

Conversation

madhurig
Copy link
Contributor

@madhurig madhurig commented Apr 2, 2018

No description provided.

//determine the provisioning profile UUID
if (tl.filePathSupplied('provProfile') && tl.exist(provProfilePath)) {
provProfileUUID = await sign.getProvisioningProfileUUID(provProfilePath);
let provProfileUUID: string = tl.getInput('provProfileUuid');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both of these two variables can be const now.

@@ -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 setup 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`.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "set up" as a verb should be two words

//determine the provisioning profile UUID
if (tl.filePathSupplied('provProfile') && tl.exist(provProfilePath)) {
provProfileUUID = await sign.getProvisioningProfileUUID(provProfilePath);
let provProfileUUID: string = tl.getInput('provProfileUuid');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be const

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And pedantic nit, I think this should match the input name: provProfileUuid. Acronyms should get cased like normal words so they don't mess up the camel casing

@@ -152,7 +101,7 @@ async function run() {
buildRunner.line(args);
}
buildRunner.argIf(codesignKeychain, '/p:CodesignKeychain=' + codesignKeychain);
if (buildTool === 'msbuild' && signIdentity && signIdentity.indexOf(',') > 0) {
if (signIdentity && signIdentity.indexOf(',') > 0) {
Copy link
Contributor

@brcrista brcrista Apr 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of indexOf, you can make this signIdentity.includes(',')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that's true? IIRC, (and it's very possible I don't RC) we use indexOf because of TS / JS version compatibility. Do we support the version of Javascript in the tasks project that can use the contains method?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this is supposed to be includes; I've updated my original comment.
String.prototype.includes was introduced with ES 2015. I tested it on Node 5 and 6 just now and it is supported on both.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"exec": {
"/home/bin/xbuild src/project.sln /p:Configuration=Release /p:Platform=iPhone /t:Clean": {
"code": 0,
"stdout": "msbuild"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-paste error?

buildToolPath = path.join(buildToolLocation, 'xbuild');
}
if (buildTool === 'msbuild' && !buildToolLocation.toLowerCase().endsWith('msbuild')) {
if (buildToolLocation && !buildToolLocation.toLowerCase().endsWith('msbuild')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see we want to push the task to use msbuild from the changes to the UI strings and the logic here. But it appears that this is our logic now:

  1. User supplies path/to/msbuild/directory/msbuild and we run path/to/msbuild/directory/msbuild
  2. User supplies path/to/msbuild/directory and we run path/to/msbuild/directory/msbuild (task finds executable)
  3. User supplies path/to/xbuild/directory/xbuild and we run path/to/xbuild/directory/xbuild
  4. User supplies path/to/xbuild/directory and we try to run path/to/xbuild/directory/msbuild (and fail)
  5. User does not supply buildToolLocation. We find msbuild on the path, else we find xbuild on the path.

Is this correct? It seems odd to me. I think it would make more sense to require the user to provide the full path instead of trying to be smart about whether they provided a directory or file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written, it looks like the task will be confused if the msbuild executable lives in a directory named "msbuild." So it sounds like you want to stat the path to see what it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In new version of the task we don't support "xbuild" for buildToolLocation at all. I think I will remove this and simplify it to look like this: https://github.com/Microsoft/vsts-tasks/blob/master/Tasks/MSBuild/task.json#L78. In Xamarin iOS first there was mdtool, then xbuild and then msbuild. Hopefully we can stick to msbuild now.


tr.run()
.then(() => {
assert(tr.invokedToolCount == 0, 'should not have run XamariniOS');
assert(tr.resultWasSet, 'task should have set a result');
assert(tr.stderr.length > 0, 'should have written to stderr');
assert(tr.failed, 'task should have failed');
assert(tr.stderr.indexOf('not found build tool: /user/bin/xbuild') >= 0, 'wrong error message');
assert(tr.stderr.indexOf('not found build tool: /user/bin/msbuild') >= 0, 'wrong error message');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use contains. And since tr.stderr is a string, we might as well print out what the actual stderr was in the diagnostic message.

@@ -170,27 +119,7 @@ async function run() {

} catch (err) {
tl.setResult(tl.TaskResult.Failed, tl.loc('XamariniOSFailed', err));
} finally {
//clean up the temporary keychain, so it is not used to search for code signing identity in future builds
if (codesignKeychain) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this variable can be removed now.

@@ -152,7 +101,7 @@ async function run() {
buildRunner.line(args);
}
buildRunner.argIf(codesignKeychain, '/p:CodesignKeychain=' + codesignKeychain);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line isn't used anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, we decided not to expose this in the task inputs for the Xcode task as well. I will remove it.

}

//delete provisioning profile if specified
if (profileToDelete) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this variable can be removed.

@madhurig madhurig merged commit f66bc31 into master Apr 2, 2018
@madhurig madhurig deleted the users/madhurig/xios_sign branch April 2, 2018 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants