nixenvironment 0.0.67 → 0.0.68

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f834db42f3efa243c84e0a0218f7b992f1b47e7e
4
- data.tar.gz: d74ed425d6f9623980740aff6738b1c4ce42a5e8
3
+ metadata.gz: 8a8a720fb6217e2b04685a2f71b7f11856a0e7ee
4
+ data.tar.gz: d7e0c0eafae687a85f4816b76109c852d915d0a4
5
5
  SHA512:
6
- metadata.gz: 6ec4e5b1c6ae99fdc5a418417140ae62a184a5fcb28a3013d705023915316cbe92140f71ed851b7510335e3d197ec2f0bb64dff2b72e16ea89bbeaafb2794ea3
7
- data.tar.gz: 5a65f8bd9613ea7c4cdae1822e994e104fe0177c32cd083d2f4e626efdfe7d268e5c92fc137de7a504c968fc8f0dd308ab18f8ab4567aadb28a7c0a1ece60d47
6
+ metadata.gz: 49c1ecf47b7b61763eee3de8a83a9202bc78704dba1c7ff5f5dac54c9756c0176abcfb64536dea5bde6d5e34d3a012b47041abf855feeccade4aec69759c8667
7
+ data.tar.gz: 37f92ab70e4895ef634b1d258ba0bc4226e33e5853cbcdec29945497e2a67451ce211746ead1ed1fa424153284387ffb79ad7be58cb3e3b39eb6bbe8490a7482
data/bin/nixenvironment CHANGED
@@ -9,6 +9,7 @@ require 'tmpdir'
9
9
  require 'active_support/core_ext/object/blank'
10
10
  require 'terminal-table'
11
11
  require 'colorize'
12
+ require 'nokogiri'
12
13
 
13
14
  include Nixenvironment
14
15
 
@@ -68,23 +69,48 @@ command :build do |c|
68
69
  c.option '--keystore_password PASSWORD', String, 'Specify the password for accessing a .keystore file'
69
70
  c.option '--key_alias_name NAME', String, 'Specify the alias name which should be used from .keystore file to sign a release version of an APK'
70
71
  c.option '--key_alias_password PASSWORD', String, 'Specify the password for accessing an alias name'
71
- c.option '--unity_platform TARGET PLATFORM', String, 'Select target platform for unity build (ios or android)'
72
+ c.option '--unity_platform TARGET PLATFORM', String, 'Select target platform for unity build (ios | macos | android | winphone)'
72
73
  c.option '--ndsym', 'Disable .dsym generation for ios project'
73
74
  c.option '--ci_build', 'Deprecated' # TODO: remove
74
75
  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 (for mac and unity-winphone builds only)'
75
77
  c.action do |_args, options|
76
78
  options.default :config => 'Debug', :ipa => 'device', :icon_tagger => 'full', :unity_path => 'UNITY'
77
79
 
78
- need_to_build_ios = true
80
+ need_to_build_ios = true
81
+ need_to_process_macos_build = false
82
+ need_to_process_winphone_build = false
79
83
  is_unity_platform = options.unity_platform.present?
80
84
 
81
85
  if is_unity_platform
82
86
  unity_path = ENV[options.unity_path] || options.unity_path
83
- need_to_build_ios = unity_build(options.config, options.unity_platform, unity_path, options.development_build,
84
- options.keystore_path, options.keystore_password, options.key_alias_name, options.key_alias_password)
87
+ unity_build(options.config, options.unity_platform, unity_path, options.development_build, options.keystore_path, options.keystore_password, options.key_alias_name, options.key_alias_password)
88
+ need_to_build_ios = options.unity_platform == 'ios'
89
+ need_to_process_macos_build = options.unity_platform == 'macos'
90
+ need_to_process_winphone_build = options.unity_platform == 'winphone'
85
91
  end
86
92
 
87
- if need_to_build_ios
93
+ if need_to_process_macos_build
94
+ build_path = File.join(UNITY_IOS_PROJECT_PATH, 'build.app')
95
+ plist_path = File.join(build_path, 'Contents/Info.plist')
96
+
97
+ info_plist = Plist.from_file(plist_path)
98
+ info_plist['CFBundleVersion'] = monotonic_revision
99
+ info_plist['CFBundleShortVersionString'] = options.app_version if options.app_version.present?
100
+ info_plist['CFBundleName'] = $resigned_bundle_name if $resigned_bundle_name.present?
101
+ info_plist['CFBundleDisplayName'] = $resigned_bundle_name if $resigned_bundle_name.present?
102
+ info_plist.save(plist_path, Plist::FORMAT_XML)
103
+ elsif need_to_process_winphone_build
104
+ build_path = File.join(Dir.pwd, 'Builds/WinPhone')
105
+ manifest_path = Dir.glob("#{build_path}/**/*.appxmanifest").first
106
+
107
+ File.open(manifest_path,'w') do |f|
108
+ manifest = Nokogiri::XML(File.open(f))
109
+ manifest.at('Package/Identity')['Version'] = "#{options.app_version}.#{monotonic_revision}"
110
+ end
111
+
112
+ # TODO: update app_version
113
+ elsif need_to_build_ios
88
114
  Dir.chdir(UNITY_IOS_PROJECT_PATH) if is_unity_platform
