bin/nixenvironment in nixenvironment-0.0.39 vs bin/nixenvironment in nixenvironment-0.0.40
- old
+ new
@@ -61,20 +61,21 @@
c.syntax = 'nixenvironment build [options]'
c.description = 'Build project for selected configuration and make signed/resigned ipa'
c.option '--config NAME', String, 'Select configuration'
c.option '--ipa TYPES', String, 'Select sign (device, resigned_device, resigned_adhoc, resigned_appstore)'
c.option '--ci_build', 'Define NIXENV_CI_BUILD environment variable'
- c.option '--unity TARGET PLATFORM', String, 'Select target platform for unity build (ios or android)'
+ c.option '--unity_path PATH', String, 'Select unity executable path (UNITY, UNITY_4 or custom path)'
+ c.option '--unity_platform TARGET PLATFORM', String, 'Select target platform for unity build (ios or android)'
c.option '--ndsym', 'Disable .dsym generation for ios project'
c.option '--icon_tagger MODE', String, 'Set XcodeIconTagger mode (full, short, off)'
c.action do |args, options|
- options.default :config => 'Debug', :ipa => 'device', :icon_tagger => 'full'
+ options.default :config => 'Debug', :ipa => 'device', :icon_tagger => 'full', :unity_path => 'UNITY'
need_to_build_ios = true
- if options.unity and options.unity.length > 0
- need_to_build_ios, root_working_dir, need_chdir_to_root_working_dir = unity_build(options.unity)
+ if options.unity_platform and options.unity_platform.length > 0
+ need_to_build_ios, root_working_dir, need_chdir_to_root_working_dir = unity_build(options.unity_platform, options.unity_path)
end
if need_to_build_ios
begin
read_config_settings
@@ -95,16 +96,16 @@
end
command :deploy do |c|
c.syntax = 'nixenvironment deploy'
c.description = 'Deploy built artifacts to given server'
- c.option '--unity TARGET PLATFORM', String, 'Select target platform for unity deploy (ios or android)'
+ c.option '--unity_platform TARGET PLATFORM', String, 'Select target platform for unity deploy (ios or android)'
c.action do |args, options|
need_to_deploy_ios = true
- if options.unity and options.unity.length > 0
- need_to_deploy_ios, root_working_dir, need_chdir_to_root_working_dir = unity_deploy(options.unity)
+ if options.unity_platform and options.unity_platform.length > 0
+ need_to_deploy_ios, root_working_dir, need_chdir_to_root_working_dir = unity_deploy(options.unity_platform)
end
if need_to_deploy_ios
begin
read_config_settings
@@ -504,11 +505,11 @@
abort("#{make} error!")
end
end
end
-def unity_build(unity)
+def unity_build(unity_platform, unity_path)
root_working_dir = nil
need_chdir_to_root_working_dir = false
need_to_build_ios = false
save_revision = File.join(BUILD_SCRIPTS_PATH, 'SaveRevision.sh')
@@ -523,18 +524,20 @@
FileUtils.cp_r(unity_build_scripts_dir, unity_editor_dir)
else
abort("Copy UnityBuildAutomationScripts error! #{unity_editor_dir} doesn't exist!")
end
- case unity
+ unity = ENV[unity_path].nil? ? unity_path : ENV[unity_path]
+
+ case unity_platform
when 'ios'
need_to_build_ios = true
root_working_dir = Dir.pwd
ios_project_path = File.join(root_working_dir, UNITY_BUILDS_IOS_PATH)
p('Generating IOS project from UNITY project ...')
- unity_success = system("unity -executeMethod NIXBuilder.MakeiOSBuild -projectPath #{root_working_dir.shellescape} -batchmode -logFile -quit -customArgs:path='#{ios_project_path}'")
+ unity_success = system("#{unity} -executeMethod NIXBuilder.MakeiOSBuild -projectPath #{root_working_dir.shellescape} -batchmode -logFile -quit -customArgs:path='#{ios_project_path}'")
abort('iOS build unity error!') unless unity_success
p('IOS project was generated.')
need_chdir_to_root_working_dir = true
clean_working_copy(false)
@@ -542,16 +545,17 @@
Dir.chdir(ios_project_path)
$project_to_build = 'Unity-iPhone.xcodeproj'
$project_target_to_build = 'Unity-iPhone'
when 'android'
- build_success = system(File.join(BUILD_SCRIPTS_PATH, 'UnityBuildAndroid.py'))
+ unity_build_android = File.join(BUILD_SCRIPTS_PATH, 'UnityBuildAndroid.py')
+ build_success = system("#{unity_build_android} --unity-path #{unity}")
abort('Android build unity error!') unless build_success
clean_working_copy(false)
else
- abort("Error: Unknown unity target platform '#{unity}'!")
+ abort("Error: Unknown unity target platform '#{unity_platform}'!")
end
return need_to_build_ios, root_working_dir, need_chdir_to_root_working_dir
end
@@ -622,16 +626,16 @@
deploy_success = system("#{deploy} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password}")
abort('Deploy error!') unless deploy_success
end
-def unity_deploy(unity)
+def unity_deploy(unity_platform)
root_working_dir = nil
need_chdir_to_root_working_dir = false
need_to_deploy_ios = false
- case unity
+ case unity_platform
when 'ios'
root_working_dir = Dir.pwd
need_chdir_to_root_working_dir = true
need_to_deploy_ios = true
@@ -639,10 +643,10 @@
Dir.chdir(ios_project_path)
when 'android'
deploy_success = system(File.join(BUILD_SCRIPTS_PATH, 'DeployAPK.py'))
abort('Android deploy unity error!') unless deploy_success
else
- abort("Error: Unknown unity target platform '#{unity}'!")
+ abort("Error: Unknown unity target platform '#{unity_platform}'!")
end
return need_to_deploy_ios, root_working_dir, need_chdir_to_root_working_dir
end