39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/emm/proj.rb', line 39
def self.create_proj(proj_name, output_dir, emm_pods_name, configs)
proj_path = output_dir + "/" + proj_name + "/" + proj_name + ".xcodeproj"
Xcodeproj::Project.new(proj_path).save
project = Xcodeproj::Project.open(proj_path)
@target = project.new_target(:application, proj_name, :ios)
group = project.new_group(proj_name)
group.new_reference("./" + proj_name + "/AppDelegate.h")
@target.add_file_references(
[group.new_reference("./" + proj_name + "/AppDelegate.m")]
);
group.new_reference("./" + proj_name + "/ViewController.h")
@target.add_file_references(
[group.new_reference("./" + proj_name + "/ViewController.m")]
);
supportGroup = group.new_group("Supporting Files")
supportGroup.new_reference("./" + proj_name + "/Info.plist")
@target.add_file_references(
[supportGroup.new_reference("./" + proj_name + "/main.m")]
);
@target.add_resources(
[supportGroup.new_reference("./" + proj_name + "/Base.lproj/LaunchScreen.storyboard"),
supportGroup.new_reference("./" + proj_name + "/Base.lproj/Main.storyboard"),
supportGroup.new_reference("./" + proj_name + "/Assets.xcassets")]
);
@target.build_configuration_list.set_setting("INFOPLIST_FILE", "$(SRCROOT)/" + proj_name + "/Info.plist")
@target.build_configuration_list.set_setting("PRODUCT_BUNDLE_IDENTIFIER", configs["bundle_identifier"])
@target.build_configuration_list.set_setting("IPHONEOS_DEPLOYMENT_TARGET", configs["deployment_target"])
@libs_dir = output_dir + "/" + proj_name + "/" + emm_pods_name
@emm_pods_name = emm_pods_name
traverse(File.dirname(@libs_dir), File.basename(@libs_dir), project.main_group)
@target.build_configuration_list["Debug"].base_configuration_reference = project.reference_for_path(@libs_dir + "/EMM_Debug.xcconfig")
@target.build_configuration_list["Release"].base_configuration_reference = project.reference_for_path(@libs_dir + "/EMM_Release.xcconfig")
project.save
end
|