Bug 140828 - [iOS] Make it possible to build WebKit using iphoneos SDK without a developer certificate installed
Summary: [iOS] Make it possible to build WebKit using iphoneos SDK without a developer...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks: 149818
  Show dependency treegraph
 
Reported: 2015-01-23 10:35 PST by David Kilzer (:ddkilzer)
Modified: 2015-10-05 15:30 PDT (History)
3 users (show)

See Also:


Attachments
Patch v1 (5.07 KB, patch)
2015-01-23 10:45 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch (4.27 KB, patch)
2015-10-05 14:45 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (4.20 KB, patch)
2015-10-05 15:10 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2015-01-23 10:35:47 PST
For the ios-ews queue and for developers who want to make sure their changes build for the iOS port of WebKit using the iphoneos SDK, we need a way to disable code-signing so that Xcode doesn't stop building if it can't find a developer certificate.

This will add a --disable-code-signing switch to the configure-xcode-for-ios-development script.
Comment 1 David Kilzer (:ddkilzer) 2015-01-23 10:45:25 PST
Created attachment 245238 [details]
Patch v1
Comment 2 Daniel Bates 2015-01-23 15:29:44 PST
Comment on attachment 245238 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=245238&action=review

> Tools/ChangeLog:11
> +        (disableCodeSigning): Add.  Calls

Nit: "Add" => "Added".

> Tools/ChangeLog:14
> +        (disableCodeSigningForProductType): Add.  Does the work of

Ditto.

> Tools/Scripts/configure-xcode-for-ios-development:65
> +  -h|--help               Show this help message

Nit: I suggest we list the --help option at the top of the usage message so as to be consistent with the order we use in other scripts, including build-webkit and run-safari.

> Tools/Scripts/configure-xcode-for-ios-development:212
> +    for ( ; ; ++$index) {
> +        `/usr/libexec/PlistBuddy -c "Print :$index" "$plist" > /dev/null 2>&1`;
> +        die "Failed to disable code signing for $productType: $!" if exitStatus($?);
> +
> +        chomp(my $name = `/usr/libexec/PlistBuddy -c "Print :$index:Name" "$plist" 2> /dev/null`);
> +        next unless $name eq $productType;
> +
> +        chomp(my $value = `/usr/libexec/PlistBuddy -c "Print :$index:DefaultBuildProperties:CODE_SIGNING_ALLOWED" "$plist" 2> /dev/null`);
> +        return if ($value eq "NO");
> +
> +        system("/usr/libexec/PlistBuddy", "-x", "-c", "Set :$index:DefaultBuildProperties:CODE_SIGNING_ALLOWED NO", $plist);
> +        die "Failed to disable code signing for $productType: $!" if exitStatus($?);
> +        print "Successfully disabled code signing for $productType.\n";
> +        return;
> +    }

Notice that we have existing parsing code for finding the index position of a <dict> with child a <key> called Identifier in a plist in readXcodeSpecificationById(). Can we make use of this function or extract the common functionality into a helper function that is used by both readXcodeSpecificationById() and disableCodeSigningForProductType()?
Comment 3 David Kilzer (:ddkilzer) 2015-01-23 17:08:14 PST
Comment on attachment 245238 [details]
Patch v1

There is some duplicate code that Dan pointed out, and I want to add an --enable-code-signing switch to undo the change that --disable-code-signing does (in case someone needs to do that).