89
115
  read_config_settings
90
116
  @config_settings[CONFIGURATION_KEY] = options.config
@@ -330,6 +356,10 @@ def update_config_settings(key, value, table, need_separator)
330
356
  table.add_separator if need_separator
331
357
  end
332
358
 
359
+ def monotonic_revision
360
+ %x[ source _last_revision.sh && echo ${MONOTONIC_REVISION} ].strip!
361
+ end
362
+
333
363
  def working_copy_is_clean?
334
364
  system("
335
365
  source \"_last_revision.sh\"
@@ -457,8 +487,6 @@ def build(config, ipa, ndsym, icon_tagger)
457
487
  end
458
488
 
459
489
  def unity_build(configuration, unity_platform, unity_path, development_build, keystore_path, keystore_password, key_alias_name, key_alias_password)
460
- need_to_build_ios = false
461
-
462
490
  system("#{SAVE_REVISION_SCRIPT_PATH}")
463
491
  error('Error! Working copy is not clean!') unless working_copy_is_clean?
464
492
 
@@ -470,16 +498,20 @@ def unity_build(configuration, unity_platform, unity_path, development_build, ke
470
498
 
471
499
  case unity_platform
472
500
  when 'ios'
473
- need_to_build_ios = true
501
+ build_path_arg = "buildPath=#{UNITY_IOS_PROJECT_PATH}"
474
502
  development_build_arg = development_build ? ';developmentBuild=' : ''
475
503
 
476
504
  puts 'Generating IOS project from UNITY project ...'
477
- unity_success = system("#{unity_path} -executeMethod NIXBuilder.MakeiOSBuild -projectPath '#{Dir.pwd}'\
478
- -batchmode -logFile -quit -customArgs:buildPath='#{UNITY_IOS_PROJECT_PATH}#{development_build_arg}'")
505
+ unity_success = system("#{unity_path} -projectPath '#{Dir.pwd}' -batchmode -logFile -quit -executeMethod NIXBuilder.MakeiOSBuild -customArgs:'#{build_path_arg}#{development_build_arg}'")
479
506
  error('iOS build unity error!') unless unity_success
480
507
  success('IOS project was generated.')
508
+ when 'macos'
509
+ build_path = File.join(UNITY_IOS_PROJECT_PATH, 'build.app')
510
+ build_path_arg = "buildPath=#{build_path}"
511
+ development_build_arg = development_build ? ';developmentBuild=' : ''
481
512
 
482
- clean_working_copy(false)
513
+ unity_success = system("#{unity_path} -projectPath '#{Dir.pwd}' -batchmode -logFile -quit -executeMethod NIXBuilder.MakeMacOSBuild -customArgs:'#{build_path_arg}#{development_build_arg}'")
514
+ error('iOS build unity error!') unless unity_success
483
515
  when 'android'
484
516
  development_build_arg = development_build ? '--development-build' : ''
485
517
  keystore_path_arg = keystore_path ? "--keystore-path #{keystore_path}" : ''
@@ -490,22 +522,27 @@ def unity_build(configuration, unity_platform, unity_path, development_build, ke
490
522
  build_success = system("#{UNITY_BUILD_ANDROID_SCRIPT_PATH} --configuration #{configuration} --unity-path #{unity_path}\
491
523
  #{development_build_arg} #{keystore_path_arg} #{keystore_password_arg} #{key_alias_name_arg} #{key_alias_password_arg}")
492
524
  error('Android build unity error!') unless build_success
493
-
494
- clean_working_copy(false)
525
+ when 'winphone'
526
+ build_path = File.join(Dir.pwd, 'Builds/WinPhone')
527
+ build_path_arg = "buildPath=#{build_path}"
528
+ development_build_arg = development_build ? ';developmentBuild=' : ''
529
+
530
+ puts 'Generating WinPhone project from UNITY project ...'
531
+ build_success = system("#{unity_path} -projectPath '#{Dir.pwd}' -batchmode -logFile -quit -executeMethod NIXBuilder.MakeWinPhoneBuild -customArgs:'#{build_path_arg}#{development_build_arg}'")
532
+ error('WinPhone build unity error!') unless build_success
495
533
  else
496
534
  error("Error: Unknown unity target platform '#{unity_platform}'!")
497
535
  end
498
536
 
499
- success('Unity build complete!')
537
+ clean_working_copy(false)
500
538
 
501
- need_to_build_ios
539
+ success('Unity build complete!')
502
540
  end
503
541
 
504
542
  def tag_icon(short_version)
505
543
  plist_path = @config_settings[PRODUCT_SETTINGS_PATH_KEY]
506
544
  info_plist = Plist.from_file(plist_path)
507
545
  version = info_plist['CFBundleShortVersionString']
508
- monotonic_revision = %x[ source _last_revision.sh && echo ${MONOTONIC_REVISION} ].strip!
509
546
  style = short_version ? 'OneLine' : 'TwoLine'
510
547
  mask_path = File.join(TAGGER_UTILITY_DIRECTORY, "masks/#{style}Mask.png")
511
548
  icons_dir = File.join(Dir.pwd, @config_settings[ICONS_PATH_KEY])
@@ -539,14 +576,14 @@ def backup_info_plist(product_settings_path, description)
539
576
  end
540
577
 
541
578
  def update_info_plists(config)
542
- revision = %x[ source _last_revision.sh && echo ${REVISION} ].strip!
543
- monotonic_revision = %x[ source _last_revision.sh && echo ${MONOTONIC_REVISION} ].strip!
544
- bundle_id = @config_settings[BUNDLE_ID_KEY]
545
-
546
- update_info_plist(@config_settings[PRODUCT_SETTINGS_PATH_KEY], monotonic_revision, revision, bundle_id, config, nil)
547
- update_info_plist(@config_settings[WATCHKIT_APP_PRODUCT_SETTINGS_PATH_KEY], monotonic_revision, nil, nil, nil, WATCHKIT_APP_PREFIX)
548
- update_info_plist(@config_settings[WATCHKIT_EXTENSION_PRODUCT_SETTINGS_PATH_KEY], monotonic_revision, nil, nil, nil, WATCHKIT_EXTENSION_PREFIX)
549
- update_info_plist(@config_settings[WIDGET_PRODUCT_SETTINGS_PATH_KEY], monotonic_revision, nil, nil, nil, WIDGET_PREFIX)
579
+ revision = %x[ source _last_revision.sh && echo ${REVISION} ].strip!
580
+ monoc_revision = monotonic_revision
581
+ bundle_id = @config_settings[BUNDLE_ID_KEY]
582
+
583
+ update_info_plist(@config_settings[PRODUCT_SETTINGS_PATH_KEY], monoc_revision, revision, bundle_id, config, nil)
584
+ update_info_plist(@config_settings[WATCHKIT_APP_PRODUCT_SETTINGS_PATH_KEY], monoc_revision, nil, nil, nil, WATCHKIT_APP_PREFIX)
585
+ update_info_plist(@config_settings[WATCHKIT_EXTENSION_PRODUCT_SETTINGS_PATH_KEY], monoc_revision, nil, nil, nil, WATCHKIT_EXTENSION_PREFIX)
586
+ update_info_plist(@config_settings[WIDGET_PRODUCT_SETTINGS_PATH_KEY], monoc_revision, nil, nil, nil, WIDGET_PREFIX)
550
587
  end
551
588
 
552
589
  def update_info_plist(product_settings_path, monotonic_revision, revision, bundle_id, config, description)
@@ -78,10 +78,36 @@ public static class NIXBuilder
78
78
  PlayerSettings.Android.keyaliasName = null;
79
79
  PlayerSettings.Android.keyaliasPass = null;
80
80
  }
81
+
82
+ BuildTarget buildTarget = BuildTarget.Android;
81
83
 
82
- EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.Android);
83
- BuildPipeline.BuildPlayer(GetScenePaths(), buildPath, BuildTarget.Android, GetBuildOptions());
84
+ EditorUserBuildSettings.SwitchActiveBuildTarget(buildTarget);
85
+ BuildPipeline.BuildPlayer(GetScenePaths(), buildPath, buildTarget, GetBuildOptions());
84
86
  }
87
+
88
+ public static void MakeWinPhoneBuild()
89
+ {
90
+ string projectPath = CommandLineReader.GetCustomArgument(BuildPathArgument);
91
+ CreateFolder(projectPath);
92
+
93
+ BuildTarget buildTarget = BuildTarget.WSAPlayer;
94
+
95
+ EditorUserBuildSettings.wsaSDK = WSASDK.PhoneSDK81;
96
+ EditorUserBuildSettings.SwitchActiveBuildTarget(buildTarget);
97
+
98
+ BuildPipeline.BuildPlayer(GetScenePaths(), projectPath, buildTarget, GetBuildOptions());
99
+ }
100
+
101
+ public static void MakeMacOSBuild()
102
+ {
103
+ string buildPath = CommandLineReader.GetCustomArgument(BuildPathArgument);
104
+ CreateFolder(Path.GetDirectoryName(buildPath));
105
+
106
+ BuildTarget buildTarget = BuildTarget.StandaloneOSXUniversal;
107
+
108
+ EditorUserBuildSettings.SwitchActiveBuildTarget(buildTarget);
109
+ BuildPipeline.BuildPlayer(GetScenePaths(), buildPath, buildTarget, GetBuildOptions());
110
+ }
85
111
 
86
112
  public static void CreateFolder(string thePath)
87
113
  {
@@ -1,3 +1,3 @@
1
1
  module Nixenvironment
2
- VERSION = '0.0.67'
2
+ VERSION = '0.0.68'
3
3
  end
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.67
4
+ version: 0.0.68
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-11-03 00:00:00.000000000 Z
12
+ date: 2015-11-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cocoapods