extractPbxprojBundleID extracts PRODUCT_BUNDLE_IDENTIFIER from project.pbxproj, skipping test-target bundle IDs (those ending in "Tests").
(content string)
| 555 | // extractPbxprojBundleID extracts PRODUCT_BUNDLE_IDENTIFIER from project.pbxproj, |
| 556 | // skipping test-target bundle IDs (those ending in "Tests"). |
| 557 | func extractPbxprojBundleID(content string) string { |
| 558 | all := pbxprojBundleIDRegex.FindAllStringSubmatch(content, -1) |
| 559 | for _, m := range all { |
| 560 | if len(m) < 2 { |
| 561 | continue |
| 562 | } |
| 563 | id := strings.TrimSpace(m[1]) |
| 564 | // Skip test-target bundle IDs. In Xcode-generated project.pbxproj files, |
| 565 | // test targets appear before the app target. Both dotted suffixes |
| 566 | // (com.example.app.Tests, com.example.app.UITests) and concatenated |
| 567 | // suffixes (com.example.appTests) all end in "Tests". |
| 568 | if strings.HasSuffix(id, "Tests") { |
| 569 | continue |
| 570 | } |
| 571 | return id |
| 572 | } |
| 573 | return "" |
| 574 | } |
| 575 | |
| 576 | // infoPlistBundleIDRegex matches <key>CFBundleIdentifier</key> followed by <string>value</string>. |
| 577 | var infoPlistBundleIDRegex = regexp.MustCompile(`<key>CFBundleIdentifier</key>\s*<string>([^<]+)</string>`) |
no outgoing calls