-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (37 loc) · 1.09 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"fmt"
"os"
"github.com/bitrise-io/go-utils/fileutil"
"github.com/godrei/xcodeproj/pbxproj"
)
func main() {
pbxprojPth := "./_tmp/project.pbxproj"
content, err := fileutil.ReadStringFromFile(pbxprojPth)
if err != nil {
fmt.Printf("failed to read file (%s), error: %s\n", pbxprojPth, err)
os.Exit(1)
}
isaSectionLinesMap, err := pbxproj.SplitObjectsSections(content)
if err != nil {
fmt.Printf("failed to split project (%s), error: %s\n", pbxprojPth, err)
os.Exit(1)
}
for isa, lines := range isaSectionLinesMap {
if isa == "PBXNativeTarget" {
pbxNativeTargets := pbxproj.ParsePBXNativeTargetSection(lines)
for _, pbxNativeTarget := range pbxNativeTargets {
fmt.Println("PBXNativeTarget")
fmt.Printf("%#v\n", pbxNativeTarget)
fmt.Println("-----")
}
} else if isa == "PBXTargetDependency" {
pbxTargetDependencies := pbxproj.ParsePBXTargetDependencySection(lines)
for _, pbxTargetDependency := range pbxTargetDependencies {
fmt.Println("PBXTargetDependency")
fmt.Printf("%#v\n", pbxTargetDependency)
fmt.Println("-----")
}
}
}
}