bin/nixenvironment in nixenvironment-0.0.47 vs bin/nixenvironment in nixenvironment-0.0.48
- old
+ new
@@ -63,20 +63,26 @@
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_path PATH', String, 'Select unity executable path (UNITY, UNITY_4 or custom path)'
+ c.option '--development-build', 'Enable Developmen flag in Unity project'
+ c.option '--keystore-path PATH', String, 'Specify the path to .keystore file'
+ c.option '--keystore-password PASSWORD', String, 'Specify the password for accessing a .keystore file'
+ 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'
+ c.option '--key-alias-password PASSWORD', String, 'Specify the password for accessing an alias name'
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', :unity_path => 'UNITY'
need_to_build_ios = true
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)
+ unity_path = ENV[options.unity_path].nil? ? options.unity_path : ENV[options.unity_path]
+ need_to_build_ios, root_working_dir, need_chdir_to_root_working_dir = unity_build(options.unity_platform, unity_path, options.development_build, options.keystore_path, options.keystore_password, options.key_alias_name, options.key_alias_password)
end
if need_to_build_ios
begin
read_config_settings
@@ -509,11 +515,11 @@
abort("#{make} error!")
end
end
end
-def unity_build(unity_platform, unity_path)
+def unity_build(unity_platform, unity_path, development_build, keystore_path, keystore_password, key_alias_name, key_alias_password)
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')
@@ -528,20 +534,19 @@
FileUtils.cp_r(unity_build_scripts_dir, unity_editor_dir)
else
abort("Copy UnityBuildAutomationScripts error! #{unity_editor_dir} doesn't exist!")
end
- 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)
+ development_build_arg = development_build ? ';developmentBuild=' : ''
p('Generating IOS project from UNITY project ...')
- unity_success = system("#{unity} -projectPath '#{root_working_dir}' -executeMethod NIXBuilder.MakeiOSBuild -projectPath #{root_working_dir.shellescape} -batchmode -logFile -quit -customArgs:path='#{ios_project_path}'")
+ unity_success = system("#{unity_path} -projectPath '#{root_working_dir}' -executeMethod NIXBuilder.MakeiOSBuild -projectPath #{root_working_dir.shellescape} -batchmode -logFile -quit -customArgs:buildPath='#{ios_project_path}#{development_build_arg}'")
abort('iOS build unity error!') unless unity_success
p('IOS project was generated.')
need_chdir_to_root_working_dir = true
clean_working_copy(false)
@@ -550,10 +555,16 @@
$project_to_build = 'Unity-iPhone.xcodeproj'
$project_target_to_build = 'Unity-iPhone'
when 'android'
unity_build_android = File.join(BUILD_SCRIPTS_PATH, 'UnityBuildAndroid.py')
- build_success = system("#{unity_build_android} --unity-path #{unity}")
+ development_build_arg = development_build ? '--development-build' : ''
+ keystore_path_arg = keystore_path ? "--keystore-path #{keystore_path}" : ''
+ keystore_password_arg = keystore_password ? "--keystore-password #{keystore_password}" : ''
+ key_alias_name_arg = key_alias_name ? "--key-alias-name #{key_alias_name}" : ''
+ key_alias_password_arg = key_alias_password ? "--key-alias-password #{key_alias_password}" : ''
+
+ build_success = system("#{unity_build_android} --unity-path #{unity_path} #{development_build_arg} #{keystore_path_arg} #{keystore_password_arg} #{key_alias_name_arg} #{key_alias_password_arg}")
abort('Android build unity error!') unless build_success
clean_working_copy(false)
else
abort("Error: Unknown unity target platform '#{unity_platform}'!")