nixenvironment 0.0.71 → 0.0.73
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/bin/nixenvironment +42 -70
- data/lib/nixenvironment/archiver.rb +26 -18
- data/lib/nixenvironment/build_env_vars_loader.rb +65 -13
- data/lib/nixenvironment/deployer.rb +40 -14
- data/lib/nixenvironment/scm.rb +2 -8
- data/lib/nixenvironment/version.rb +1 -1
- data/lib/nixenvironment/xcodebuild.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94649fdebb03545fcac8ae40b7584aabda8526ee
|
4
|
+
data.tar.gz: a6be2884186d11d082d152668134e9926ba98786
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bca24fc940fab470d7071e601a6dd57d3bd20460259483eb6fe1b35f21e6dfd2b15f5fd1ca41c288171ae36c32eab566bb7ded3d4b21be1d285cbecdc100488
|
7
|
+
data.tar.gz: 70bd4c5d606642f6dc6f9425c2b01661ae506e09c6a1a6cd7f056c1953b349d80b43c55aa75140b59169cd60d0fe6a07db179f125cba6144952bb0b780c662ac
|
data/bin/nixenvironment
CHANGED
@@ -62,6 +62,7 @@ command :build do |c|
|
|
62
62
|
c.syntax = 'nixenvironment build [options]'
|
63
63
|
c.description = 'Build project for selected configuration and make signed/resigned ipa'
|
64
64
|
c.option '--config NAME', String, 'Select configuration'
|
65
|
+
c.option '--xcconfig PATH', String, 'Specify the path to .xcconfig file'
|
65
66
|
c.option '--ipa TYPES', String, 'Select sign (device, resigned_device, resigned_adhoc, resigned_appstore)'
|
66
67
|
c.option '--unity_path PATH', String, 'Select unity executable path (UNITY, UNITY_4 or custom path)'
|
67
68
|
c.option '--development_build', 'Enable Developmen flag in Unity project'
|
@@ -73,7 +74,9 @@ command :build do |c|
|
|
73
74
|
c.option '--ndsym', 'Disable .dsym generation for ios project'
|
74
75
|
c.option '--ci_build', 'Deprecated' # TODO: remove
|
75
76
|
c.option '--icon_tagger MODE', String, 'Set XcodeIconTagger mode (full, short, off)'
|
76
|
-
c.option '--app_version VERSION', String, 'Specify the version of the app (
|
77
|
+
c.option '--app_version VERSION', String, 'Specify the version of the app (not implemented for unity-android)' # TODO: implement for unity-android
|
78
|
+
c.option '--build_number BUILD_NUMBER', String, 'Specify the build number of the app (not implemented for unity-android)' # TODO: implement for unity-android
|
79
|
+
c.option '--requires_fullscreen', 'Set UIRequiresFullScreen to YES in Info.plist (ios)'
|
77
80
|
c.action do |_args, options|
|
78
81
|
options.default :config => 'Debug', :ipa => 'device', :icon_tagger => 'full', :unity_path => 'UNITY'
|
79
82
|
unity_platform = options.unity_platform
|
@@ -82,6 +85,8 @@ command :build do |c|
|
|
82
85
|
need_to_process_macos_build = false
|
83
86
|
need_to_process_winphone_build = false
|
84
87
|
|
88
|
+
$build_number = options.build_number
|
89
|
+
|
85
90
|
if is_unity_platform
|
86
91
|
unity_path = ENV[options.unity_path] || options.unity_path
|
87
92
|
unity_build(options.config, unity_platform, unity_path, options.development_build, options.keystore_path, options.keystore_password, options.key_alias_name, options.key_alias_password)
|
@@ -95,7 +100,7 @@ command :build do |c|
|
|
95
100
|
|
96
101
|
info_plist = Plist.from_file(plist_path)
|
97
102
|
info_plist['RevisionNumber'] = revision
|
98
|
-
info_plist['CFBundleVersion'] =
|
103
|
+
info_plist['CFBundleVersion'] = build_number
|
99
104
|
info_plist['CFBundleShortVersionString'] = options.app_version if options.app_version.present?
|
100
105
|
info_plist['CFBundleName'] = $resigned_bundle_name if $resigned_bundle_name.present?
|
101
106
|
info_plist['CFBundleDisplayName'] = $resigned_bundle_name if $resigned_bundle_name.present?
|
@@ -110,7 +115,7 @@ command :build do |c|
|
|
110
115
|
@config_settings[CONFIGURATION_KEY] = options.development_build ? 'Debug' : 'Release'
|
111
116
|
@config_settings[SDK_NAME_KEY] = 'macosx'
|
112
117
|
|
113
|
-
|
118
|
+
BuildEnvVarsLoader.save_last_build_vars(@config_settings)
|
114
119
|
|
115
120
|
Archiver.make_macos_zip
|
116
121
|
elsif need_to_process_winphone_build
|
@@ -118,7 +123,7 @@ command :build do |c|
|
|
118
123
|
|
119
124
|
File.open(manifest_path,'w') do |f|
|
120
125
|
manifest = Nokogiri::XML(File.open(f))
|
121
|
-
manifest.at('Package/Identity')['Version'] = "#{options.app_version}.#{
|
126
|
+
manifest.at('Package/Identity')['Version'] = "#{options.app_version}.#{build_number}"
|
122
127
|
end
|
123
128
|
elsif need_to_build_ios
|
124
129
|
Dir.chdir(UNITY_IOS_PROJECT_PATH) if is_unity_platform
|
@@ -146,8 +151,8 @@ command :build do |c|
|
|
146
151
|
@config_settings.merge!(Xcodebuild.config_settings) { |_key, v1, v2| v1 || v2 }
|
147
152
|
|
148
153
|
begin
|
149
|
-
prebuild(options.config)
|
150
|
-
build(options.config, options.ipa, options.ndsym, options.icon_tagger)
|
154
|
+
prebuild(options.config, options.app_version, options.requires_fullscreen)
|
155
|
+
build(options.config, options.xcconfig, options.ipa, options.ndsym, options.icon_tagger)
|
151
156
|
ensure
|
152
157
|
restore_info_plists
|
153
158
|
end
|
@@ -379,61 +384,27 @@ def revision
|
|
379
384
|
BuildEnvVarsLoader.load_last_revision['REVISION']
|
380
385
|
end
|
381
386
|
|
382
|
-
def
|
383
|
-
BuildEnvVarsLoader.load_last_revision['MONOTONIC_REVISION']
|
387
|
+
def build_number
|
388
|
+
$build_number.presence || BuildEnvVarsLoader.load_last_revision['MONOTONIC_REVISION']
|
384
389
|
end
|
385
390
|
|
386
|
-
def
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
app_product = File.join(@config_settings[BUILT_PRODUCTS_DIR_KEY], executable_name) + APP_EXT
|
393
|
-
watchkit_extension_relative_product = @config_settings[RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID_KEY].nil? ? nil : File.join(IOS_PLUGINS_FOLDER_NAME, watchkit_extension_executable)
|
394
|
-
watchkit_app_relative_product = @config_settings[RESIGNED_WATCHKIT_APP_BUNDLE_ID_KEY].nil? ? nil : File.join(watchkit_extension_relative_product, watchkit_app_executable)
|
395
|
-
widget_relative_product = @config_settings[RESIGNED_WIDGET_BUNDLE_ID_KEY].nil? ? nil : File.join(IOS_PLUGINS_FOLDER_NAME, widget_executable)
|
396
|
-
|
397
|
-
resigned_watchkit_extension_entitlements_path = @config_settings[RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH_KEY].nil? ? nil : @config_settings[RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH_KEY]
|
398
|
-
resigned_widget_entitlements_path = @config_settings[RESIGNED_WIDGET_ENTITLEMENTS_PATH_KEY].nil? ? nil : @config_settings[RESIGNED_WIDGET_ENTITLEMENTS_PATH_KEY]
|
399
|
-
|
400
|
-
system("
|
401
|
-
echo \"#!/bin/sh\
|
402
|
-
#{AUTOGENERATED_FILES_HEADER}
|
403
|
-
PROJECT='#{@config_settings[PROJECT_KEY]}'
|
404
|
-
BUILT_PRODUCTS_DIR='#{@config_settings[BUILT_PRODUCTS_DIR_KEY]}'
|
405
|
-
OBJECTS_NORMAL_DIR='#{@config_settings[OBJECT_FILE_DIR_NORMAL_KEY]}'
|
406
|
-
EXECUTABLE_NAME='#{@config_settings[EXECUTABLE_NAME_KEY]}'
|
407
|
-
APP_PRODUCT='#{app_product}'
|
408
|
-
WATCHKIT_APP_RELATIVE_PRODUCT='#{watchkit_app_relative_product}'
|
409
|
-
WATCHKIT_EXTENSION_RELATIVE_PRODUCT='#{watchkit_extension_relative_product}'
|
410
|
-
WIDGET_RELATIVE_PRODUCT='#{widget_relative_product}'
|
411
|
-
APP_DSYM='#{app_product + DSYM_EXT}'
|
412
|
-
APP_INFOPLIST_FILE='#{@config_settings[PRODUCT_SETTINGS_PATH_KEY]}'
|
413
|
-
EMBEDDED_PROFILE='#{app_product}/#{@config_settings[EMBEDDED_PROFILE_NAME_KEY]}'
|
414
|
-
TARGET_NAME='#{@config_settings[TARGET_NAME_KEY]}'
|
415
|
-
CONFIGURATION='#{@config_settings[CONFIGURATION_KEY]}'
|
416
|
-
SDK_NAME='#{@config_settings[SDK_NAME_KEY]}'
|
417
|
-
RESIGNED_BUNDLE_ID='#{@config_settings[RESIGNED_BUNDLE_ID_KEY]}'
|
418
|
-
RESIGNED_WATCHKIT_APP_BUNDLE_ID='#{@config_settings[RESIGNED_WATCHKIT_APP_BUNDLE_ID_KEY]}'
|
419
|
-
RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID='#{@config_settings[RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID_KEY]}'
|
420
|
-
RESIGNED_WIDGET_BUNDLE_ID='#{@config_settings[RESIGNED_WIDGET_BUNDLE_ID_KEY]}'
|
421
|
-
RESIGNED_BUNDLE_NAME='#{@config_settings[RESIGNED_BUNDLE_NAME_KEY]}'
|
422
|
-
RESIGNED_ENTITLEMENTS_PATH='#{@config_settings[RESIGNED_ENTITLEMENTS_PATH_KEY]}'
|
423
|
-
RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH='#{resigned_watchkit_extension_entitlements_path}'
|
424
|
-
RESIGNED_WIDGET_ENTITLEMENTS_PATH='#{resigned_widget_entitlements_path}'\" > #{AUTOGENERATED_LAST_BUILD_VARS}
|
425
|
-
")
|
426
|
-
end
|
391
|
+
def save_revision
|
392
|
+
revision, monotonic_revision, working_copy_is_clean = SCM.last_revision
|
393
|
+
build_num = $build_number.presence || monotonic_revision
|
394
|
+
|
395
|
+
BuildEnvVarsLoader.save_last_revision(revision, build_num, working_copy_is_clean)
|
427
396
|
|
428
|
-
def prebuild(config)
|
429
|
-
SCM.save_revision
|
430
397
|
error('Error! Working copy is not clean!') unless BuildEnvVarsLoader.working_copy_is_clean?
|
398
|
+
end
|
399
|
+
|
400
|
+
def prebuild(config, app_version, requires_fullscreen)
|
401
|
+
save_revision
|
431
402
|
backup_info_plists
|
432
|
-
|
433
|
-
update_info_plists(config)
|
403
|
+
BuildEnvVarsLoader.save_last_build_vars(@config_settings)
|
404
|
+
update_info_plists(config, app_version, requires_fullscreen)
|
434
405
|
end
|
435
406
|
|
436
|
-
def build(config, ipa, ndsym, icon_tagger)
|
407
|
+
def build(config, xcconfig, ipa, ndsym, icon_tagger)
|
437
408
|
project_to_build = @config_settings[PROJECT_TO_BUILD_KEY]
|
438
409
|
project_target_to_build = @config_settings[PROJECT_TARGET_TO_BUILD_KEY]
|
439
410
|
workspace_to_build = @config_settings[WORKSPACE_TO_BUILD_KEY]
|
@@ -449,7 +420,7 @@ def build(config, ipa, ndsym, icon_tagger)
|
|
449
420
|
other_args = { 'DEBUG_INFORMATION_FORMAT' => debug_information_format, 'DWARF_DSYM_FOLDER_PATH' => dwarf_dsym_folder_path,
|
450
421
|
'CONFIGURATION_BUILD_DIR' => configuration_build_dir, 'BUILT_PRODUCTS_DIR' => built_products_dir }
|
451
422
|
|
452
|
-
Xcodebuild.build(sdk, config, project_to_build, project_target_to_build, workspace_to_build, workspace_scheme_to_build, env_var_prefix, other_args)
|
423
|
+
Xcodebuild.build(sdk, config, xcconfig, project_to_build, project_target_to_build, workspace_to_build, workspace_scheme_to_build, env_var_prefix, other_args)
|
453
424
|
|
454
425
|
error('Build error!') unless Xcodebuild.last_cmd_success?
|
455
426
|
|
@@ -500,8 +471,7 @@ def build(config, ipa, ndsym, icon_tagger)
|
|
500
471
|
end
|
501
472
|
|
502
473
|
def unity_build(configuration, unity_platform, unity_path, development_build, keystore_path, keystore_password, key_alias_name, key_alias_password)
|
503
|
-
|
504
|
-
error('Error! Working copy is not clean!') unless BuildEnvVarsLoader.working_copy_is_clean?
|
474
|
+
save_revision
|
505
475
|
|
506
476
|
if File.directory?(UNITY_EDITOR_DIR)
|
507
477
|
FileUtils.cp_r(UNITY_BUILD_SCRIPTS_DIR, UNITY_EDITOR_DIR)
|
@@ -560,7 +530,7 @@ def tag_icon(short_version)
|
|
560
530
|
app_product = File.join(@config_settings[BUILT_PRODUCTS_DIR_KEY], @config_settings[EXECUTABLE_NAME_KEY]) + APP_EXT
|
561
531
|
|
562
532
|
system("#{TAGGER_UTILITY_PATH} --shortVersion='#{version}'\
|
563
|
-
--buildNumber='#{
|
533
|
+
--buildNumber='#{build_number}'\
|
564
534
|
--style='#{style}'\
|
565
535
|
--maskPath='#{mask_path}'\
|
566
536
|
--plist='#{plist_path}'\
|
@@ -588,27 +558,29 @@ def backup_info_plist(product_settings_path, description)
|
|
588
558
|
info_plist_backup_name
|
589
559
|
end
|
590
560
|
|
591
|
-
def update_info_plists(config)
|
592
|
-
|
593
|
-
bundle_id
|
561
|
+
def update_info_plists(config, app_version, requires_fullscreen)
|
562
|
+
build_num = build_number
|
563
|
+
bundle_id = @config_settings[BUNDLE_ID_KEY]
|
594
564
|
|
595
|
-
update_info_plist(@config_settings[PRODUCT_SETTINGS_PATH_KEY],
|
596
|
-
update_info_plist(@config_settings[WATCHKIT_APP_PRODUCT_SETTINGS_PATH_KEY],
|
597
|
-
update_info_plist(@config_settings[WATCHKIT_EXTENSION_PRODUCT_SETTINGS_PATH_KEY],
|
598
|
-
update_info_plist(@config_settings[WIDGET_PRODUCT_SETTINGS_PATH_KEY],
|
565
|
+
update_info_plist(@config_settings[PRODUCT_SETTINGS_PATH_KEY], app_version, requires_fullscreen, build_num, revision, bundle_id, config, nil)
|
566
|
+
update_info_plist(@config_settings[WATCHKIT_APP_PRODUCT_SETTINGS_PATH_KEY], app_version, nil, build_num, nil, nil, nil, WATCHKIT_APP_PREFIX)
|
567
|
+
update_info_plist(@config_settings[WATCHKIT_EXTENSION_PRODUCT_SETTINGS_PATH_KEY], app_version, nil, build_num, nil, nil, nil, WATCHKIT_EXTENSION_PREFIX)
|
568
|
+
update_info_plist(@config_settings[WIDGET_PRODUCT_SETTINGS_PATH_KEY], app_version, nil, build_num, nil, nil, nil, WIDGET_PREFIX)
|
599
569
|
end
|
600
570
|
|
601
|
-
def update_info_plist(product_settings_path,
|
571
|
+
def update_info_plist(product_settings_path, app_version, requires_fullscreen, build_num, revision, bundle_id, config, description)
|
602
572
|
return if product_settings_path.blank?
|
603
573
|
|
604
574
|
puts "Updating #{description}Info.plist ..."
|
605
575
|
|
606
576
|
begin
|
607
577
|
info_plist = Plist.from_file(product_settings_path)
|
608
|
-
info_plist['
|
609
|
-
info_plist['
|
610
|
-
info_plist['
|
611
|
-
info_plist['
|
578
|
+
info_plist['UIRequiresFullScreen'] = true if requires_fullscreen
|
579
|
+
info_plist['CFBundleShortVersionString'] = app_version if app_version
|
580
|
+
info_plist['CFBundleVersion'] = build_num if build_num
|
581
|
+
info_plist['RevisionNumber'] = revision if revision
|
582
|
+
info_plist['CFBundleIdentifier'] = bundle_id if bundle_id
|
583
|
+
info_plist['Configuration'] = config if config
|
612
584
|
info_plist.save(product_settings_path, Plist::FORMAT_XML)
|
613
585
|
rescue => e
|
614
586
|
error("Update #{description}Info.plist error!", e)
|
@@ -18,17 +18,18 @@ module Nixenvironment
|
|
18
18
|
AVAILABLE_PROFILE_TYPES = [PROFILE_TYPE_DEVELOPER, PROFILE_TYPE_ADHOC, PROFILE_TYPE_APPSTORE]
|
19
19
|
|
20
20
|
class ProfileInfo
|
21
|
-
attr_accessor :path, :name, :app_id, :device_count
|
21
|
+
attr_accessor :path, :name, :app_id, :device_count, :expiration_date
|
22
22
|
|
23
|
-
def initialize(path, name, app_id, device_count)
|
24
|
-
@path
|
25
|
-
@name
|
26
|
-
@app_id
|
27
|
-
@device_count
|
23
|
+
def initialize(path, name, app_id, device_count, expiration_date)
|
24
|
+
@path = path
|
25
|
+
@name = name
|
26
|
+
@app_id = app_id
|
27
|
+
@device_count = device_count
|
28
|
+
@expiration_date = expiration_date
|
28
29
|
end
|
29
30
|
|
30
31
|
def to_s
|
31
|
-
"<'
|
32
|
+
"<path='#{@path}', name='#{@name}', app_id='#{@app_id}', device_count=#{@device_count}, expiration_date=#{@expiration_date || 'None'}>"
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
@@ -470,7 +471,7 @@ NAME_FOR_DEPLOYMENT='#{configuration}'
|
|
470
471
|
end
|
471
472
|
|
472
473
|
def app_id_prefix_from_profile(profile_path)
|
473
|
-
_profile_name, app_id, _certs, _device_count = parse_profile(profile_path)
|
474
|
+
_profile_name, app_id, _certs, _device_count, _expiration_date = parse_profile(profile_path)
|
474
475
|
app_id.partition('.').first
|
475
476
|
end
|
476
477
|
|
@@ -587,9 +588,9 @@ NAME_FOR_DEPLOYMENT='#{configuration}'
|
|
587
588
|
print_underline "Profile '#{filename}', "
|
588
589
|
|
589
590
|
profile_path = File.join(profiles_path, filename)
|
590
|
-
profile_name, app_id, certs, device_count = parse_profile(profile_path)
|
591
|
+
profile_name, app_id, certs, device_count, expiration_date = parse_profile(profile_path)
|
591
592
|
|
592
|
-
puts "name = '#{profile_name}',
|
593
|
+
puts "name = '#{profile_name}', app_id = '#{app_id}', #{device_count} device(s)" + (expiration_date.present? ? ", expires at #{expiration_date}" : '')
|
593
594
|
|
594
595
|
unless bundle_id_corresponds_to_app_id(new_bundle_id, app_id)
|
595
596
|
puts_warning "\t--> Can't use this profile, because app id '#{app_id}' doesn't allow new bundle id '#{new_bundle_id}'"
|
@@ -597,10 +598,16 @@ NAME_FOR_DEPLOYMENT='#{configuration}'
|
|
597
598
|
end
|
598
599
|
|
599
600
|
puts_header "\t--> Profile's app id '#{app_id}' allows new bundle id '#{new_bundle_id}'"
|
601
|
+
|
602
|
+
if expiration_date.present? && expiration_date < Time.now
|
603
|
+
puts_warning "\t--> Can't use this profile, because it has expired at '#{expiration_date}'"
|
604
|
+
next
|
605
|
+
end
|
606
|
+
|
600
607
|
puts_bold "\t--> Scan certs ..."
|
601
608
|
|
602
609
|
get_matching_identities_from_certs(certs) do |identity_name|
|
603
|
-
profile_info = ProfileInfo.new(profile_path, profile_name, app_id, device_count)
|
610
|
+
profile_info = ProfileInfo.new(profile_path, profile_name, app_id, device_count, expiration_date)
|
604
611
|
match = [profile_info, identity_name]
|
605
612
|
|
606
613
|
puts_header "\t--> Match found: #{profile_info.to_s}, identity_name='#{identity_name}'"
|
@@ -617,13 +624,14 @@ NAME_FOR_DEPLOYMENT='#{configuration}'
|
|
617
624
|
def parse_profile(profile_path)
|
618
625
|
plist = get_plist_from_file(profile_path)
|
619
626
|
|
620
|
-
profile_name
|
621
|
-
app_id
|
622
|
-
certs
|
623
|
-
|
624
|
-
|
627
|
+
profile_name = plist['Name']
|
628
|
+
app_id = plist[ENTITLEMENTS_KEY][APPLICATION_IDENTIFIER_KEY]
|
629
|
+
certs = plist['DeveloperCertificates']
|
630
|
+
expiration_date = plist["ExpirationDate"]
|
631
|
+
devices = plist['ProvisionedDevices']
|
632
|
+
device_count = devices.present? ? devices.size : 0
|
625
633
|
|
626
|
-
return profile_name, app_id, certs, device_count
|
634
|
+
return profile_name, app_id, certs, device_count, expiration_date
|
627
635
|
end
|
628
636
|
|
629
637
|
def get_plist_from_file(path)
|
@@ -650,7 +658,7 @@ NAME_FOR_DEPLOYMENT='#{configuration}'
|
|
650
658
|
# key.subject.to_a => [["UID", ..., ...], ["CN", identity_name, ...], ...]
|
651
659
|
identity_name = key.subject.to_a[1][1]
|
652
660
|
|
653
|
-
print "\tIdentity '#{identity_name}'..."
|
661
|
+
print "\tIdentity '#{identity_name}'... "
|
654
662
|
|
655
663
|
unless identity_is_valid(identity_name)
|
656
664
|
puts_warning 'invalid'
|
@@ -1,33 +1,85 @@
|
|
1
1
|
module Nixenvironment
|
2
2
|
class BuildEnvVarsLoader
|
3
|
+
def self.save_last_build_vars(config_settings)
|
4
|
+
executable_name = config_settings[EXECUTABLE_NAME_KEY]
|
5
|
+
watchkit_app_executable = executable_name + WATCHKIT_APP_SUFFIX_WITH_EXT
|
6
|
+
watchkit_extension_executable = executable_name + WATCHKIT_EXTENSION_SUFFIX_WITH_EXT
|
7
|
+
widget_executable = executable_name + WIDGET_SUFFIX_WITH_EXT
|
8
|
+
|
9
|
+
app_product = File.join(config_settings[BUILT_PRODUCTS_DIR_KEY], executable_name) + APP_EXT
|
10
|
+
watchkit_extension_relative_product = config_settings[RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID_KEY].nil? ? nil : File.join(IOS_PLUGINS_FOLDER_NAME, watchkit_extension_executable)
|
11
|
+
watchkit_app_relative_product = config_settings[RESIGNED_WATCHKIT_APP_BUNDLE_ID_KEY].nil? ? nil : File.join(watchkit_extension_relative_product, watchkit_app_executable)
|
12
|
+
widget_relative_product = config_settings[RESIGNED_WIDGET_BUNDLE_ID_KEY].nil? ? nil : File.join(IOS_PLUGINS_FOLDER_NAME, widget_executable)
|
13
|
+
|
14
|
+
resigned_watchkit_extension_entitlements_path = config_settings[RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH_KEY].nil? ? nil : @config_settings[RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH_KEY]
|
15
|
+
resigned_widget_entitlements_path = config_settings[RESIGNED_WIDGET_ENTITLEMENTS_PATH_KEY].nil? ? nil : @config_settings[RESIGNED_WIDGET_ENTITLEMENTS_PATH_KEY]
|
16
|
+
|
17
|
+
embedded_profile = File.join(app_product, config_settings[EMBEDDED_PROFILE_NAME_KEY])
|
18
|
+
|
19
|
+
system("
|
20
|
+
echo \"#!/bin/sh\
|
21
|
+
#{AUTOGENERATED_FILES_HEADER}
|
22
|
+
PROJECT='#{config_settings[PROJECT_KEY]}'
|
23
|
+
BUILT_PRODUCTS_DIR='#{config_settings[BUILT_PRODUCTS_DIR_KEY]}'
|
24
|
+
OBJECTS_NORMAL_DIR='#{config_settings[OBJECT_FILE_DIR_NORMAL_KEY]}'
|
25
|
+
EXECUTABLE_NAME='#{config_settings[EXECUTABLE_NAME_KEY]}'
|
26
|
+
APP_PRODUCT='#{app_product}'
|
27
|
+
WATCHKIT_APP_RELATIVE_PRODUCT='#{watchkit_app_relative_product}'
|
28
|
+
WATCHKIT_EXTENSION_RELATIVE_PRODUCT='#{watchkit_extension_relative_product}'
|
29
|
+
WIDGET_RELATIVE_PRODUCT='#{widget_relative_product}'
|
30
|
+
APP_DSYM='#{app_product + DSYM_EXT}'
|
31
|
+
EMBEDDED_PROFILE='#{embedded_profile}'
|
32
|
+
TARGET_NAME='#{config_settings[TARGET_NAME_KEY]}'
|
33
|
+
CONFIGURATION='#{config_settings[CONFIGURATION_KEY]}'
|
34
|
+
SDK_NAME='#{config_settings[SDK_NAME_KEY]}'
|
35
|
+
RESIGNED_BUNDLE_ID='#{config_settings[RESIGNED_BUNDLE_ID_KEY]}'
|
36
|
+
RESIGNED_WATCHKIT_APP_BUNDLE_ID='#{config_settings[RESIGNED_WATCHKIT_APP_BUNDLE_ID_KEY]}'
|
37
|
+
RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID='#{config_settings[RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID_KEY]}'
|
38
|
+
RESIGNED_WIDGET_BUNDLE_ID='#{config_settings[RESIGNED_WIDGET_BUNDLE_ID_KEY]}'
|
39
|
+
RESIGNED_BUNDLE_NAME='#{config_settings[RESIGNED_BUNDLE_NAME_KEY]}'
|
40
|
+
RESIGNED_ENTITLEMENTS_PATH='#{config_settings[RESIGNED_ENTITLEMENTS_PATH_KEY]}'
|
41
|
+
RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH='#{resigned_watchkit_extension_entitlements_path}'
|
42
|
+
RESIGNED_WIDGET_ENTITLEMENTS_PATH='#{resigned_widget_entitlements_path}'\" > #{AUTOGENERATED_LAST_BUILD_VARS}
|
43
|
+
")
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.save_last_revision(revision, monotonic_revision, working_copy_is_clean)
|
47
|
+
system("
|
48
|
+
echo \"#!/bin/sh\
|
49
|
+
#{AUTOGENERATED_FILES_HEADER}
|
50
|
+
REVISION='#{revision}'
|
51
|
+
MONOTONIC_REVISION='#{monotonic_revision}'
|
52
|
+
WORKING_COPY_IS_CLEAN='#{working_copy_is_clean}'\" > #{AUTOGENERATED_LAST_REVISION}
|
53
|
+
")
|
54
|
+
end
|
55
|
+
|
3
56
|
def self.load
|
4
57
|
build_env_vars = load_last_revision.merge(load_last_build_vars)
|
5
|
-
|
6
|
-
built_products_dir = build_env_vars[BUILT_PRODUCTS_DIR_KEY]
|
7
|
-
app_product = build_env_vars[APP_PRODUCT_KEY]
|
8
|
-
ipa_product = build_env_vars[IPA_PRODUCT_KEY]
|
9
|
-
app_infoplist_file = build_env_vars['APP_INFOPLIST_FILE']
|
58
|
+
app_product_path = build_env_vars[APP_PRODUCT_KEY]
|
10
59
|
embedded_profile = build_env_vars['EMBEDDED_PROFILE']
|
11
60
|
monotonic_revision = build_env_vars['MONOTONIC_REVISION']
|
12
61
|
sdk = build_env_vars[SDK_NAME_KEY]
|
13
62
|
|
14
|
-
|
15
|
-
raise "error: app product directory '#{app_product}' or ipa file '#{ipa_product}' must exist!" unless File.exist?(app_product) && File.exist?(ipa_product)
|
16
|
-
raise "error: file '#{app_infoplist_file}' must exist (app info plist)!" unless File.exist?(app_infoplist_file)
|
63
|
+
info_plist_relative_path = nil
|
17
64
|
|
18
|
-
if sdk.include?('
|
19
|
-
embedded_profile_exist
|
20
|
-
embedded_profile_name
|
65
|
+
if sdk.include?('iphoneos')
|
66
|
+
embedded_profile_exist = embedded_profile.present? && File.exist?(embedded_profile)
|
67
|
+
embedded_profile_name = embedded_profile_exist ? %x[ /usr/libexec/PlistBuddy -c 'Print :Name' /dev/stdin <<< $(security cms -D -i '#{embedded_profile}') ].strip : 'SIMULATOR'
|
68
|
+
info_plist_relative_path = 'Info.plist'
|
69
|
+
elsif sdk.include?('macos')
|
70
|
+
info_plist_relative_path = 'Contents/Info.plist'
|
21
71
|
end
|
22
72
|
|
23
|
-
|
73
|
+
info_plist_path = File.join(app_product_path, info_plist_relative_path)
|
74
|
+
info_plist = Plist.from_file(info_plist_path)
|
75
|
+
current_app_version = info_plist['CFBundleShortVersionString']
|
24
76
|
|
25
77
|
build_env_vars[EMBEDDED_PROFILE_NAME_KEY] = embedded_profile_name
|
26
78
|
build_env_vars[CURRENT_APP_VERSION_KEY] = current_app_version
|
27
79
|
build_env_vars[CURRENT_BUILD_VERSION_KEY] = monotonic_revision
|
28
80
|
|
29
81
|
puts
|
30
|
-
puts "#{EMBEDDED_PROFILE_NAME_KEY} = #{embedded_profile_name}"
|
82
|
+
puts "#{EMBEDDED_PROFILE_NAME_KEY} = #{embedded_profile_name}" # TODO: find out why it's blank!!!
|
31
83
|
puts "#{CURRENT_APP_VERSION_KEY} = #{current_app_version}"
|
32
84
|
puts "#{CURRENT_BUILD_VERSION_KEY} = #{monotonic_revision}"
|
33
85
|
puts
|
@@ -88,11 +88,14 @@ module Nixenvironment
|
|
88
88
|
end
|
89
89
|
|
90
90
|
# zip dsym
|
91
|
-
dsym_path =
|
92
|
-
|
91
|
+
dsym_path = File.dirname(app_dsym)
|
92
|
+
zipped_dsym_name = executable_name + APP_EXT + DSYM_EXT
|
93
|
+
zipped_dsym_path = File.join(configuration_full_path, zipped_dsym_name + ZIP_EXT)
|
93
94
|
|
94
95
|
if File.exist?(app_dsym)
|
95
|
-
Dir.chdir(
|
96
|
+
Dir.chdir(dsym_path) do
|
97
|
+
puts
|
98
|
+
puts "--> Zip '#{app_dsym}' into '#{zipped_dsym_path}' ..."
|
96
99
|
system("/usr/bin/zip --symlinks --verbose --recurse-paths '#{zipped_dsym_path}' '#{File.basename(app_dsym)}'")
|
97
100
|
end
|
98
101
|
end
|
@@ -108,18 +111,41 @@ module Nixenvironment
|
|
108
111
|
def self.scp(deploy_host, deploy_dir, deploy_user, deploy_password, local_path_to_app)
|
109
112
|
puts
|
110
113
|
puts "Uploading build from '#{local_path_to_app}' ...".blue
|
111
|
-
puts
|
112
|
-
|
113
|
-
max_percentage = 100
|
114
|
-
progress_step = 5
|
115
|
-
max_progress = max_percentage / progress_step
|
116
114
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
115
|
+
raise 'Deploy error!' unless system("#{DEPLOY_SCRIPT_PATH} '#{deploy_host}' '#{deploy_dir}' '#{deploy_user}' '#{deploy_password}' '#{local_path_to_app}'")
|
116
|
+
|
117
|
+
# TODO: Will use code below after fix https://github.com/net-ssh/net-scp/issues/24
|
118
|
+
#
|
119
|
+
# max_percentage = 100
|
120
|
+
# progress_step = 5
|
121
|
+
# max_progress = max_percentage / progress_step
|
122
|
+
#
|
123
|
+
# prev_file_name = ''
|
124
|
+
# prev_print_threshold = -1
|
125
|
+
#
|
126
|
+
# Net::SCP.upload!(deploy_host, deploy_user, local_path_to_app, deploy_dir, :ssh => { :password => deploy_password }, :recursive => true, :preserve => true) do |_ch, name, sent, total|
|
127
|
+
# # percentage = (sent.to_f / total.to_f * max_percentage).round(1)
|
128
|
+
# # current_progress = (percentage / progress_step).floor
|
129
|
+
# # progress_bar = '|' + '#' * current_progress + '-' * (max_progress - current_progress) + '|'
|
130
|
+
# # print "#{percentage}% #{progress_bar}\r"
|
131
|
+
#
|
132
|
+
# if name != prev_file_name
|
133
|
+
# prev_file_name = name
|
134
|
+
# puts
|
135
|
+
# puts "#{File.basename(name)}:"
|
136
|
+
# end
|
137
|
+
#
|
138
|
+
# percentage = sent.to_f / total.to_f * max_percentage
|
139
|
+
# print_threshold = (percentage / max_progress).floor
|
140
|
+
#
|
141
|
+
# if print_threshold != prev_print_threshold
|
142
|
+
# prev_print_threshold = print_threshold
|
143
|
+
# print_percentage = print_threshold * max_progress
|
144
|
+
# current_progress = (print_percentage / progress_step).floor
|
145
|
+
# progress_bar = '|' + '#' * current_progress + '-' * (max_progress - current_progress) + '|'
|
146
|
+
# print "#{print_percentage}% #{progress_bar}\r"
|
147
|
+
# end
|
148
|
+
# end
|
123
149
|
|
124
150
|
puts
|
125
151
|
end
|
data/lib/nixenvironment/scm.rb
CHANGED
@@ -17,7 +17,7 @@ module Nixenvironment
|
|
17
17
|
return 'undefined'
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.
|
20
|
+
def self.last_revision
|
21
21
|
scm_type = current
|
22
22
|
case scm_type
|
23
23
|
when SCM_SVN
|
@@ -114,13 +114,7 @@ module Nixenvironment
|
|
114
114
|
working_copy_is_clean = 0
|
115
115
|
end
|
116
116
|
|
117
|
-
|
118
|
-
echo \"#!/bin/sh\
|
119
|
-
#{AUTOGENERATED_FILES_HEADER}
|
120
|
-
REVISION='#{current_revision.strip!}'
|
121
|
-
MONOTONIC_REVISION='#{current_monotonic_revision.strip!}'
|
122
|
-
WORKING_COPY_IS_CLEAN='#{working_copy_is_clean}'\" > #{AUTOGENERATED_LAST_REVISION}
|
123
|
-
")
|
117
|
+
return current_revision.strip!, current_monotonic_revision.strip!, working_copy_is_clean
|
124
118
|
end
|
125
119
|
|
126
120
|
# TODO: implement --all for svn
|
@@ -26,10 +26,11 @@ module Nixenvironment
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# other => other args to be passed to xcodebuild
|
29
|
-
def self.build(sdk = nil, config = nil, project = nil, target = nil, workspace = nil, scheme = nil, env_var_prefix = nil, other = {})
|
29
|
+
def self.build(sdk = nil, config = nil, xcconfig = nil, project = nil, target = nil, workspace = nil, scheme = nil, env_var_prefix = nil, other = {})
|
30
30
|
build_args = []
|
31
31
|
build_args << "-sdk '#{sdk}'" if sdk.present?
|
32
32
|
build_args << "-configuration '#{config}'" if config.present?
|
33
|
+
build_args << "-xcconfig '#{xcconfig}'" if xcconfig.present?
|
33
34
|
|
34
35
|
if project.present?
|
35
36
|
build_args << "-project '#{project}'"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nixenvironment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.73
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cocoapods
|
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
272
|
version: '0'
|
273
273
|
requirements: []
|
274
274
|
rubyforge_project:
|
275
|
-
rubygems_version: 2.
|
275
|
+
rubygems_version: 2.0.14
|
276
276
|
signing_key:
|
277
277
|
specification_version: 4
|
278
278
|
summary: NIX projects build and deploy utility
|