We may also want to add a check for a developer certificate in the keychain, and bail out (or ask) before continuing with disabling code signing.
Comment 4 David Kilzer (:ddkilzer) 2015-01-24 08:14:32 PST
(In reply to comment #2)
> Comment on attachment 245238 [details]
> Patch v1
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=245238&action=review
> 
> > Tools/ChangeLog:11
> > +        (disableCodeSigning): Add.  Calls
> 
> Nit: "Add" => "Added".
> 
> > Tools/ChangeLog:14
> > +        (disableCodeSigningForProductType): Add.  Does the work of
> 
> Ditto.

I prefer the imperative, present tense:

<http://stackoverflow.com/questions/3580013/should-i-use-past-or-present-tense-in-git-commit-messages>

> > Tools/Scripts/configure-xcode-for-ios-development:65
> > +  -h|--help               Show this help message
> 
> Nit: I suggest we list the --help option at the top of the usage message so
> as to be consistent with the order we use in other scripts, including
> build-webkit and run-safari.

Will fix.

> > Tools/Scripts/configure-xcode-for-ios-development:212
> > +    for ( ; ; ++$index) {
> > +        `/usr/libexec/PlistBuddy -c "Print :$index" "$plist" > /dev/null 2>&1`;
> > +        die "Failed to disable code signing for $productType: $!" if exitStatus($?);
> > +
> > +        chomp(my $name = `/usr/libexec/PlistBuddy -c "Print :$index:Name" "$plist" 2> /dev/null`);
> > +        next unless $name eq $productType;
> > +
> > +        chomp(my $value = `/usr/libexec/PlistBuddy -c "Print :$index:DefaultBuildProperties:CODE_SIGNING_ALLOWED" "$plist" 2> /dev/null`);
> > +        return if ($value eq "NO");
> > +
> > +        system("/usr/libexec/PlistBuddy", "-x", "-c", "Set :$index:DefaultBuildProperties:CODE_SIGNING_ALLOWED NO", $plist);
> > +        die "Failed to disable code signing for $productType: $!" if exitStatus($?);
> > +        print "Successfully disabled code signing for $productType.\n";
> > +        return;
> > +    }
> 
> Notice that we have existing parsing code for finding the index position of
> a <dict> with child a <key> called Identifier in a plist in
> readXcodeSpecificationById(). Can we make use of this function or extract
> the common functionality into a helper function that is used by both
> readXcodeSpecificationById() and disableCodeSigningForProductType()?

Will reuse this code in the next patch.  Thanks!
Comment 5 David Kilzer (:ddkilzer) 2015-01-24 09:30:38 PST
<rdar://problem/19520599>
Comment 6 Alexey Proskuryakov 2015-09-16 17:02:35 PDT
What's the next step on this? Is this patch still necessary?
Comment 7 Daniel Bates 2015-10-05 14:45:24 PDT
Created attachment 262463 [details]
Patch
Comment 8 Daniel Bates 2015-10-05 15:07:17 PDT
Comment on attachment 262463 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=262463&action=review

> Tools/Scripts/webkitdirs.pm:2012
> +sub hasIOSDevelopmentCertificate()

Although, this function takes no arguments, will forward declare this function at the top of the file so that Perl can check its prototype.
Comment 9 Daniel Bates 2015-10-05 15:10:33 PDT
Created attachment 262468 [details]
Patch

Actually, moved hasIOSDevelopmentCertificate() to come before XcodeOptions() instead of forward declaring it. Added missing semicolon in hasIOSDevelopmentCertificate().
Comment 10 Alexey Proskuryakov 2015-10-05 15:13:13 PDT
Comment on attachment 262468 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=262468&action=review

Neat.

EWS is broken due to a (new) unrelated issue.

> Tools/Scripts/webkitdirs.pm:688
> +    push @options, ("-configuration", $configuration);
> +    push @options, ("-xcconfig", sourceDir() . "/Tools/asan/asan.xcconfig", "ASAN_IGNORE=" . sourceDir() . "/Tools/asan/webkit-asan-ignore.txt") if $asanIsEnabled;

I think that parentheses are not needed here.
Comment 11 Daniel Bates 2015-10-05 15:23:34 PDT
(In reply to comment #10)
> > Tools/Scripts/webkitdirs.pm:688
> > +    push @options, ("-configuration", $configuration);
> > +    push @options, ("-xcconfig", sourceDir() . "/Tools/asan/asan.xcconfig", "ASAN_IGNORE=" . sourceDir() . "/Tools/asan/webkit-asan-ignore.txt") if $asanIsEnabled;
> 
> I think that parentheses are not needed here.

Yes, parentheses are not needed here. I will keep them because I feel they improves the readability of this code.
Comment 12 Daniel Bates 2015-10-05 15:30:38 PDT
Comment on attachment 262468 [details]
Patch

Clearing flags on attachment: 262468

Committed r190583: <http://trac.webkit.org/changeset/190583>
Comment 13 Daniel Bates 2015-10-05 15:30:42 PDT
All reviewed patches have been landed.  Closing bug.