nixenvironment 0.0.59 → 0.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +14 -14
- data/bin/Config +2 -2
- data/bin/nixenvironment +420 -842
- data/legacy/CleanWorkingCopy.sh +69 -0
- data/legacy/Deploy.sh +44 -0
- data/legacy/DeployAPK.py +58 -0
- data/legacy/DeployIPA.sh +125 -0
- data/legacy/DetectSCM.sh +11 -0
- data/legacy/GenerateCodeCoverageForXCTests.sh +134 -0
- data/legacy/GenerateCodeDuplicationReport.sh +24 -0
- data/legacy/IncrementBuildNumber.py +129 -0
- data/legacy/LoadBuildEnvVars.sh +116 -0
- data/legacy/MakeTag.sh +94 -0
- data/legacy/RemoveTemporaryFiles.sh +9 -0
- data/legacy/SaveRevision.sh +122 -0
- data/legacy/UnityBuildAndroid.py +84 -0
- data/legacy/UnityBuildAutomationScripts/CommandLineReader.cs +130 -0
- data/legacy/UnityBuildAutomationScripts/NIXBuilder.cs +105 -0
- data/legacy/UnityBuildEnvVars.py +41 -0
- data/legacy/VerifyBinarySigning.py +80 -0
- data/legacy/svn-clean.pl +246 -0
- data/legacy/svncopy.pl +1134 -0
- data/lib/nixenvironment.rb +5 -0
- data/lib/nixenvironment/archiver.rb +690 -0
- data/lib/nixenvironment/build_env_vars_loader.rb +24 -0
- data/lib/nixenvironment/cmd_executor.rb +33 -0
- data/lib/nixenvironment/config.rb +127 -14
- data/lib/nixenvironment/git.rb +107 -0
- data/lib/nixenvironment/plist.rb +52 -0
- data/lib/nixenvironment/version.rb +1 -1
- data/lib/nixenvironment/xcodebuild.rb +167 -0
- data/nixenvironment.gemspec +6 -0
- data/utils/XcodeIconTagger/IconTagger +0 -0
- data/utils/XcodeIconTagger/masks/OneLineMask.png +0 -0
- data/utils/XcodeIconTagger/masks/TwoLineMask.png +0 -0
- data/utils/aapt +0 -0
- data/utils/gcovr +986 -0
- data/utils/identitieslist +0 -0
- data/utils/simian-2.3.33.jar +0 -0
- metadata +118 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aa2f98507cfc5e717a474d16adaeac6c4206f1f
|
4
|
+
data.tar.gz: 113800dfc11914fc8cc2a365b4bbecc2f9435950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbe944c4fd02071dd11211b6d2ef0014512f8aee77fe889da00878a211450b731adb7f025786b985ec6a282f7ff675a428d30fed7c4ade712a9f072bdd802ff1
|
7
|
+
data.tar.gz: 8b806a793a2a35778c1d9607c570956d59e01237af82971fc463a27ced7eb4b4d04dff530e1ede4a1371b3fd4d41091461b84df25ce1ee5cf7864dda82f391c6
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -29,13 +29,11 @@ Nixenvironment installs, updates and manages inner NIX environment stuff to make
|
|
29
29
|
tag # Make SVN/git/mercurial tag, SCM_USERNAME and SCM_PASSWORD must be defined on calling this target
|
30
30
|
|
31
31
|
test # Build xctest unit tests and run them in simulator
|
32
|
-
|
33
|
-
update # Install or update ninbas and other environment stuff
|
34
32
|
|
35
33
|
GLOBAL OPTIONS:
|
36
34
|
|
37
35
|
-h, --help
|
38
|
-
Display help documentation
|
36
|
+
Display help documentation. Default command
|
39
37
|
|
40
38
|
-v, --version
|
41
39
|
Display version information
|
@@ -89,11 +87,7 @@ Nixenvironment installs, updates and manages inner NIX environment stuff to make
|
|
89
87
|
|
90
88
|
EXAMPLES:
|
91
89
|
|
92
|
-
nixenvironment -h
|
93
|
-
|
94
|
-
nixenvironment update # Update all environment stuff from last tags
|
95
|
-
|
96
|
-
nixenvironment update --ninbas feature/nixenv
|
90
|
+
nixenvironment [-h]
|
97
91
|
|
98
92
|
nixenvironment build # Make Debug build and create .ipa file from last built app product by default
|
99
93
|
|
@@ -105,16 +99,22 @@ Nixenvironment installs, updates and manages inner NIX environment stuff to make
|
|
105
99
|
|
106
100
|
## TODO:
|
107
101
|
|
108
|
-
1.
|
109
|
-
2.
|
102
|
+
1. Rework legacy scripts
|
103
|
+
2. Update utils, rework if possible
|
104
|
+
3. Move Unity build logic to separate gem and add it via dependencies
|
105
|
+
4. Rewrite this README
|
110
106
|
|
111
107
|
## Automatic install and update on CI (Jenkins):
|
112
108
|
|
113
|
-
Add
|
109
|
+
Add lines below to Sudoers in Mac OS X system:
|
114
110
|
|
115
|
-
jenkins
|
116
|
-
jenkins
|
111
|
+
jenkins ALL=(ALL) NOPASSWD: /usr/bin/bundle
|
112
|
+
jenkins ALL=(ALL) NOPASSWD: /usr/bin/gem
|
113
|
+
|
114
|
+
Read http://osxdaily.com/2014/02/06/add-user-sudoers-file-mac/ and
|
115
|
+
http://stackoverflow.com/questions/12736351/exit-save-edit-to-sudoers-file-putty-ssh to know how to do it correctly.
|
117
116
|
|
118
117
|
Then run this in Execute shell:
|
119
118
|
|
120
|
-
|
119
|
+
# See credentials for deploy on https://qwiki.nixsolutions.com/display/IPT/Credentials
|
120
|
+
./gemify.sh && bundle update && sudo gem install nixenvironment --verbose
|
data/bin/Config
CHANGED
@@ -9,7 +9,7 @@ WORKSPACE_TO_BUILD: NIXProject.xcworkspace
|
|
9
9
|
WORKSPACE_SCHEME_TO_BUILD: Application
|
10
10
|
WORKSPACE_SCHEME_TO_TEST: Tests
|
11
11
|
|
12
|
-
# for osx projects sdk should be
|
12
|
+
# for osx projects sdk should be macosx (or more specific, f. e.: macosx10.10)
|
13
13
|
SDK: iphoneos
|
14
14
|
SDK_FOR_TESTS: iphonesimulator
|
15
15
|
|
@@ -36,4 +36,4 @@ CODE_COVERAGE_OUTPUT_DIRECTORY: ./Coverage/
|
|
36
36
|
ENV_VAR_PREFIX: NIXENV_
|
37
37
|
|
38
38
|
# default resigned bundle identifier
|
39
|
-
RESIGNED_BUNDLE_ID:
|
39
|
+
RESIGNED_BUNDLE_ID:
|
data/bin/nixenvironment
CHANGED
@@ -5,71 +5,56 @@ require 'nixenvironment'
|
|
5
5
|
require 'commander/import'
|
6
6
|
require 'yaml'
|
7
7
|
require 'fileutils'
|
8
|
-
require 'shellwords'
|
9
8
|
require 'tmpdir'
|
10
9
|
require 'active_support/core_ext/object/blank'
|
10
|
+
require 'terminal-table'
|
11
|
+
require 'colorize'
|
11
12
|
|
12
13
|
include Nixenvironment
|
13
14
|
|
14
|
-
|
15
|
-
program :version, VERSION
|
16
|
-
program :description, 'NIX projects build and deploy utility'
|
17
|
-
|
18
|
-
global_option ('--project_to_build VALUE') { |value| $project_to_build = value }
|
19
|
-
global_option ('--project_target_to_build VALUE') { |value| $project_target_to_build = value }
|
20
|
-
global_option ('--project_target_to_test VALUE') { |value| $project_target_to_test = value }
|
21
|
-
|
22
|
-
global_option ('--workspace_to_build VALUE') { |value| $workspace_to_build = value }
|
23
|
-
global_option ('--workspace_scheme_to_build VALUE') { |value| $workspace_scheme_to_build = value }
|
24
|
-
global_option ('--workspace_scheme_to_test VALUE') { |value| $workspace_scheme_to_test = value }
|
25
|
-
|
26
|
-
global_option ('--sdk VALUE') { |value| $sdk = value }
|
27
|
-
global_option ('--sdk_for_tests VALUE') { |value| $sdk_for_tests = value }
|
28
|
-
|
29
|
-
global_option ('--exclude_pattern_for_code_coverage VALUE') { |value| $exclude_pattern_for_code_coverage = value }
|
30
|
-
global_option ('--exclude_pattern_for_code_duplication VALUE') { |value| $exclude_pattern_for_code_duplication = value }
|
31
|
-
|
32
|
-
global_option ('--deploy_host VALUE') { |value| $deploy_host = value }
|
33
|
-
global_option ('--deploy_path VALUE') { |value| $deploy_path = value }
|
34
|
-
global_option ('--deploy_username VALUE') { |value| $deploy_username = value }
|
35
|
-
global_option ('--deploy_password VALUE') { |value| $deploy_password = value }
|
36
|
-
global_option ('--deploy_itunesconnect_username VALUE') { |value| $deploy_itunesconnect_username = value }
|
37
|
-
|
38
|
-
global_option ('--icons_path VALUE') { |value| $icons_path = value }
|
15
|
+
CONFIG_SETTINGS_FILE_PATH = File.join(File.dirname(__FILE__), CONFIG_SETTINGS_FILE_NAME)
|
39
16
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
global_option ('--code_coverage_configuration VALUE') { |value| $code_coverage_configuration = value }
|
44
|
-
global_option ('--code_coverage_output_directory VALUE') { |value| $code_coverage_output_directory = value }
|
45
|
-
|
46
|
-
global_option ('--env_var_prefix VALUE') { |value| $env_var_prefix = value }
|
17
|
+
program :name, 'nixenvironment'
|
18
|
+
program :version, VERSION
|
19
|
+
program :description, 'NIX projects build and deploy utility'
|
47
20
|
|
48
|
-
|
49
|
-
|
50
|
-
global_option ('--
|
51
|
-
global_option ('--
|
52
|
-
global_option ('--
|
53
|
-
global_option ('--
|
54
|
-
global_option ('--
|
21
|
+
default_command :help
|
22
|
+
|
23
|
+
global_option ('--project_to_build VALUE') { |value| $project_to_build = value }
|
24
|
+
global_option ('--project_target_to_build VALUE') { |value| $project_target_to_build = value }
|
25
|
+
global_option ('--project_target_to_test VALUE') { |value| $project_target_to_test = value }
|
26
|
+
global_option ('--workspace_to_build VALUE') { |value| $workspace_to_build = value }
|
27
|
+
global_option ('--workspace_scheme_to_build VALUE') { |value| $workspace_scheme_to_build = value }
|
28
|
+
global_option ('--workspace_scheme_to_test VALUE') { |value| $workspace_scheme_to_test = value }
|
29
|
+
global_option ('--sdk VALUE') { |value| $sdk = value }
|
30
|
+
global_option ('--sdk_for_tests VALUE') { |value| $sdk_for_tests = value }
|
31
|
+
global_option ('--exclude_pattern_for_code_coverage VALUE') { |value| $exclude_pattern_for_code_coverage = value }
|
32
|
+
global_option ('--exclude_pattern_for_code_duplication VALUE') { |value| $exclude_pattern_for_code_duplication = value }
|
33
|
+
global_option ('--deploy_host VALUE') { |value| $deploy_host = value }
|
34
|
+
global_option ('--deploy_path VALUE') { |value| $deploy_path = value }
|
35
|
+
global_option ('--deploy_username VALUE') { |value| $deploy_username = value }
|
36
|
+
global_option ('--deploy_password VALUE') { |value| $deploy_password = value }
|
37
|
+
global_option ('--deploy_itunesconnect_username VALUE') { |value| $deploy_itunesconnect_username = value }
|
38
|
+
global_option ('--icons_path VALUE') { |value| $icons_path = value }
|
39
|
+
global_option ('--xctest_destination_device VALUE') { |value| $xctest_destination_device = value }
|
40
|
+
global_option ('--configuration_files_path VALUE') { |value| $configuration_files_path = value }
|
41
|
+
global_option ('--code_coverage_configuration VALUE') { |value| $code_coverage_configuration = value }
|
42
|
+
global_option ('--code_coverage_output_directory VALUE') { |value| $code_coverage_output_directory = value }
|
43
|
+
global_option ('--env_var_prefix VALUE') { |value| $env_var_prefix = value }
|
44
|
+
global_option ('--bundle_id VALUE') { |value| $bundle_id = value }
|
45
|
+
global_option ('--resigned_bundle_id VALUE') { |value| $resigned_bundle_id = value }
|
46
|
+
global_option ('--resigned_watchkit_app_bundle_id VALUE') { |value| $resigned_watchkit_app_bundle_id = value }
|
47
|
+
global_option ('--resigned_watchkit_extension_bundle_id VALUE') { |value| $resigned_watchkit_extension_bundle_id = value }
|
48
|
+
global_option ('--resigned_widget_bundle_id VALUE') { |value| $resigned_widget_bundle_id = value }
|
49
|
+
global_option ('--resigned_bundle_name VALUE') { |value| $resigned_bundle_name = value }
|
50
|
+
global_option ('--resigned_entitlements_path VALUE') { |value| $resigned_entitlements_path = value }
|
55
51
|
global_option ('--resigned_watchkit_extension_entitlements_path VALUE') { |value| $resigned_watchkit_extension_entitlements_path = value }
|
56
|
-
global_option ('--resigned_widget_entitlements_path VALUE')
|
52
|
+
global_option ('--resigned_widget_entitlements_path VALUE') { |value| $resigned_widget_entitlements_path = value }
|
57
53
|
|
58
54
|
command :init do |c|
|
59
55
|
c.syntax = 'nixenvironment init'
|
60
56
|
c.description = 'Initialize template project of selected type in the destination repository and clone it to current folder'
|
61
|
-
c.action
|
62
|
-
init
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
command :update do |c|
|
67
|
-
c.syntax = 'nixenvironment update'
|
68
|
-
c.description = 'Install or update ninbas and other environment stuff'
|
69
|
-
c.option '--ninbas NAME', String, 'Select ninbas branch, tag or revision to clone'
|
70
|
-
c.action do |args, options|
|
71
|
-
update(options.ninbas)
|
72
|
-
end
|
57
|
+
c.action { init }
|
73
58
|
end
|
74
59
|
|
75
60
|
command :build do |c|
|
@@ -77,7 +62,6 @@ command :build do |c|
|
|
77
62
|
c.description = 'Build project for selected configuration and make signed/resigned ipa'
|
78
63
|
c.option '--config NAME', String, 'Select configuration'
|
79
64
|
c.option '--ipa TYPES', String, 'Select sign (device, resigned_device, resigned_adhoc, resigned_appstore)'
|
80
|
-
c.option '--ci_build', 'Define NIXENV_CI_BUILD environment variable'
|
81
65
|
c.option '--unity_path PATH', String, 'Select unity executable path (UNITY, UNITY_4 or custom path)'
|
82
66
|
c.option '--development_build', 'Enable Developmen flag in Unity project'
|
83
67
|
c.option '--keystore_path PATH', String, 'Specify the path to .keystore file'
|
@@ -87,36 +71,48 @@ command :build do |c|
|
|
87
71
|
c.option '--unity_platform TARGET PLATFORM', String, 'Select target platform for unity build (ios or android)'
|
88
72
|
c.option '--ndsym', 'Disable .dsym generation for ios project'
|
89
73
|
c.option '--icon_tagger MODE', String, 'Set XcodeIconTagger mode (full, short, off)'
|
90
|
-
c.action do |
|
74
|
+
c.action do |_args, options|
|
91
75
|
options.default :config => 'Debug', :ipa => 'device', :icon_tagger => 'full', :unity_path => 'UNITY'
|
92
76
|
|
93
77
|
need_to_build_ios = true
|
94
|
-
is_unity_platform = options.unity_platform
|
78
|
+
is_unity_platform = options.unity_platform.present?
|
95
79
|
|
96
80
|
if is_unity_platform
|
97
|
-
unity_path = ENV[options.unity_path]
|
98
|
-
need_to_build_ios
|
81
|
+
unity_path = ENV[options.unity_path] || options.unity_path
|
82
|
+
need_to_build_ios = unity_build(options.config, options.unity_platform, unity_path, options.development_build,
|
83
|
+
options.keystore_path, options.keystore_password, options.key_alias_name, options.key_alias_password)
|
99
84
|
end
|
100
85
|
|
101
86
|
if need_to_build_ios
|
87
|
+
Dir.chdir(UNITY_IOS_PROJECT_PATH) if is_unity_platform
|
88
|
+
read_config_settings
|
89
|
+
@config_settings[CONFIGURATION_KEY] = options.config
|
90
|
+
|
91
|
+
if is_unity_platform
|
92
|
+
@config_settings[WORKSPACE_TO_BUILD_KEY] = nil
|
93
|
+
@config_settings[PROJECT_TO_BUILD_KEY] = UNITY_BUILDS_IOS_PROJECT
|
94
|
+
@config_settings[WORKSPACE_SCHEME_TO_BUILD_KEY] = UNITY_BUILDS_IOS_SCHEME
|
95
|
+
@config_settings[PROJECT_TARGET_TO_BUILD_KEY] = nil
|
96
|
+
@config_settings[ICONS_PATH_KEY] = UNITY_BUILDS_ICONS_PATH
|
97
|
+
end
|
98
|
+
|
102
99
|
begin
|
103
|
-
read_config_settings
|
100
|
+
Xcodebuild.read_config_settings(@config_settings[WORKSPACE_TO_BUILD_KEY], @config_settings[PROJECT_TO_BUILD_KEY],
|
101
|
+
@config_settings[WORKSPACE_SCHEME_TO_BUILD_KEY], @config_settings[PROJECT_TARGET_TO_BUILD_KEY],
|
102
|
+
@config_settings[SDK_KEY], @config_settings[CONFIGURATION_KEY])
|
104
103
|
|
105
|
-
|
106
|
-
|
107
|
-
|
104
|
+
raise 'Failed read_config_settings!' unless Xcodebuild.last_cmd_success?
|
105
|
+
rescue => e
|
106
|
+
error('Build error!', e)
|
107
|
+
end
|
108
|
+
|
109
|
+
@config_settings.merge!(Xcodebuild.config_settings)
|
108
110
|
|
109
|
-
|
110
|
-
supplement_config_settings(options.config)
|
111
|
+
begin
|
111
112
|
prebuild(options.config)
|
112
113
|
build(options.config, options.ipa, options.ndsym, options.icon_tagger)
|
113
|
-
restore_info_plist
|
114
|
-
rescue
|
115
|
-
raise # re-rise exception but chdir to root_working_dir in ensure block first if needed
|
116
114
|
ensure
|
117
|
-
|
118
|
-
Dir.chdir(root_working_dir)
|
119
|
-
end
|
115
|
+
restore_info_plists
|
120
116
|
end
|
121
117
|
end
|
122
118
|
end
|
@@ -127,24 +123,15 @@ command :deploy do |c|
|
|
127
123
|
c.description = 'Deploy built artifacts to given server'
|
128
124
|
c.option '--unity_platform TARGET PLATFORM', String, 'Select target platform for unity deploy (ios or android)'
|
129
125
|
c.option '--deliver_deploy', 'Not only verify but also submit the build on iTunes Connect. (resigned_appstore builds only)'
|
130
|
-
c.action do |
|
126
|
+
c.action do |_args, options|
|
131
127
|
need_to_deploy_ios = true
|
132
|
-
|
133
|
-
|
134
|
-
need_to_deploy_ios, root_working_dir, need_chdir_to_root_working_dir = unity_deploy(options.unity_platform)
|
135
|
-
end
|
128
|
+
is_unity_platform = options.unity_platform.present?
|
129
|
+
need_to_deploy_ios = unity_deploy(options.unity_platform) if is_unity_platform
|
136
130
|
|
137
131
|
if need_to_deploy_ios
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
rescue
|
142
|
-
raise # re-rise exception but chdir to root_working_dir in ensure block first if needed
|
143
|
-
ensure
|
144
|
-
if need_chdir_to_root_working_dir and root_working_dir
|
145
|
-
Dir.chdir(root_working_dir)
|
146
|
-
end
|
147
|
-
end
|
132
|
+
Dir.chdir(UNITY_IOS_PROJECT_PATH) if is_unity_platform
|
133
|
+
read_config_settings
|
134
|
+
deploy(options.deliver_deploy)
|
148
135
|
end
|
149
136
|
end
|
150
137
|
end
|
@@ -152,247 +139,179 @@ end
|
|
152
139
|
command :clean do |c|
|
153
140
|
c.syntax = 'nixenvironment clean'
|
154
141
|
c.description = 'Remove temp files and clean all targets for xcode project'
|
155
|
-
c.action
|
156
|
-
clean
|
157
|
-
end
|
142
|
+
c.action { clean }
|
158
143
|
end
|
159
144
|
|
160
145
|
command :test do |c|
|
161
146
|
c.syntax = 'nixenvironment test'
|
162
147
|
c.description = 'Build xctest unit tests and run them in simulator'
|
163
|
-
c.action
|
164
|
-
read_config_settings
|
165
|
-
test
|
166
|
-
end
|
148
|
+
c.action { read_config_settings and test }
|
167
149
|
end
|
168
150
|
|
169
151
|
command :code_coverage do |c|
|
170
152
|
c.syntax = 'nixenvironment code_coverage'
|
171
153
|
c.description = 'Generate xctest unit tests code coverage report'
|
172
|
-
c.action
|
173
|
-
read_config_settings
|
174
|
-
code_coverage
|
175
|
-
end
|
154
|
+
c.action { read_config_settings and code_coverage }
|
176
155
|
end
|
177
156
|
|
178
157
|
command :code_duplication_report do |c|
|
179
158
|
c.syntax = 'nixenvironment code_duplication_report'
|
180
159
|
c.description = 'Generate code duplication report'
|
181
|
-
c.action
|
182
|
-
read_config_settings
|
183
|
-
code_duplication_report
|
184
|
-
end
|
160
|
+
c.action { read_config_settings and code_duplication_report }
|
185
161
|
end
|
186
162
|
|
187
163
|
command :tag do |c|
|
188
164
|
c.syntax = 'nixenvironment tag'
|
189
165
|
c.description = 'Make SVN/git/mercurial tag, SCM_USERNAME and SCM_PASSWORD must be defined on calling this target'
|
190
|
-
c.action
|
191
|
-
tag
|
192
|
-
end
|
166
|
+
c.action { tag }
|
193
167
|
end
|
194
168
|
|
195
169
|
command :svn_tag_from_jenkins do |c|
|
196
170
|
c.syntax = 'nixenvironment svn_tag_from_jenkins'
|
197
171
|
c.description = 'Make tag by finding the first credential in local credential storage'
|
198
|
-
c.action
|
199
|
-
svn_tag_from_jenkins
|
200
|
-
end
|
172
|
+
c.action { svn_tag_from_jenkins }
|
201
173
|
end
|
202
174
|
|
203
175
|
command :clean_working_copy do |c|
|
204
176
|
c.syntax = 'nixenvironment clean_working_copy'
|
205
177
|
c.description = 'Make working copy clean'
|
206
178
|
c.option '--all', 'Remove ignored files too'
|
207
|
-
c.action
|
208
|
-
clean_working_copy(options.all)
|
209
|
-
end
|
179
|
+
c.action { |_args, options| clean_working_copy(options.all) }
|
210
180
|
end
|
211
181
|
|
212
182
|
def init
|
213
|
-
|
214
|
-
template_project_url = nil
|
183
|
+
template_project_url = nil
|
215
184
|
template_project_types = []
|
216
185
|
|
217
|
-
|
218
|
-
TEMPLATES_REPO_LIST.each_with_index do |(key,
|
186
|
+
puts 'Select project type (put index or name):'
|
187
|
+
TEMPLATES_REPO_LIST.each_with_index do |(key, _value), index|
|
219
188
|
selection_index = index + 1
|
220
|
-
selection
|
189
|
+
selection = "#{selection_index}. #{key}"
|
221
190
|
template_project_types.push(selection)
|
222
|
-
|
191
|
+
puts selection
|
223
192
|
end
|
224
193
|
|
225
194
|
loop do
|
226
|
-
type
|
195
|
+
type = ask('> ', template_project_types)
|
227
196
|
type_index = type.to_i - 1
|
228
197
|
|
229
|
-
if TEMPLATES_REPO_LIST.
|
198
|
+
if TEMPLATES_REPO_LIST.key?(type)
|
230
199
|
template_project_url = TEMPLATES_REPO_LIST[type]
|
231
200
|
break
|
232
|
-
elsif
|
201
|
+
elsif (0...TEMPLATES_REPO_LIST.size).include?(type_index)
|
233
202
|
template_project_url = TEMPLATES_REPO_LIST.values[type_index]
|
234
203
|
break
|
235
204
|
end
|
236
205
|
end
|
237
206
|
|
238
|
-
|
207
|
+
puts
|
208
|
+
dest_url = ask('Destination repository url: ')
|
239
209
|
local_directory_to_clone = ask('Directory to clone into: ')
|
240
|
-
|
241
|
-
|
242
|
-
template_project_name = File.basename(template_project_url, '.git')
|
243
|
-
|
244
|
-
root_working_directory = Dir.pwd
|
210
|
+
repo_name = File.basename(dest_url, GIT_EXT)
|
211
|
+
template_project_name = File.basename(template_project_url, GIT_EXT)
|
245
212
|
|
246
213
|
begin
|
247
|
-
# TODO: do we need to rm_rf it every time?
|
248
214
|
FileUtils.rm_rf(ADJUSTER_WORKING_COPY_PATH)
|
249
|
-
Dir.mkdir(ADJUSTER_WORKING_COPY_PATH)
|
250
|
-
Dir.chdir(ADJUSTER_WORKING_COPY_PATH)
|
251
|
-
|
252
|
-
p('Cloning template project ...')
|
253
|
-
git_clone_success = system("git clone #{template_project_url} --recursive")
|
254
|
-
abort('Authentication failed for NIX template project! Please check your credentials and try again!') unless git_clone_success
|
255
|
-
|
256
|
-
Dir.chdir(template_project_name)
|
257
|
-
system('git fetch -t')
|
258
|
-
tags = %x[ git tag ].lines
|
259
|
-
abort('Failed to get last tag!') unless tags.length > 0
|
260
|
-
|
261
|
-
Dir.chdir('..')
|
262
|
-
FileUtils.rm_rf(ADJUSTER_TEMP_PROJECT_NAME) if Dir.exist?(ADJUSTER_TEMP_PROJECT_NAME)
|
263
|
-
FileUtils.cp_r(template_project_name, ADJUSTER_TEMP_PROJECT_NAME)
|
264
|
-
Dir.chdir(ADJUSTER_TEMP_PROJECT_NAME)
|
265
|
-
|
266
|
-
p('Checkout newest template project tag ...')
|
267
|
-
system("git checkout --orphan #{tags[-1]}")
|
268
|
-
current_branch = 'HEAD'
|
269
|
-
|
270
|
-
p("Push ... #{dest_url}")
|
271
|
-
system("git remote add #{repo_name}Remote #{dest_url}")
|
272
|
-
system("git commit -m 'Initial commit'")
|
273
|
-
git_push_success = system("git push #{repo_name}Remote #{current_branch}:refs/heads/master --force")
|
274
|
-
abort("Push failed for #{dest_url} repository! Please check the link and try again!") unless git_push_success
|
275
|
-
|
276
|
-
p("Cloning new created project from #{dest_url} to #{local_directory_to_clone} ...")
|
277
|
-
Dir.chdir(root_working_directory)
|
278
|
-
Dir.chdir(root_working_directory)
|
279
|
-
git_clone_success = system("git clone #{dest_url} --recursive #{local_directory_to_clone}")
|
280
|
-
abort("Error cloning #{dest_url}!") unless git_clone_success
|
281
|
-
rescue
|
282
|
-
p('Project initialization failed!')
|
283
|
-
raise
|
284
|
-
end
|
285
|
-
|
286
|
-
p('Project initialization complete!')
|
287
|
-
end
|
288
215
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
next
|
303
|
-
end
|
216
|
+
Dir.mkdir(ADJUSTER_WORKING_COPY_PATH)
|
217
|
+
Dir.chdir(ADJUSTER_WORKING_COPY_PATH) do
|
218
|
+
puts
|
219
|
+
puts 'Cloning template project ...'
|
220
|
+
Git.clone(template_project_url, nil, :r => true)
|
221
|
+
raise "Authentication failed for #{template_project_url}!" unless Git.last_cmd_success?
|
222
|
+
|
223
|
+
tags = nil
|
224
|
+
|
225
|
+
Dir.chdir(template_project_name) do
|
226
|
+
puts 'Fetch available tags ...'
|
227
|
+
Git.fetch(:t => true)
|
228
|
+
tags = Git.tag
|
304
229
|
end
|
305
230
|
|
306
|
-
|
231
|
+
raise 'Failed to get last tag!' if tags.blank?
|
307
232
|
|
308
|
-
if
|
309
|
-
|
310
|
-
system("git checkout #{ninbas}")
|
311
|
-
Dir.chdir('..')
|
312
|
-
next
|
313
|
-
end
|
314
|
-
end
|
233
|
+
FileUtils.rm_rf(ADJUSTER_TEMP_PROJECT_NAME) if Dir.exist?(ADJUSTER_TEMP_PROJECT_NAME)
|
234
|
+
FileUtils.cp_r(template_project_name, ADJUSTER_TEMP_PROJECT_NAME)
|
315
235
|
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
tags.sort_by!(&:to_i)
|
236
|
+
Dir.chdir(ADJUSTER_TEMP_PROJECT_NAME) do
|
237
|
+
puts 'Checkout newest template project tag ...'
|
238
|
+
Git.checkout(tags.last, :orphan => true)
|
320
239
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
240
|
+
puts "Push ... #{dest_url}"
|
241
|
+
Git.remote_add(repo_name, dest_url)
|
242
|
+
Git.commit(:m => 'Initial commit')
|
243
|
+
Git.push(repo_name, Git::DEFAULT_REFSPEC, :f => true)
|
244
|
+
raise "Push failed for #{dest_url} repository!" unless Git.last_cmd_success?
|
326
245
|
end
|
327
|
-
|
328
|
-
p("Checkout #{repo_name} #{tags.last} tag success!")
|
329
|
-
|
330
|
-
Dir.chdir('..')
|
331
246
|
end
|
332
|
-
rescue
|
333
|
-
@error_message = "#{$!}"
|
334
|
-
ensure
|
335
|
-
p(@error_message) if @error_message
|
336
|
-
Dir.chdir(root_working_directory)
|
337
|
-
end
|
338
|
-
end
|
339
247
|
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
rescue
|
344
|
-
|
248
|
+
puts "Cloning new created project from #{dest_url} to #{local_directory_to_clone} ..."
|
249
|
+
Git.clone(dest_url, local_directory_to_clone, :r => true)
|
250
|
+
raise "Error cloning #{dest_url}!" unless Git.last_cmd_success?
|
251
|
+
rescue => e
|
252
|
+
error('Project initialization failed!', e)
|
345
253
|
end
|
346
254
|
|
347
|
-
|
348
|
-
update_config_settings('PROJECT_TARGET_TO_BUILD', $project_target_to_build)
|
349
|
-
update_config_settings('PROJECT_TARGET_TO_TEST', $project_target_to_test)
|
350
|
-
update_config_settings('WORKSPACE_TO_BUILD', $workspace_to_build)
|
351
|
-
update_config_settings('WORKSPACE_SCHEME_TO_BUILD', $workspace_scheme_to_build)
|
352
|
-
update_config_settings('WORKSPACE_SCHEME_TO_TEST', $workspace_scheme_to_test)
|
353
|
-
update_config_settings('SDK', $sdk)
|
354
|
-
update_config_settings('SDK_FOR_TESTS', $sdk_for_tests)
|
355
|
-
update_config_settings('EXCLUDE_PATTERN_FOR_CODE_COVERAGE', $exclude_pattern_for_code_coverage)
|
356
|
-
update_config_settings('EXCLUDE_PATTERN_FOR_CODE_DUPLICATION', $exclude_pattern_for_code_duplication)
|
357
|
-
update_config_settings('DEPLOY_HOST', $deploy_host)
|
358
|
-
update_config_settings('DEPLOY_PATH', $deploy_path)
|
359
|
-
update_config_settings('DEPLOY_USERNAME', $deploy_username)
|
360
|
-
update_config_settings('DEPLOY_PASSWORD', $deploy_password)
|
361
|
-
update_config_settings('DEPLOY_ITUNESCONNECT_USERNAME', $deploy_itunesconnect_username)
|
362
|
-
update_config_settings('ICONS_PATH', $icons_path)
|
363
|
-
update_config_settings('XCTEST_DESTINATION_DEVICE', $xctest_destination_device)
|
364
|
-
update_config_settings('CONFIGURATION_FILES_PATH', $configuration_files_path)
|
365
|
-
update_config_settings('CODE_COVERAGE_CONFIGURATION', $code_coverage_configuration)
|
366
|
-
update_config_settings('CODE_COVERAGE_OUTPUT_DIRECTORY', $code_coverage_output_directory)
|
367
|
-
update_config_settings('ENV_VAR_PREFIX', $env_var_prefix)
|
368
|
-
update_config_settings('BUNDLE_ID', $bundle_id)
|
369
|
-
update_config_settings('RESIGNED_BUNDLE_ID', $resigned_bundle_id)
|
370
|
-
update_config_settings('RESIGNED_WATCHKIT_APP_BUNDLE_ID', $resigned_watchkit_app_bundle_id)
|
371
|
-
update_config_settings('RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID', $resigned_watchkit_extension_bundle_id)
|
372
|
-
update_config_settings('RESIGNED_WIDGET_BUNDLE_ID', $resigned_widget_bundle_id)
|
373
|
-
update_config_settings('RESIGNED_BUNDLE_NAME', $resigned_bundle_name)
|
374
|
-
update_config_settings('RESIGNED_ENTITLEMENTS_PATH', $resigned_entitlements_path)
|
375
|
-
update_config_settings('RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH', $resigned_watchkit_extension_entitlements_path)
|
376
|
-
update_config_settings('RESIGNED_WIDGET_ENTITLEMENTS_PATH', $resigned_widget_entitlements_path)
|
255
|
+
success('Project initialization complete!')
|
377
256
|
end
|
378
257
|
|
379
|
-
def
|
258
|
+
def read_config_settings
|
259
|
+
begin
|
260
|
+
@config_settings = YAML.load(File.read(CONFIG_SETTINGS_FILE_PATH))
|
261
|
+
rescue => e
|
262
|
+
error("'#{CONFIG_SETTINGS_FILE_PATH}' file processing error!", e)
|
263
|
+
end
|
264
|
+
|
265
|
+
table = Terminal::Table.new
|
266
|
+
table.title = 'Configuration Settings'
|
267
|
+
table.headings = [{:value => 'Key', :alignment => :center},
|
268
|
+
{:value => 'Specification', :alignment => :center},
|
269
|
+
{:value => 'Value', :alignment => :center}]
|
270
|
+
|
271
|
+
update_config_settings(PROJECT_TO_BUILD_KEY, $project_to_build, table, true)
|
272
|
+
update_config_settings(PROJECT_TARGET_TO_BUILD_KEY, $project_target_to_build, table, true)
|
273
|
+
update_config_settings(PROJECT_TARGET_TO_TEST_KEY, $project_target_to_test, table, true)
|
274
|
+
update_config_settings(WORKSPACE_TO_BUILD_KEY, $workspace_to_build, table, true)
|
275
|
+
update_config_settings(WORKSPACE_SCHEME_TO_BUILD_KEY, $workspace_scheme_to_build, table, true)
|
276
|
+
update_config_settings(WORKSPACE_SCHEME_TO_TEST_KEY, $workspace_scheme_to_test, table, true)
|
277
|
+
update_config_settings(SDK_KEY, $sdk, table, true)
|
278
|
+
update_config_settings(SDK_FOR_TESTS_KEY, $sdk_for_tests, table, true)
|
279
|
+
update_config_settings(EXCLUDE_PATTERN_FOR_CODE_COVERAGE_KEY, $exclude_pattern_for_code_coverage, table, true)
|
280
|
+
update_config_settings(EXCLUDE_PATTERN_FOR_CODE_DUPLICATION_KEY, $exclude_pattern_for_code_duplication, table, true)
|
281
|
+
update_config_settings(DEPLOY_HOST_KEY, $deploy_host, table, true)
|
282
|
+
update_config_settings(DEPLOY_PATH_KEY, $deploy_path, table, true)
|
283
|
+
update_config_settings(DEPLOY_USERNAME_KEY, $deploy_username, table, true)
|
284
|
+
update_config_settings(DEPLOY_PASSWORD_KEY, $deploy_password, table, true)
|
285
|
+
update_config_settings(DEPLOY_ITUNESCONNECT_USERNAME_KEY, $deploy_itunesconnect_username, table, true)
|
286
|
+
update_config_settings(ICONS_PATH_KEY, $icons_path, table, true)
|
287
|
+
update_config_settings(XCTEST_DESTINATION_DEVICE_KEY, $xctest_destination_device, table, true)
|
288
|
+
update_config_settings(CONFIGURATION_FILES_PATH_KEY, $configuration_files_path, table, true)
|
289
|
+
update_config_settings(CODE_COVERAGE_CONFIGURATION_KEY, $code_coverage_configuration, table, true)
|
290
|
+
update_config_settings(CODE_COVERAGE_OUTPUT_DIRECTORY_KEY, $code_coverage_output_directory, table, true)
|
291
|
+
update_config_settings(ENV_VAR_PREFIX_KEY, $env_var_prefix, table, true)
|
292
|
+
update_config_settings(BUNDLE_ID_KEY, $bundle_id, table, true)
|
293
|
+
update_config_settings(RESIGNED_BUNDLE_ID_KEY, $resigned_bundle_id, table, true)
|
294
|
+
update_config_settings(RESIGNED_WATCHKIT_APP_BUNDLE_ID_KEY, $resigned_watchkit_app_bundle_id, table, true)
|
295
|
+
update_config_settings(RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID_KEY, $resigned_watchkit_extension_bundle_id, table, true)
|
296
|
+
update_config_settings(RESIGNED_WIDGET_BUNDLE_ID_KEY, $resigned_widget_bundle_id, table, true)
|
297
|
+
update_config_settings(RESIGNED_BUNDLE_NAME_KEY, $resigned_bundle_name, table, true)
|
298
|
+
update_config_settings(RESIGNED_ENTITLEMENTS_PATH_KEY, $resigned_entitlements_path, table, true)
|
299
|
+
update_config_settings(RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH_KEY, $resigned_watchkit_extension_entitlements_path, table, true)
|
300
|
+
update_config_settings(RESIGNED_WIDGET_ENTITLEMENTS_PATH_KEY, $resigned_widget_entitlements_path, table, false)
|
301
|
+
|
302
|
+
puts table
|
303
|
+
end
|
304
|
+
|
305
|
+
def update_config_settings(key, value, table, need_separator)
|
380
306
|
if value
|
381
307
|
@config_settings[key] = value
|
382
|
-
|
308
|
+
spec_column = "|SPECIFIED| directly"
|
383
309
|
else
|
384
|
-
|
310
|
+
spec_column = "|NOT specified| directly. Used from Config"
|
385
311
|
end
|
386
|
-
end
|
387
312
|
|
388
|
-
|
389
|
-
if
|
390
|
-
ENV['NIXENV_CI_BUILD'] = '1'
|
391
|
-
p('CI_BUILD enabled.')
|
392
|
-
else
|
393
|
-
ENV['NIXENV_CI_BUILD'] = nil
|
394
|
-
p('CI_BUILD disabled.')
|
395
|
-
end
|
313
|
+
table.add_row [key, spec_column, @config_settings[key]]
|
314
|
+
table.add_separator if need_separator
|
396
315
|
end
|
397
316
|
|
398
317
|
def working_copy_is_clean?
|
@@ -406,721 +325,380 @@ def working_copy_is_clean?
|
|
406
325
|
else
|
407
326
|
echo \"error: working copy must not have local modifications.\" 1>&2
|
408
327
|
echo \"You must add following files and folders to .gitignore:\"
|
409
|
-
echo \"
|
328
|
+
echo \"#{Git.status(:porcelain => true)}\"
|
410
329
|
exit 1
|
411
330
|
fi")
|
412
331
|
end
|
413
332
|
|
414
|
-
def supplement_config_settings(config)
|
415
|
-
abort("Build error! Configuration #{config} doesn't exist") unless xcode_project_contains_config?(config)
|
416
|
-
|
417
|
-
project = @config_settings['PROJECT_TO_BUILD']
|
418
|
-
target = @config_settings['PROJECT_TARGET_TO_BUILD']
|
419
|
-
scheme = @config_settings['WORKSPACE_SCHEME_TO_BUILD']
|
420
|
-
workspace = @config_settings['WORKSPACE_TO_BUILD']
|
421
|
-
sdk = @config_settings['SDK']
|
422
|
-
|
423
|
-
if project and project.length > 0
|
424
|
-
if target and target.length > 0
|
425
|
-
cmd_output = %x[ xcodebuild -project \"#{project}\"\
|
426
|
-
-target \"#{target}\"\
|
427
|
-
-configuration \"#{config}\"\
|
428
|
-
-sdk \"#{sdk}\"\
|
429
|
-
-showBuildSettings ]
|
430
|
-
else
|
431
|
-
abort("Build error! Scheme #{scheme} doesn't exist") unless xcode_project_contains_scheme?(scheme)
|
432
|
-
cmd_output = %x[ xcodebuild -project \"#{project}\"\
|
433
|
-
-scheme \"#{scheme}\"\
|
434
|
-
-configuration \"#{config}\"\
|
435
|
-
-sdk \"#{sdk}\"\
|
436
|
-
-showBuildSettings ]
|
437
|
-
end
|
438
|
-
elsif workspace and workspace.length > 0
|
439
|
-
abort("Build error! Scheme #{scheme} doesn't exist") unless xcode_project_contains_scheme?(scheme)
|
440
|
-
cmd_output = %x[ xcodebuild -workspace \"#{workspace}\"\
|
441
|
-
-scheme \"#{scheme}\"\
|
442
|
-
-configuration \"#{config}\"\
|
443
|
-
-sdk \"#{sdk}\"\
|
444
|
-
-showBuildSettings ]
|
445
|
-
|
446
|
-
@unescaped_watchkit_extension_product_settings_path = unescaped_product_settings_path(' WatchKit Extension', config)
|
447
|
-
@unescaped_watchkit_app_product_settings_path = unescaped_product_settings_path(' WatchKit App', config)
|
448
|
-
@unescaped_widget_product_settings_path = unescaped_product_settings_path(' Widget', config)
|
449
|
-
else
|
450
|
-
abort('Build error! Either PROJECT_TO_BUILD or WORKSPACE_TO_BUILD must be specified!')
|
451
|
-
end
|
452
|
-
|
453
|
-
# $? - last cmd exit code
|
454
|
-
unless $? == 0
|
455
|
-
abort('Build error!')
|
456
|
-
end
|
457
|
-
|
458
|
-
# Parse build settings
|
459
|
-
env_vars_list = cmd_output.split(/\n/).reject(&:empty?)
|
460
|
-
|
461
|
-
if env_vars_list and env_vars_list.length > 0
|
462
|
-
build_settings_to_strip = Hash[env_vars_list.map { |it| it.split('=', 2) }]
|
463
|
-
build_settings_to_strip.each do |key, value|
|
464
|
-
if key and value
|
465
|
-
stripped_key = key.strip
|
466
|
-
stripped_value = value.strip
|
467
|
-
|
468
|
-
# TODO: investigate and fix me! Brutal hack with PRODUCT_SETTINGS_PATH because ruby File & FileUtils can't work with escaped paths
|
469
|
-
if stripped_key == 'PRODUCT_SETTINGS_PATH'
|
470
|
-
@unescaped_product_settings_path = stripped_value
|
471
|
-
end
|
472
|
-
|
473
|
-
@config_settings[stripped_key] ||= stripped_value.shellescape # Assign new value only if assignee is nil
|
474
|
-
end
|
475
|
-
end
|
476
|
-
end
|
477
|
-
|
478
|
-
build_directory = File.join(Dir.pwd, 'build').shellescape
|
479
|
-
@config_settings['CONFIGURATION_BUILD_DIR'] = build_directory
|
480
|
-
@config_settings['BUILT_PRODUCTS_DIR'] = build_directory
|
481
|
-
@config_settings['DWARF_DSYM_FOLDER_PATH'] = build_directory
|
482
|
-
|
483
|
-
plist_path = @unescaped_product_settings_path
|
484
|
-
bundle_display_name = %x[ /usr/libexec/PlistBuddy -c 'Print CFBundleDisplayName' '#{plist_path}' ].strip!
|
485
|
-
@config_settings['RESIGNED_BUNDLE_NAME'] ||= bundle_display_name.shellescape
|
486
|
-
end
|
487
|
-
|
488
|
-
def unescaped_product_settings_path(scheme_suffix, config)
|
489
|
-
scheme = @config_settings['WORKSPACE_SCHEME_TO_BUILD'] + scheme_suffix
|
490
|
-
if xcode_project_contains_scheme?(scheme)
|
491
|
-
cmd_output = %x[ xcodebuild -workspace \"#{@config_settings['WORKSPACE_TO_BUILD']}\"\
|
492
|
-
-scheme \"#{scheme}\"\
|
493
|
-
-showBuildSettings ]
|
494
|
-
# Parse build settings
|
495
|
-
env_vars_list = cmd_output.split(/\n/).reject(&:empty?)
|
496
|
-
if env_vars_list and env_vars_list.length > 0
|
497
|
-
build_settings_to_strip = Hash.new.compare_by_identity
|
498
|
-
env_vars_list.each do |it|
|
499
|
-
key_value = it.split('=', 2)
|
500
|
-
build_settings_to_strip[key_value[0]] = key_value[1]
|
501
|
-
end
|
502
|
-
|
503
|
-
build_settings_to_strip.each do |key, value|
|
504
|
-
if key and value
|
505
|
-
stripped_key = key.strip
|
506
|
-
stripped_value = value.strip
|
507
|
-
if stripped_key == 'PRODUCT_SETTINGS_PATH'
|
508
|
-
if stripped_value.include?(scheme_suffix)
|
509
|
-
return stripped_value
|
510
|
-
end
|
511
|
-
end
|
512
|
-
end
|
513
|
-
end
|
514
|
-
end
|
515
|
-
end
|
516
|
-
|
517
|
-
nil
|
518
|
-
end
|
519
|
-
|
520
|
-
def xcode_project_contains_config?(config)
|
521
|
-
xcode_project_info['Build Configurations'] and xcode_project_info['Build Configurations'].include?(config)
|
522
|
-
end
|
523
|
-
|
524
|
-
def xcode_project_contains_scheme?(scheme)
|
525
|
-
xcode_project_info['Schemes'] and xcode_project_info['Schemes'].include?(scheme)
|
526
|
-
end
|
527
|
-
|
528
|
-
def xcode_project_info
|
529
|
-
# Parse information about project
|
530
|
-
cmd_output = %x[ xcodebuild -list 2>&1 ]
|
531
|
-
abort("Getting xcode_project_info error! #{cmd_output}") if cmd_output.include?('error')
|
532
|
-
|
533
|
-
cmd_output = cmd_output.lines[1..-1].join # Get all lines except first in order to ignore description message
|
534
|
-
|
535
|
-
info = {}
|
536
|
-
|
537
|
-
cmd_output.split(/\n\n/).each do |pair|
|
538
|
-
key,value = pair.split(/:/)
|
539
|
-
next unless key and value
|
540
|
-
lines = value.lines.map { |line| line.strip }
|
541
|
-
lines.reject! { |line| line.empty? }
|
542
|
-
info[key.strip] = lines
|
543
|
-
end
|
544
|
-
|
545
|
-
info
|
546
|
-
end
|
547
|
-
|
548
333
|
def save_build_env_vars
|
549
|
-
executable_name
|
550
|
-
watchkit_app_executable
|
551
|
-
watchkit_extension_executable = executable_name +
|
552
|
-
widget_executable
|
334
|
+
executable_name = @config_settings[EXECUTABLE_NAME_KEY]
|
335
|
+
watchkit_app_executable = executable_name + WATCHKIT_APP_SUFFIX_WITH_EXT
|
336
|
+
watchkit_extension_executable = executable_name + WATCHKIT_EXTENSION_SUFFIX_WITH_EXT
|
337
|
+
widget_executable = executable_name + WIDGET_SUFFIX_WITH_EXT
|
553
338
|
|
554
|
-
app_product
|
555
|
-
watchkit_extension_relative_product = @config_settings[
|
556
|
-
watchkit_app_relative_product
|
557
|
-
widget_relative_product
|
339
|
+
app_product = File.join(@config_settings[BUILT_PRODUCTS_DIR_KEY], executable_name) + APP_EXT
|
340
|
+
watchkit_extension_relative_product = @config_settings[RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID_KEY].nil? ? nil : File.join(IOS_PLUGINS_FOLDER_NAME, watchkit_extension_executable)
|
341
|
+
watchkit_app_relative_product = @config_settings[RESIGNED_WATCHKIT_APP_BUNDLE_ID_KEY].nil? ? nil : File.join(watchkit_extension_relative_product, watchkit_app_executable)
|
342
|
+
widget_relative_product = @config_settings[RESIGNED_WIDGET_BUNDLE_ID_KEY].nil? ? nil : File.join(IOS_PLUGINS_FOLDER_NAME, widget_executable)
|
558
343
|
|
559
|
-
resigned_watchkit_extension_entitlements_path = @config_settings[
|
560
|
-
resigned_widget_entitlements_path
|
344
|
+
resigned_watchkit_extension_entitlements_path = @config_settings[RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH_KEY].nil? ? nil : @config_settings[RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH_KEY]
|
345
|
+
resigned_widget_entitlements_path = @config_settings[RESIGNED_WIDGET_ENTITLEMENTS_PATH_KEY].nil? ? nil : @config_settings[RESIGNED_WIDGET_ENTITLEMENTS_PATH_KEY]
|
561
346
|
|
562
|
-
|
347
|
+
system("
|
563
348
|
echo \"#!/bin/sh\
|
564
349
|
### AUTOGENERATED BY Nixenvironment; DO NOT EDIT ###
|
565
|
-
PROJECT
|
566
|
-
BUILT_PRODUCTS_DIR
|
567
|
-
OBJECTS_NORMAL_DIR
|
568
|
-
EXECUTABLE_NAME
|
569
|
-
APP_PRODUCT
|
570
|
-
WATCHKIT_APP_RELATIVE_PRODUCT
|
571
|
-
WATCHKIT_EXTENSION_RELATIVE_PRODUCT
|
572
|
-
WIDGET_RELATIVE_PRODUCT
|
573
|
-
APP_DSYM
|
574
|
-
APP_INFOPLIST_FILE
|
575
|
-
EMBEDDED_PROFILE
|
576
|
-
TARGET_NAME
|
577
|
-
CONFIGURATION
|
578
|
-
SDK_NAME
|
579
|
-
RESIGNED_BUNDLE_ID
|
580
|
-
RESIGNED_WATCHKIT_APP_BUNDLE_ID
|
581
|
-
RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID
|
582
|
-
RESIGNED_WIDGET_BUNDLE_ID
|
583
|
-
RESIGNED_BUNDLE_NAME
|
584
|
-
RESIGNED_ENTITLEMENTS_PATH
|
585
|
-
RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH
|
586
|
-
RESIGNED_WIDGET_ENTITLEMENTS_PATH
|
350
|
+
PROJECT='#{@config_settings[PROJECT_KEY]}'
|
351
|
+
BUILT_PRODUCTS_DIR='#{@config_settings[BUILT_PRODUCTS_DIR_KEY]}'
|
352
|
+
OBJECTS_NORMAL_DIR='#{@config_settings[OBJECT_FILE_DIR_NORMAL_KEY]}'
|
353
|
+
EXECUTABLE_NAME='#{@config_settings[EXECUTABLE_NAME_KEY]}'
|
354
|
+
APP_PRODUCT='#{app_product}'
|
355
|
+
WATCHKIT_APP_RELATIVE_PRODUCT='#{watchkit_app_relative_product}'
|
356
|
+
WATCHKIT_EXTENSION_RELATIVE_PRODUCT='#{watchkit_extension_relative_product}'
|
357
|
+
WIDGET_RELATIVE_PRODUCT='#{widget_relative_product}'
|
358
|
+
APP_DSYM='#{app_product + DSYM_EXT}'
|
359
|
+
APP_INFOPLIST_FILE='#{@config_settings[PRODUCT_SETTINGS_PATH_KEY]}'
|
360
|
+
EMBEDDED_PROFILE='#{app_product}/#{@config_settings[EMBEDDED_PROFILE_NAME_KEY]}'
|
361
|
+
TARGET_NAME='#{@config_settings[TARGET_NAME_KEY]}'
|
362
|
+
CONFIGURATION='#{@config_settings[CONFIGURATION_KEY]}'
|
363
|
+
SDK_NAME='#{@config_settings[SDK_NAME_KEY]}'
|
364
|
+
RESIGNED_BUNDLE_ID='#{@config_settings[RESIGNED_BUNDLE_ID_KEY]}'
|
365
|
+
RESIGNED_WATCHKIT_APP_BUNDLE_ID='#{@config_settings[RESIGNED_WATCHKIT_APP_BUNDLE_ID_KEY]}'
|
366
|
+
RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID='#{@config_settings[RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID_KEY]}'
|
367
|
+
RESIGNED_WIDGET_BUNDLE_ID='#{@config_settings[RESIGNED_WIDGET_BUNDLE_ID_KEY]}'
|
368
|
+
RESIGNED_BUNDLE_NAME='#{@config_settings[RESIGNED_BUNDLE_NAME_KEY]}'
|
369
|
+
RESIGNED_ENTITLEMENTS_PATH='#{@config_settings[RESIGNED_ENTITLEMENTS_PATH_KEY]}'
|
370
|
+
RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH='#{resigned_watchkit_extension_entitlements_path}'
|
371
|
+
RESIGNED_WIDGET_ENTITLEMENTS_PATH='#{resigned_widget_entitlements_path}'\" > _last_build_vars.sh
|
587
372
|
")
|
588
373
|
end
|
589
374
|
|
590
375
|
def prebuild(config)
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
abort unless working_copy_is_clean?
|
596
|
-
|
597
|
-
backup_info_plist
|
598
|
-
|
376
|
+
system("#{SAVE_REVISION_SCRIPT_PATH}")
|
377
|
+
error('Error! Working copy is not clean!') unless working_copy_is_clean?
|
378
|
+
backup_info_plists
|
599
379
|
save_build_env_vars
|
600
|
-
|
601
|
-
update_info_plist(config)
|
380
|
+
update_info_plists(config)
|
602
381
|
end
|
603
382
|
|
604
383
|
def build(config, ipa, ndsym, icon_tagger)
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
384
|
+
project_to_build = @config_settings[PROJECT_TO_BUILD_KEY]
|
385
|
+
project_target_to_build = @config_settings[PROJECT_TARGET_TO_BUILD_KEY]
|
386
|
+
workspace_to_build = @config_settings[WORKSPACE_TO_BUILD_KEY]
|
387
|
+
workspace_scheme_to_build = @config_settings[WORKSPACE_SCHEME_TO_BUILD_KEY]
|
388
|
+
sdk = @config_settings[SDK_KEY]
|
389
|
+
configuration_build_dir = @config_settings[CONFIGURATION_BUILD_DIR_KEY]
|
390
|
+
dwarf_dsym_folder_path = @config_settings[DWARF_DSYM_FOLDER_PATH_KEY]
|
391
|
+
built_products_dir = @config_settings[BUILT_PRODUCTS_DIR_KEY]
|
392
|
+
env_var_prefix = @config_settings[ENV_VAR_PREFIX_KEY]
|
612
393
|
|
613
394
|
debug_information_format = ndsym ? 'dwarf' : 'dwarf-with-dsym'
|
614
395
|
|
615
|
-
|
616
|
-
|
617
|
-
build_success = system("#{build} --project \"#{@config_settings['PROJECT_TO_BUILD']}\"\
|
618
|
-
--target \"#{@config_settings['PROJECT_TARGET_TO_BUILD']}\"\
|
619
|
-
--configuration \"#{config}\"\
|
620
|
-
--sdk \"#{@config_settings['SDK']}\"\
|
621
|
-
--env-var-prefix \"#{@config_settings['ENV_VAR_PREFIX']}\"\
|
622
|
-
DEBUG_INFORMATION_FORMAT=\"#{debug_information_format}\"\
|
623
|
-
DWARF_DSYM_FOLDER_PATH=\"#{dwarf_dsym_folder_path}\"\
|
624
|
-
CONFIGURATION_BUILD_DIR=\"#{configuration_build_dir}\"\
|
625
|
-
BUILT_PRODUCTS_DIR=\"#{built_products_dir}\"")
|
626
|
-
else
|
627
|
-
build_success = system("#{build} --project \"#{@config_settings['PROJECT_TO_BUILD']}\"\
|
628
|
-
--scheme \"#{@config_settings['WORKSPACE_SCHEME_TO_BUILD']}\"\
|
629
|
-
--configuration \"#{config}\"\
|
630
|
-
--sdk \"#{@config_settings['SDK']}\"\
|
631
|
-
--env-var-prefix \"#{@config_settings['ENV_VAR_PREFIX']}\"\
|
632
|
-
DEBUG_INFORMATION_FORMAT=\"#{debug_information_format}\"\
|
633
|
-
DWARF_DSYM_FOLDER_PATH=\"#{dwarf_dsym_folder_path}\"\
|
634
|
-
CONFIGURATION_BUILD_DIR=\"#{configuration_build_dir}\"\
|
635
|
-
BUILT_PRODUCTS_DIR=\"#{built_products_dir}\"")
|
636
|
-
end
|
637
|
-
elsif @config_settings['WORKSPACE_TO_BUILD'] and @config_settings['WORKSPACE_TO_BUILD'].length > 0
|
638
|
-
build_success = system("#{build} --workspace \"#{@config_settings['WORKSPACE_TO_BUILD']}\"\
|
639
|
-
--scheme \"#{@config_settings['WORKSPACE_SCHEME_TO_BUILD']}\"\
|
640
|
-
--configuration \"#{config}\"\
|
641
|
-
--sdk \"#{@config_settings['SDK']}\"\
|
642
|
-
--env-var-prefix \"#{@config_settings['ENV_VAR_PREFIX']}\"\
|
643
|
-
DEBUG_INFORMATION_FORMAT=\"#{debug_information_format}\"\
|
644
|
-
DWARF_DSYM_FOLDER_PATH=\"#{dwarf_dsym_folder_path}\"\
|
645
|
-
CONFIGURATION_BUILD_DIR=\"#{configuration_build_dir}\"\
|
646
|
-
BUILT_PRODUCTS_DIR=\"#{built_products_dir}\"")
|
647
|
-
end
|
648
|
-
|
649
|
-
unless build_success
|
650
|
-
restore_info_plist
|
651
|
-
abort('Build error!')
|
652
|
-
end
|
653
|
-
|
654
|
-
if @config_settings['SDK'].include?('macos')
|
655
|
-
build_env_vars = load_build_env_vars
|
656
|
-
built_products_dir = build_env_vars['BUILT_PRODUCTS_DIR']
|
657
|
-
executable_name = build_env_vars['EXECUTABLE_NAME']
|
658
|
-
target_name = build_env_vars['TARGET_NAME']
|
659
|
-
configuration = build_env_vars['CONFIGURATION']
|
660
|
-
app_product = build_env_vars['APP_PRODUCT']
|
396
|
+
other_args = { 'DEBUG_INFORMATION_FORMAT' => debug_information_format, 'DWARF_DSYM_FOLDER_PATH' => dwarf_dsym_folder_path,
|
397
|
+
'CONFIGURATION_BUILD_DIR' => configuration_build_dir, 'BUILT_PRODUCTS_DIR' => built_products_dir }
|
661
398
|
|
662
|
-
|
663
|
-
new_ipa_path = "#{built_products_dir}/#{new_ipa_name}.zip"
|
664
|
-
p("IPA_PRODUCT = #{new_ipa_path}")
|
399
|
+
Xcodebuild.build(sdk, config, project_to_build, project_target_to_build, workspace_to_build, workspace_scheme_to_build, env_var_prefix, other_args)
|
665
400
|
|
666
|
-
|
667
|
-
tmp_dir = Dir.mktmpdir
|
401
|
+
error('Build error!') unless Xcodebuild.last_cmd_success?
|
668
402
|
|
403
|
+
if sdk.include?('macos')
|
669
404
|
begin
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
Dir.mkdir(dest_app_dir)
|
675
|
-
|
676
|
-
p("--> Copy '#{app_product}' into '#{dest_app_product}' ...")
|
677
|
-
FileUtils.cp_r(app_product, dest_app_product)
|
405
|
+
Archiver.make_macos_zip
|
406
|
+
rescue => e
|
407
|
+
error("Make 'macos_zip' error!", e)
|
408
|
+
end
|
678
409
|
|
679
|
-
|
680
|
-
|
681
|
-
|
410
|
+
success("Make 'macos_zip' complete!")
|
411
|
+
elsif sdk.include?('iphoneos')
|
412
|
+
if config == 'Release'
|
413
|
+
puts 'IconTagger: configuration is Release. Skipping ...'
|
414
|
+
else
|
415
|
+
case icon_tagger
|
416
|
+
when 'full' then tag_icon(false)
|
417
|
+
when 'short' then tag_icon(true)
|
418
|
+
when 'off' then puts 'IconTagger is disabled. Skipping ...'
|
419
|
+
else puts "Unknown IconTagger mode: '#{icon_tagger}'. Skipping ..."
|
682
420
|
end
|
683
|
-
|
684
|
-
p("--> Zip '#{tmp_dir}' into '#{new_ipa_path}' ...")
|
685
|
-
Dir.chdir(tmp_dir)
|
686
|
-
|
687
|
-
zip_success = system("/usr/bin/zip --symlinks --verbose --recurse-paths \"#{new_ipa_path}\" .")
|
688
|
-
raise unless zip_success
|
689
|
-
rescue
|
690
|
-
abort('Make zip failed!')
|
691
|
-
ensure
|
692
|
-
Dir.chdir(root_working_dir)
|
693
|
-
FileUtils.remove_entry(tmp_dir)
|
694
421
|
end
|
695
422
|
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
423
|
+
ipa.split.each do |current_ipa|
|
424
|
+
begin
|
425
|
+
case current_ipa
|
426
|
+
when 'device' then Archiver.make_signed_ipa
|
427
|
+
when 'resigned_device' then Archiver.make_resigned_ipa_for_device
|
428
|
+
when 'resigned_adhoc' then Archiver.make_resigned_ipa_for_adhoc
|
429
|
+
when 'resigned_appstore' then Archiver.make_resigned_ipa_for_appstore
|
430
|
+
else raise "Unknown ipa '#{current_ipa}'!"
|
431
|
+
end
|
432
|
+
rescue => e
|
433
|
+
error("Make '#{current_ipa}' error!", e)
|
434
|
+
end
|
707
435
|
|
708
|
-
|
709
|
-
p('IconTagger: configuration is Release. Skipping ...')
|
710
|
-
else
|
711
|
-
case icon_tagger
|
712
|
-
when 'full'
|
713
|
-
tag_icon(false)
|
714
|
-
when 'short'
|
715
|
-
tag_icon(true)
|
716
|
-
when 'off'
|
717
|
-
p('IconTagger is disabled. Skipping ...')
|
718
|
-
else
|
719
|
-
p("Unknown IconTagger mode: '#{icon_tagger}'. Skipping ...")
|
436
|
+
success("Make '#{current_ipa}' complete!")
|
720
437
|
end
|
438
|
+
else
|
439
|
+
error("Build error! Unknown sdk: #{sdk}!")
|
721
440
|
end
|
722
441
|
|
723
|
-
|
724
|
-
case current_ipa
|
725
|
-
# create .ipa file from last built app product
|
726
|
-
when 'device'
|
727
|
-
make = File.join(BUILD_SCRIPTS_PATH, 'MakeIPA.sh')
|
728
|
-
# resign last built app product with iPhone Developer profile and package it into .ipa file
|
729
|
-
when 'resigned_device'
|
730
|
-
make = File.join(BUILD_SCRIPTS_PATH, 'MakeResignedIPAForDevice.sh')
|
731
|
-
# resign last built app product with iPhone Distribution AdHoc profile and package it into .ipa file
|
732
|
-
when 'resigned_adhoc'
|
733
|
-
make = File.join(BUILD_SCRIPTS_PATH, 'MakeResignedIPAForAdHocDistribution.sh')
|
734
|
-
# resign last built app product with Appstore distribution profile and package it into .ipa file
|
735
|
-
when 'resigned_appstore'
|
736
|
-
make = File.join(BUILD_SCRIPTS_PATH, 'MakeResignedIPAForAppstore.sh')
|
737
|
-
else
|
738
|
-
restore_info_plist
|
739
|
-
abort("Error: Unknown ipa '#{current_ipa}'!")
|
740
|
-
end
|
741
|
-
|
742
|
-
make_success = system("#{make}") if defined? make
|
743
|
-
|
744
|
-
unless make_success
|
745
|
-
restore_info_plist
|
746
|
-
abort("#{make} error!")
|
747
|
-
end
|
748
|
-
end
|
442
|
+
success('Build complete!')
|
749
443
|
end
|
750
444
|
|
751
445
|
def unity_build(configuration, unity_platform, unity_path, development_build, keystore_path, keystore_password, key_alias_name, key_alias_password)
|
752
|
-
root_working_dir = nil
|
753
|
-
need_chdir_to_root_working_dir = false
|
754
446
|
need_to_build_ios = false
|
755
447
|
|
756
|
-
|
757
|
-
|
448
|
+
system("#{SAVE_REVISION_SCRIPT_PATH}")
|
449
|
+
error('Error! Working copy is not clean!') unless working_copy_is_clean?
|
758
450
|
|
759
|
-
|
760
|
-
|
761
|
-
unity_build_scripts_dir = File.join(BUILD_SCRIPTS_PATH, 'UnityBuildAutomationScripts')
|
762
|
-
unity_editor_dir = File.join(Dir.pwd, 'Assets/Editor')
|
763
|
-
|
764
|
-
if File.directory?(unity_editor_dir)
|
765
|
-
FileUtils.cp_r(unity_build_scripts_dir, unity_editor_dir)
|
451
|
+
if File.directory?(UNITY_EDITOR_DIR)
|
452
|
+
FileUtils.cp_r(UNITY_BUILD_SCRIPTS_DIR, UNITY_EDITOR_DIR)
|
766
453
|
else
|
767
|
-
|
454
|
+
error("Copy #{UNITY_BUILD_SCRIPTS_PATH} error! #{UNITY_EDITOR_DIR} doesn't exist!")
|
768
455
|
end
|
769
456
|
|
770
457
|
case unity_platform
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
clean_working_copy(false)
|
801
|
-
else
|
802
|
-
abort("Error: Unknown unity target platform '#{unity_platform}'!")
|
458
|
+
when 'ios'
|
459
|
+
need_to_build_ios = true
|
460
|
+
development_build_arg = development_build ? ';developmentBuild=' : ''
|
461
|
+
|
462
|
+
puts 'Generating IOS project from UNITY project ...'
|
463
|
+
unity_success = system("#{unity_path} -executeMethod NIXBuilder.MakeiOSBuild -projectPath '#{Dir.pwd}'\
|
464
|
+
-batchmode -logFile -quit -customArgs:buildPath='#{UNITY_IOS_PROJECT_PATH}#{development_build_arg}'")
|
465
|
+
error('iOS build unity error!') unless unity_success
|
466
|
+
success('IOS project was generated.')
|
467
|
+
|
468
|
+
clean_working_copy(false)
|
469
|
+
|
470
|
+
$project_to_build = 'Unity-iPhone.xcodeproj'
|
471
|
+
$project_target_to_build = 'Unity-iPhone'
|
472
|
+
when 'android'
|
473
|
+
development_build_arg = development_build ? '--development-build' : ''
|
474
|
+
keystore_path_arg = keystore_path ? "--keystore-path #{keystore_path}" : ''
|
475
|
+
keystore_password_arg = keystore_password ? "--keystore-password #{keystore_password}" : ''
|
476
|
+
key_alias_name_arg = key_alias_name ? "--key-alias-name #{key_alias_name}" : ''
|
477
|
+
key_alias_password_arg = key_alias_password ? "--key-alias-password #{key_alias_password}" : ''
|
478
|
+
|
479
|
+
build_success = system("#{UNITY_BUILD_ANDROID_SCRIPT_PATH} --configuration #{configuration} --unity-path #{unity_path}\
|
480
|
+
#{development_build_arg} #{keystore_path_arg} #{keystore_password_arg} #{key_alias_name_arg} #{key_alias_password_arg}")
|
481
|
+
error('Android build unity error!') unless build_success
|
482
|
+
|
483
|
+
clean_working_copy(false)
|
484
|
+
else
|
485
|
+
error("Error: Unknown unity target platform '#{unity_platform}'!")
|
803
486
|
end
|
804
487
|
|
805
|
-
|
488
|
+
success('Unity build complete!')
|
489
|
+
|
490
|
+
need_to_build_ios
|
806
491
|
end
|
807
492
|
|
808
493
|
def tag_icon(short_version)
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
version = %x[ /usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' '#{plist_path}' ].strip!
|
494
|
+
plist_path = @config_settings[PRODUCT_SETTINGS_PATH_KEY]
|
495
|
+
info_plist = Plist.from_file(plist_path)
|
496
|
+
version = info_plist['CFBundleShortVersionString']
|
813
497
|
monotonic_revision = %x[ source _last_revision.sh && echo ${MONOTONIC_REVISION} ].strip!
|
814
|
-
style
|
815
|
-
mask_path
|
816
|
-
icons_dir
|
817
|
-
app_product
|
818
|
-
|
819
|
-
system("#{utility} --shortVersion=#{version}\
|
820
|
-
--buildNumber=#{monotonic_revision}\
|
821
|
-
--style=#{style}\
|
822
|
-
--maskPath=\"#{mask_path}\"\
|
823
|
-
--plist=\"#{plist_path}\"\
|
824
|
-
--sourceIconsPath=\"#{icons_dir}\"\
|
825
|
-
--destinationIconsPath=#{app_product}")
|
826
|
-
end
|
498
|
+
style = short_version ? 'OneLine' : 'TwoLine'
|
499
|
+
mask_path = File.join(TAGGER_UTILITY_DIRECTORY, "masks/#{style}Mask.png")
|
500
|
+
icons_dir = File.join(Dir.pwd, @config_settings[ICONS_PATH_KEY])
|
501
|
+
app_product = File.join(@config_settings[BUILT_PRODUCTS_DIR_KEY], @config_settings[EXECUTABLE_NAME_KEY]) + APP_EXT
|
827
502
|
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
vars_to_strip = Hash[vars_list.map { |it| it.split('=', 2) }]
|
836
|
-
vars_to_strip.each do |key, value|
|
837
|
-
if key and value
|
838
|
-
stripped_key = key.strip
|
839
|
-
stripped_value = value.strip
|
840
|
-
|
841
|
-
p("#{stripped_key} : #{stripped_value}")
|
842
|
-
build_env_vars[stripped_key] = stripped_value
|
843
|
-
end
|
844
|
-
end
|
845
|
-
end
|
846
|
-
|
847
|
-
build_env_vars
|
503
|
+
system("#{TAGGER_UTILITY_PATH} --shortVersion=#{version}\
|
504
|
+
--buildNumber=#{monotonic_revision}\
|
505
|
+
--style=#{style}\
|
506
|
+
--maskPath=\"#{mask_path}\"\
|
507
|
+
--plist=\"#{plist_path}\"\
|
508
|
+
--sourceIconsPath=\"#{icons_dir}\"\
|
509
|
+
--destinationIconsPath=#{app_product}")
|
848
510
|
end
|
849
511
|
|
850
|
-
def
|
851
|
-
|
852
|
-
|
853
|
-
@
|
854
|
-
|
855
|
-
|
856
|
-
p('Info.plist was backuped.')
|
857
|
-
|
858
|
-
unless @unescaped_watchkit_app_product_settings_path.nil?
|
859
|
-
p('Backuping WatchKit App Info.plist ...')
|
860
|
-
|
861
|
-
@watchkit_app_info_plist_backup_name = @unescaped_watchkit_app_product_settings_path + '.backup'
|
862
|
-
FileUtils.cp(@unescaped_watchkit_app_product_settings_path, @watchkit_app_info_plist_backup_name)
|
863
|
-
|
864
|
-
p('WatchKit App Info.plist was backuped.')
|
865
|
-
end
|
866
|
-
|
867
|
-
unless @unescaped_watchkit_extension_product_settings_path.nil?
|
868
|
-
p('Backuping WatchKit Extension Info.plist ...')
|
869
|
-
|
870
|
-
@watchkit_extension_info_plist_backup_name = @unescaped_watchkit_extension_product_settings_path + '.backup'
|
871
|
-
FileUtils.cp(@unescaped_watchkit_extension_product_settings_path, @watchkit_extension_info_plist_backup_name)
|
872
|
-
|
873
|
-
p('WatchKit Extension Info.plist was backuped.')
|
874
|
-
end
|
512
|
+
def backup_info_plists
|
513
|
+
@info_plist_backup_name = backup_info_plist(@config_settings[PRODUCT_SETTINGS_PATH_KEY], nil)
|
514
|
+
@watchkit_app_info_plist_backup_name = backup_info_plist(@config_settings[WATCHKIT_APP_PRODUCT_SETTINGS_PATH_KEY], WATCHKIT_APP_PREFIX)
|
515
|
+
@watchkit_extension_info_plist_backup_name = backup_info_plist(@config_settings[WATCHKIT_EXTENSION_PRODUCT_SETTINGS_PATH_KEY], WATCHKIT_EXTENSION_PREFIX)
|
516
|
+
@widget_info_plist_backup_name = backup_info_plist(@config_settings[WIDGET_PRODUCT_SETTINGS_PATH_KEY], WIDGET_PREFIX)
|
517
|
+
end
|
875
518
|
|
876
|
-
|
877
|
-
|
519
|
+
def backup_info_plist(product_settings_path, description)
|
520
|
+
return if product_settings_path.blank?
|
878
521
|
|
879
|
-
|
880
|
-
|
522
|
+
puts "Backuping #{description}Info.plist ..."
|
523
|
+
info_plist_backup_name = product_settings_path + '.backup'
|
524
|
+
FileUtils.cp(product_settings_path, info_plist_backup_name)
|
525
|
+
puts "#{description}Info.plist was backuped."
|
881
526
|
|
882
|
-
|
883
|
-
end
|
527
|
+
info_plist_backup_name
|
884
528
|
end
|
885
529
|
|
886
|
-
def
|
887
|
-
|
888
|
-
|
889
|
-
revision = %x[ source _last_revision.sh && echo ${REVISION} ].strip!
|
530
|
+
def update_info_plists(config)
|
531
|
+
revision = %x[ source _last_revision.sh && echo ${REVISION} ].strip!
|
890
532
|
monotonic_revision = %x[ source _last_revision.sh && echo ${MONOTONIC_REVISION} ].strip!
|
891
|
-
bundle_id
|
892
|
-
|
893
|
-
update_success = system("/usr/libexec/PlistBuddy -c 'Set :CFBundleVersion \"#{monotonic_revision}\"' \"#{@unescaped_product_settings_path}\"")
|
894
|
-
|
895
|
-
if bundle_id
|
896
|
-
update_success &&= system("/usr/libexec/PlistBuddy -c 'Set :CFBundleIdentifier \"#{bundle_id}\"' \"#{@unescaped_product_settings_path}\"")
|
897
|
-
end
|
898
|
-
|
899
|
-
update_success &&= system("/usr/libexec/PlistBuddy -c 'Add :Configuration string \"#{config}\"' \"#{@unescaped_product_settings_path}\"")
|
900
|
-
update_success &&= system("/usr/libexec/PlistBuddy -c 'Add :RevisionNumber string \"#{revision}\"' \"#{@unescaped_product_settings_path}\"")
|
901
|
-
|
902
|
-
unless update_success
|
903
|
-
restore_info_plist
|
904
|
-
abort('Update Info.plist error!')
|
905
|
-
end
|
906
|
-
|
907
|
-
p('Info.plist was updated.')
|
908
|
-
|
909
|
-
unless @unescaped_watchkit_app_product_settings_path.nil?
|
910
|
-
p('Updating WatchKit App Info.plist ...')
|
911
|
-
|
912
|
-
update_success = system("/usr/libexec/PlistBuddy -c 'Set :CFBundleVersion \"#{monotonic_revision}\"' \"#{@unescaped_watchkit_app_product_settings_path}\"")
|
913
|
-
unless update_success
|
914
|
-
restore_info_plist
|
915
|
-
abort('Update WatchKit App Info.plist error!')
|
916
|
-
end
|
917
|
-
|
918
|
-
p('WatchKit App Info.plist was updated.')
|
919
|
-
end
|
920
|
-
|
921
|
-
unless @unescaped_watchkit_extension_product_settings_path.nil?
|
922
|
-
p('Updating Extension App Info.plist ...')
|
923
|
-
|
924
|
-
update_success = system("/usr/libexec/PlistBuddy -c 'Set :CFBundleVersion \"#{monotonic_revision}\"' \"#{@unescaped_watchkit_extension_product_settings_path}\"")
|
925
|
-
unless update_success
|
926
|
-
restore_info_plist
|
927
|
-
abort('Update WatchKit Extension Info.plist error!')
|
928
|
-
end
|
929
|
-
|
930
|
-
p('WatchKit Extension Info.plist was updated.')
|
931
|
-
end
|
932
|
-
|
933
|
-
unless @unescaped_widget_product_settings_path.nil?
|
934
|
-
p('Updating Widget Info.plist ...')
|
935
|
-
|
936
|
-
update_success = system("/usr/libexec/PlistBuddy -c 'Set :CFBundleVersion \"#{monotonic_revision}\"' \"#{@unescaped_widget_product_settings_path}\"")
|
937
|
-
unless update_success
|
938
|
-
restore_info_plist
|
939
|
-
abort('Update Widget Info.plist error!')
|
940
|
-
end
|
533
|
+
bundle_id = @config_settings[BUNDLE_ID_KEY]
|
941
534
|
|
942
|
-
|
943
|
-
|
535
|
+
update_info_plist(@config_settings[PRODUCT_SETTINGS_PATH_KEY], monotonic_revision, revision, bundle_id, config, nil)
|
536
|
+
update_info_plist(@config_settings[WATCHKIT_APP_PRODUCT_SETTINGS_PATH_KEY], monotonic_revision, nil, nil, nil, WATCHKIT_APP_PREFIX)
|
537
|
+
update_info_plist(@config_settings[WATCHKIT_EXTENSION_PRODUCT_SETTINGS_PATH_KEY], monotonic_revision, nil, nil, nil, WATCHKIT_EXTENSION_PREFIX)
|
538
|
+
update_info_plist(@config_settings[WIDGET_PRODUCT_SETTINGS_PATH_KEY], monotonic_revision, nil, nil, nil, WIDGET_PREFIX)
|
944
539
|
end
|
945
540
|
|
946
|
-
def
|
947
|
-
|
948
|
-
|
949
|
-
File.delete(@unescaped_product_settings_path)
|
950
|
-
File.rename(@info_plist_backup_name, @unescaped_product_settings_path)
|
541
|
+
def update_info_plist(product_settings_path, monotonic_revision, revision, bundle_id, config, description)
|
542
|
+
return if product_settings_path.blank?
|
951
543
|
|
952
|
-
|
544
|
+
puts "Updating #{description}Info.plist ..."
|
953
545
|
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
546
|
+
begin
|
547
|
+
info_plist = Plist.from_file(product_settings_path)
|
548
|
+
info_plist['CFBundleVersion'] = monotonic_revision if monotonic_revision
|
549
|
+
info_plist['RevisionNumber'] = revision if revision
|
550
|
+
info_plist['CFBundleIdentifier'] = bundle_id if bundle_id
|
551
|
+
info_plist['Configuration'] = config if config
|
552
|
+
info_plist.save(product_settings_path, Plist::FORMAT_XML)
|
553
|
+
rescue => e
|
554
|
+
error("Update #{description}Info.plist error!", e)
|
961
555
|
end
|
962
556
|
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
File.delete(@unescaped_watchkit_extension_product_settings_path)
|
967
|
-
File.rename(@watchkit_extension_info_plist_backup_name, @unescaped_watchkit_extension_product_settings_path)
|
968
|
-
|
969
|
-
p('WatchKit Extension Info.plist was restored.')
|
970
|
-
end
|
557
|
+
success("#{description}Info.plist was updated.")
|
558
|
+
end
|
971
559
|
|
972
|
-
|
973
|
-
|
560
|
+
def restore_info_plists
|
561
|
+
restore_info_plist(@config_settings[PRODUCT_SETTINGS_PATH_KEY], @info_plist_backup_name, nil)
|
562
|
+
restore_info_plist(@config_settings[WATCHKIT_APP_PRODUCT_SETTINGS_PATH_KEY], @watchkit_app_info_plist_backup_name, WATCHKIT_APP_PREFIX)
|
563
|
+
restore_info_plist(@config_settings[WATCHKIT_EXTENSION_PRODUCT_SETTINGS_PATH_KEY], @watchkit_extension_info_plist_backup_name, WATCHKIT_EXTENSION_PREFIX)
|
564
|
+
restore_info_plist(@config_settings[WIDGET_PRODUCT_SETTINGS_PATH_KEY], @widget_info_plist_backup_name, WIDGET_PREFIX)
|
565
|
+
end
|
974
566
|
|
975
|
-
|
976
|
-
|
567
|
+
def restore_info_plist(product_settings_path, info_plist_backup_name, description)
|
568
|
+
return if product_settings_path.blank? || info_plist_backup_name.blank?
|
977
569
|
|
978
|
-
|
979
|
-
|
570
|
+
puts "Restoring #{description}Info.plist ..."
|
571
|
+
File.delete(product_settings_path)
|
572
|
+
File.rename(info_plist_backup_name, product_settings_path)
|
573
|
+
puts "#{description}Info.plist was restored."
|
980
574
|
end
|
981
575
|
|
982
576
|
def deploy(deliver_deploy)
|
983
|
-
deploy_host
|
984
|
-
deploy_username
|
985
|
-
deploy_password
|
986
|
-
deploy_itunesconnect_username = @config_settings[
|
577
|
+
deploy_host = @config_settings[DEPLOY_HOST_KEY].blank? ? ENV[DEPLOY_HOST_KEY] : @config_settings[DEPLOY_HOST_KEY]
|
578
|
+
deploy_username = @config_settings[DEPLOY_USERNAME_KEY].blank? ? ENV[DEPLOY_USERNAME_KEY] : @config_settings[DEPLOY_USERNAME_KEY]
|
579
|
+
deploy_password = @config_settings[DEPLOY_PASSWORD_KEY].blank? ? ENV[DEPLOY_PASSWORD_KEY] : @config_settings[DEPLOY_PASSWORD_KEY]
|
580
|
+
deploy_itunesconnect_username = @config_settings[DEPLOY_ITUNESCONNECT_USERNAME_KEY].blank? ? ENV[DEPLOY_ITUNESCONNECT_USERNAME_KEY] : @config_settings[DEPLOY_ITUNESCONNECT_USERNAME_KEY]
|
987
581
|
|
988
582
|
deploy_itunesconnect_username ||= 'unknown'
|
989
583
|
deliver_deploy = deliver_deploy ? 1 : 0
|
990
584
|
|
991
|
-
deploy_success = false
|
992
|
-
|
993
585
|
sdk_name = %x[ source _last_build_vars.sh && echo ${SDK_NAME} ].strip!
|
994
586
|
|
995
587
|
if sdk_name.include?('macos')
|
996
|
-
build_env_vars =
|
997
|
-
ipa_bundle_id = build_env_vars[
|
998
|
-
current_app_version = build_env_vars[
|
999
|
-
current_build_version = build_env_vars[
|
1000
|
-
name_for_deployment = build_env_vars[
|
1001
|
-
executable_name = build_env_vars[
|
1002
|
-
ipa_product = build_env_vars[
|
1003
|
-
app_dsym = build_env_vars[
|
1004
|
-
built_products_dir = build_env_vars[
|
588
|
+
build_env_vars = BuildEnvVarsLoader.load
|
589
|
+
ipa_bundle_id = build_env_vars[IPA_BUNDLE_ID_KEY]
|
590
|
+
current_app_version = build_env_vars[CURRENT_APP_VERSION_KEY]
|
591
|
+
current_build_version = build_env_vars[CURRENT_BUILD_VERSION_KEY]
|
592
|
+
name_for_deployment = build_env_vars[NAME_FOR_DEPLOYMENT_KEY]
|
593
|
+
executable_name = build_env_vars[EXECUTABLE_NAME_KEY]
|
594
|
+
ipa_product = build_env_vars[IPA_PRODUCT_KEY]
|
595
|
+
app_dsym = build_env_vars[APP_DSYM_KEY]
|
596
|
+
built_products_dir = build_env_vars[BUILT_PRODUCTS_DIR_KEY]
|
1005
597
|
|
1006
598
|
local_path_to_app = File.join(Dir.tmpdir, ipa_bundle_id)
|
1007
599
|
local_path_to_build = File.join(local_path_to_app, "v.#{current_app_version}_#{current_build_version}")
|
1008
|
-
FileUtils.rm_rf(local_path_to_build)
|
600
|
+
FileUtils.rm_rf(local_path_to_build)
|
1009
601
|
FileUtils.mkdir_p(local_path_to_build)
|
1010
602
|
|
1011
603
|
configuration_full_path = File.join(local_path_to_build, name_for_deployment)
|
1012
604
|
FileUtils.mkdir(configuration_full_path)
|
1013
|
-
FileUtils.cp(ipa_product, File.join(configuration_full_path,
|
605
|
+
FileUtils.cp(ipa_product, File.join(configuration_full_path, executable_name) + ZIP_EXT)
|
1014
606
|
|
1015
607
|
if File.exist?(app_dsym)
|
1016
608
|
Dir.chdir(built_products_dir)
|
1017
|
-
destination = File.join(configuration_full_path, "#{executable_name}
|
1018
|
-
system("zip -r \"#{destination}\" \"#{executable_name}
|
609
|
+
destination = File.join(configuration_full_path, "#{executable_name + APP_EXT + DSYM_EXT + ZIP_EXT}")
|
610
|
+
system("zip -r \"#{destination}\" \"#{executable_name + APP_EXT + DSYM_EXT}\"")
|
1019
611
|
end
|
1020
612
|
|
1021
|
-
deploy_path
|
1022
|
-
|
1023
|
-
deploy_success = system("#{deploy} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password} #{local_path_to_app}")
|
613
|
+
deploy_path = @config_settings[DEPLOY_PATH_KEY].blank? ? MACOS_PROJECTS_DEPLOY_PATH : @config_settings[DEPLOY_PATH_KEY]
|
614
|
+
deploy_success = system("#{DEPLOY_SCRIPT_PATH} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password} #{local_path_to_app}")
|
1024
615
|
else
|
1025
|
-
deploy_path
|
1026
|
-
|
1027
|
-
deploy_success = system("#{deploy} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password} #{deploy_itunesconnect_username} #{deliver_deploy}")
|
616
|
+
deploy_path = @config_settings[DEPLOY_PATH_KEY].blank? ? ENV[DEPLOY_PATH_KEY] : @config_settings[DEPLOY_PATH_KEY]
|
617
|
+
deploy_success = system("#{DEPLOY_IPA_SCRIPT_PATH} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password} #{deploy_itunesconnect_username} #{deliver_deploy}")
|
1028
618
|
end
|
1029
619
|
|
1030
|
-
|
620
|
+
deploy_success ? success('Deploy complete!') : error('Deploy error!')
|
1031
621
|
end
|
1032
622
|
|
1033
623
|
def unity_deploy(unity_platform)
|
1034
|
-
root_working_dir = nil
|
1035
|
-
need_chdir_to_root_working_dir = false
|
1036
624
|
need_to_deploy_ios = false
|
1037
625
|
|
1038
626
|
case unity_platform
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
need_to_deploy_ios = true
|
1043
|
-
|
1044
|
-
ios_project_path = File.join(root_working_dir, UNITY_BUILDS_IOS_PATH)
|
1045
|
-
Dir.chdir(ios_project_path)
|
1046
|
-
when 'android'
|
1047
|
-
deploy_success = system(File.join(BUILD_SCRIPTS_PATH, 'DeployAPK.py'))
|
1048
|
-
abort('Android deploy unity error!') unless deploy_success
|
1049
|
-
else
|
1050
|
-
abort("Error: Unknown unity target platform '#{unity_platform}'!")
|
627
|
+
when 'ios' then need_to_deploy_ios = true
|
628
|
+
when 'android' then system(DEPLOY_APK_SCRIPT_PATH) ? success('Unity android deploy complete!') : error('Unity android deploy error!')
|
629
|
+
else error("Error: Unknown unity target platform '#{unity_platform}'!")
|
1051
630
|
end
|
1052
631
|
|
1053
|
-
|
632
|
+
need_to_deploy_ios
|
1054
633
|
end
|
1055
634
|
|
1056
635
|
def clean
|
1057
|
-
|
1058
|
-
|
1059
|
-
system("#{remove_temporary_files}")
|
636
|
+
system("#{REMOVE_TEMPORARY_FILES_SCRIPT_PATH}")
|
1060
637
|
system('rm -rf test-results/')
|
1061
638
|
system("find . -name \"*.pyc\" -exec rm -rf {} \;")
|
1062
|
-
|
639
|
+
Xcodebuild.clean_all_targets
|
1063
640
|
end
|
1064
641
|
|
1065
642
|
def test
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
-configuration \"Debug\"\
|
1073
|
-
-sdk \"#{@config_settings['SDK_FOR_TESTS']}\"\
|
1074
|
-
-xcconfig \"#{code_coverage_configuration}\"\
|
1075
|
-
-destination-timeout \"#{timeout}\"\
|
1076
|
-
-destination \"#{@config_settings['XCTEST_DESTINATION_DEVICE']}\"\
|
1077
|
-
test 2>&1 | \"#{ocunit2junit}\"")
|
1078
|
-
|
1079
|
-
abort('Run test error!') unless run_tests_success
|
643
|
+
code_coverage_config = File.join(@config_settings[CONFIGURATION_FILES_PATH_KEY], @config_settings[CODE_COVERAGE_CONFIGURATION_KEY])
|
644
|
+
|
645
|
+
Xcodebuild.test(@config_settings[SDK_FOR_TESTS_KEY], 'Debug', @config_settings[WORKSPACE_TO_BUILD_KEY],
|
646
|
+
@config_settings[WORKSPACE_SCHEME_TO_TEST_KEY], code_coverage_config)
|
647
|
+
|
648
|
+
error('Run test error!') unless Xcodebuild.last_cmd_success?
|
1080
649
|
end
|
1081
650
|
|
1082
651
|
def code_coverage
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
abort('Code coverage error!') unless report_success
|
652
|
+
code_coverage_configuration = File.join(@config_settings[CONFIGURATION_FILES_PATH_KEY], @config_settings[CODE_COVERAGE_CONFIGURATION_KEY])
|
653
|
+
|
654
|
+
# TODO: move to Xcodebuild class
|
655
|
+
report_success = system("#{CODE_COVERAGE_REPORT_SCRIPT_PATH} -workspace \"#{@config_settings[WORKSPACE_TO_BUILD_KEY]}\"\
|
656
|
+
-scheme \"#{@config_settings[WORKSPACE_SCHEME_TO_TEST_KEY]}\"\
|
657
|
+
-configuration \"Debug\"\
|
658
|
+
-sdk \"#{@config_settings[SDK_FOR_TESTS_KEY]}\"\
|
659
|
+
-xcconfig \"#{code_coverage_configuration}\"\
|
660
|
+
-exclude \"#{@config_settings[EXCLUDE_PATTERN_FOR_CODE_COVERAGE_KEY]}\"\
|
661
|
+
-output \"#{@config_settings[CODE_COVERAGE_OUTPUT_DIRECTORY_KEY]}\"\
|
662
|
+
-destination-timeout \"#{TESTS_AND_COVERAGE_TIMEOUT}\"\
|
663
|
+
-destination \"#{@config_settings[XCTEST_DESTINATION_DEVICE_KEY]}\"")
|
664
|
+
error('Code coverage error!') unless report_success
|
1097
665
|
end
|
1098
666
|
|
1099
667
|
def code_duplication_report
|
1100
|
-
|
1101
|
-
|
1102
|
-
abort('Generate code duplication error!') unless duplication_success
|
668
|
+
duplication_success = system("#{CODE_DUPLICATION_REPORT_SCRIPT_PATH} \"#{@config_settings[EXCLUDE_PATTERN_FOR_CODE_DUPLICATION_KEY]}\" duplication.xml")
|
669
|
+
error('Generate code duplication error!') unless duplication_success
|
1103
670
|
end
|
1104
671
|
|
1105
672
|
def tag
|
1106
|
-
|
1107
|
-
|
1108
|
-
abort('Make tag error!') unless tag_success
|
673
|
+
tag_success = system("#{MAKE_TAG_SCRIPT_PATH} \"#{ENV[SCM_USERNAME_KEY]}\" \"#{ENV[SCM_PASSWORD_KEY]}\"")
|
674
|
+
error('Make tag error!') unless tag_success
|
1109
675
|
end
|
1110
676
|
|
1111
677
|
# Jenkins stores SVN credentials locally in XML, so this command gets and uses them on making tag by finding the first credential in local credential storage
|
1112
678
|
# ATTENTION: if this command picks up wrong credentials, then you should manually edit subversion.credentials file on Jenkins in order to remove the wrong credential
|
1113
679
|
# Additional |echo| is needed in order to add newline, otherwise base64 encoding doesn't work
|
1114
680
|
def svn_tag_from_jenkins
|
1115
|
-
ENV[
|
1116
|
-
ENV[
|
681
|
+
ENV[SCM_USERNAME_KEY]=%x[ $(shell xpath ../subversion.credentials \(//userName\)[1]/text\(\)) ]
|
682
|
+
ENV[SCM_PASSWORD_KEY]=%x[ $(shell echo $$(xpath ../subversion.credentials \(//password\)[1]/text\(\) 2>/dev/null && echo) | openssl base64 -d) ]
|
1117
683
|
|
1118
684
|
tag
|
1119
685
|
end
|
1120
686
|
|
1121
687
|
def clean_working_copy(all)
|
1122
|
-
clean_all
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
688
|
+
clean_all = all ? 'all' : nil
|
689
|
+
clean_success = system("#{CLEAN_WORKING_COPY_SCRIPT_PATH} #{clean_all}")
|
690
|
+
error('Clean working copy error!') unless clean_success
|
691
|
+
end
|
692
|
+
|
693
|
+
def error(msg, e = nil)
|
694
|
+
if e.present?
|
695
|
+
puts e.inspect
|
696
|
+
puts e.backtrace
|
697
|
+
end
|
698
|
+
|
699
|
+
abort "#{msg} #{e.to_s.strip}".red.on_yellow.bold
|
700
|
+
end
|
701
|
+
|
702
|
+
def success(msg)
|
703
|
+
puts msg.green.on_blue.bold
|
1126
704
|
end
|