nixenvironment 0.0.70 → 0.0.71
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/README.md +1 -1
- data/bin/nixenvironment +39 -102
- data/lib/nixenvironment.rb +2 -0
- data/lib/nixenvironment/archiver.rb +43 -50
- data/lib/nixenvironment/build_env_vars_loader.rb +69 -6
- data/lib/nixenvironment/config.rb +9 -5
- data/lib/nixenvironment/deployer.rb +129 -0
- data/lib/nixenvironment/scm.rb +179 -0
- data/lib/nixenvironment/version.rb +1 -1
- data/lib/nixenvironment/xcodebuild.rb +6 -0
- data/nixenvironment.gemspec +2 -1
- metadata +20 -13
- data/legacy/CleanWorkingCopy.sh +0 -69
- data/legacy/DeployIPA.sh +0 -125
- data/legacy/DetectSCM.sh +0 -11
- data/legacy/LoadBuildEnvVars.sh +0 -123
- data/legacy/MakeTag.sh +0 -94
- data/legacy/SaveRevision.sh +0 -122
- data/legacy/VerifyBinarySigning.py +0 -80
- data/legacy/svn-clean.pl +0 -246
- data/legacy/svncopy.pl +0 -1134
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0ae2568f0e26258c2c5e3f378a4aee05e0b81fd2
         | 
| 4 | 
            +
              data.tar.gz: 5d6ad9e68cd00116e9b6d2d7d43bd37dc6aa1ce2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: f6f8c13907d4f803eb394d014e5806f77a703df837fade6863486ae6c485e373ebf834517ba79b92c5e620d0dd31ac41d6149fc42f044a1b28dfe7a492c8b770
         | 
| 7 | 
            +
              data.tar.gz: b52b91be9c13277b93325dc528308b7256d218f6c32ab3cc9c1bb80fbfdad0f3b72ac24480f3974b0fbacdfe30a3358d50c701fcd8af788b6e16f2d63a67bbc3
         | 
    
        data/README.md
    CHANGED
    
    | @@ -37,7 +37,7 @@ Nixenvironment installs, updates and manages inner NIX environment stuff to make | |
| 37 37 | 
             
              Then run this in Execute shell:
         | 
| 38 38 |  | 
| 39 39 | 
             
                # See credentials for deploy on https://qwiki.nixsolutions.com/display/IPT/Credentials
         | 
| 40 | 
            -
                $ ./gemify.sh && bundle update && sudo gem install nixenvironment --verbose
         | 
| 40 | 
            +
                $ ./gemify.sh && bundle update && sudo gem install nixenvironment --verbose --no-document
         | 
| 41 41 |  | 
| 42 42 | 
             
              NOTE! CI must be configured with UTF-8 locale! Please see how to implement it for Jenkins:
         | 
| 43 43 |  | 
    
        data/bin/nixenvironment
    CHANGED
    
    | @@ -226,18 +226,6 @@ command :code_duplication_report do |c| | |
| 226 226 | 
             
              end
         | 
| 227 227 | 
             
            end
         | 
| 228 228 |  | 
| 229 | 
            -
            command :tag do |c|
         | 
| 230 | 
            -
              c.syntax = 'nixenvironment tag'
         | 
| 231 | 
            -
              c.description = 'Make SVN/git/mercurial tag, SCM_USERNAME and SCM_PASSWORD must be defined on calling this target'
         | 
| 232 | 
            -
              c.action { tag }
         | 
| 233 | 
            -
            end
         | 
| 234 | 
            -
             | 
| 235 | 
            -
            command :svn_tag_from_jenkins do |c|
         | 
| 236 | 
            -
              c.syntax = 'nixenvironment svn_tag_from_jenkins'
         | 
| 237 | 
            -
              c.description = 'Make tag by finding the first credential in local credential storage'
         | 
| 238 | 
            -
              c.action { svn_tag_from_jenkins }
         | 
| 239 | 
            -
            end
         | 
| 240 | 
            -
             | 
| 241 229 | 
             
            command :clean_working_copy do |c|
         | 
| 242 230 | 
             
              c.syntax = 'nixenvironment clean_working_copy'
         | 
| 243 231 | 
             
              c.description = 'Make working copy clean'
         | 
| @@ -378,9 +366,9 @@ end | |
| 378 366 | 
             
            def update_config_settings(key, value, table, need_separator)
         | 
| 379 367 | 
             
              if value
         | 
| 380 368 | 
             
                @config_settings[key] = value
         | 
| 381 | 
            -
                spec_column = " | 
| 369 | 
            +
                spec_column = "Specified directly"
         | 
| 382 370 | 
             
              else
         | 
| 383 | 
            -
                spec_column = " | 
| 371 | 
            +
                spec_column = "Used from Config"
         | 
| 384 372 | 
             
              end
         | 
| 385 373 |  | 
| 386 374 | 
             
              table.add_row [key, spec_column, @config_settings[key]]
         | 
| @@ -388,25 +376,11 @@ def update_config_settings(key, value, table, need_separator) | |
| 388 376 | 
             
            end
         | 
| 389 377 |  | 
| 390 378 | 
             
            def revision
         | 
| 391 | 
            -
               | 
| 379 | 
            +
              BuildEnvVarsLoader.load_last_revision['REVISION']
         | 
| 392 380 | 
             
            end
         | 
| 393 381 |  | 
| 394 382 | 
             
            def monotonic_revision
         | 
| 395 | 
            -
               | 
| 396 | 
            -
            end
         | 
| 397 | 
            -
             | 
| 398 | 
            -
            def working_copy_is_clean?
         | 
| 399 | 
            -
              system("
         | 
| 400 | 
            -
              source \"_last_revision.sh\"
         | 
| 401 | 
            -
             | 
| 402 | 
            -
              if [ ${WORKING_COPY_IS_CLEAN} -eq 1 ]; then
         | 
| 403 | 
            -
                echo \"Working copy is clean. Continuing ...\"
         | 
| 404 | 
            -
              else
         | 
| 405 | 
            -
                echo \"error: working copy must not have local modifications.\" 1>&2
         | 
| 406 | 
            -
                echo \"You must add following files and folders to .gitignore:\"
         | 
| 407 | 
            -
                echo \"#{Git.status(:porcelain => true)}\"
         | 
| 408 | 
            -
                exit 1
         | 
| 409 | 
            -
              fi")
         | 
| 383 | 
            +
              BuildEnvVarsLoader.load_last_revision['MONOTONIC_REVISION']
         | 
| 410 384 | 
             
            end
         | 
| 411 385 |  | 
| 412 386 | 
             
            def save_build_env_vars
         | 
| @@ -425,7 +399,7 @@ def save_build_env_vars | |
| 425 399 |  | 
| 426 400 | 
             
              system("
         | 
| 427 401 | 
             
            echo \"#!/bin/sh\
         | 
| 428 | 
            -
             | 
| 402 | 
            +
            #{AUTOGENERATED_FILES_HEADER}
         | 
| 429 403 | 
             
                        PROJECT='#{@config_settings[PROJECT_KEY]}'
         | 
| 430 404 | 
             
            BUILT_PRODUCTS_DIR='#{@config_settings[BUILT_PRODUCTS_DIR_KEY]}'
         | 
| 431 405 | 
             
            OBJECTS_NORMAL_DIR='#{@config_settings[OBJECT_FILE_DIR_NORMAL_KEY]}'
         | 
| @@ -447,13 +421,13 @@ RESIGNED_WIDGET_BUNDLE_ID='#{@config_settings[RESIGNED_WIDGET_BUNDLE_ID_KEY]}' | |
| 447 421 | 
             
            RESIGNED_BUNDLE_NAME='#{@config_settings[RESIGNED_BUNDLE_NAME_KEY]}'
         | 
| 448 422 | 
             
            RESIGNED_ENTITLEMENTS_PATH='#{@config_settings[RESIGNED_ENTITLEMENTS_PATH_KEY]}'
         | 
| 449 423 | 
             
            RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH='#{resigned_watchkit_extension_entitlements_path}'
         | 
| 450 | 
            -
            RESIGNED_WIDGET_ENTITLEMENTS_PATH='#{resigned_widget_entitlements_path}'\" >  | 
| 424 | 
            +
            RESIGNED_WIDGET_ENTITLEMENTS_PATH='#{resigned_widget_entitlements_path}'\" > #{AUTOGENERATED_LAST_BUILD_VARS}
         | 
| 451 425 | 
             
              ")
         | 
| 452 426 | 
             
            end
         | 
| 453 427 |  | 
| 454 428 | 
             
            def prebuild(config)
         | 
| 455 | 
            -
               | 
| 456 | 
            -
              error('Error! Working copy is not clean!') unless working_copy_is_clean?
         | 
| 429 | 
            +
              SCM.save_revision
         | 
| 430 | 
            +
              error('Error! Working copy is not clean!') unless BuildEnvVarsLoader.working_copy_is_clean?
         | 
| 457 431 | 
             
              backup_info_plists
         | 
| 458 432 | 
             
              save_build_env_vars
         | 
| 459 433 | 
             
              update_info_plists(config)
         | 
| @@ -488,6 +462,8 @@ def build(config, ipa, ndsym, icon_tagger) | |
| 488 462 |  | 
| 489 463 | 
             
                success("Make 'macos_zip' complete!")
         | 
| 490 464 | 
             
              elsif sdk.include?('iphoneos')
         | 
| 465 | 
            +
                puts
         | 
| 466 | 
            +
             | 
| 491 467 | 
             
                if config == 'Release'
         | 
| 492 468 | 
             
                  puts 'IconTagger: configuration is Release. Skipping ...'
         | 
| 493 469 | 
             
                else
         | 
| @@ -499,6 +475,8 @@ def build(config, ipa, ndsym, icon_tagger) | |
| 499 475 | 
             
                  end
         | 
| 500 476 | 
             
                end
         | 
| 501 477 |  | 
| 478 | 
            +
                puts
         | 
| 479 | 
            +
             | 
| 502 480 | 
             
                ipa.split.each do |current_ipa|
         | 
| 503 481 | 
             
                  begin
         | 
| 504 482 | 
             
                    case current_ipa
         | 
| @@ -522,8 +500,8 @@ def build(config, ipa, ndsym, icon_tagger) | |
| 522 500 | 
             
            end
         | 
| 523 501 |  | 
| 524 502 | 
             
            def unity_build(configuration, unity_platform, unity_path, development_build, keystore_path, keystore_password, key_alias_name, key_alias_password)
         | 
| 525 | 
            -
               | 
| 526 | 
            -
              error('Error! Working copy is not clean!') unless working_copy_is_clean?
         | 
| 503 | 
            +
              SCM.save_revision
         | 
| 504 | 
            +
              error('Error! Working copy is not clean!') unless BuildEnvVarsLoader.working_copy_is_clean?
         | 
| 527 505 |  | 
| 528 506 | 
             
              if File.directory?(UNITY_EDITOR_DIR)
         | 
| 529 507 | 
             
                FileUtils.cp_r(UNITY_BUILD_SCRIPTS_DIR, UNITY_EDITOR_DIR)
         | 
| @@ -539,7 +517,7 @@ def unity_build(configuration, unity_platform, unity_path, development_build, ke | |
| 539 517 | 
             
                puts 'Generating IOS project from UNITY project ...'
         | 
| 540 518 | 
             
                unity_success = system("#{unity_path} -projectPath '#{Dir.pwd}' -batchmode -logFile -quit -executeMethod NIXBuilder.MakeiOSBuild -customArgs:'#{build_path_arg}#{development_build_arg}'")
         | 
| 541 519 | 
             
                error('iOS build unity error!') unless unity_success
         | 
| 542 | 
            -
                success( | 
| 520 | 
            +
                success("IOS project was generated.\n")
         | 
| 543 521 | 
             
              when 'macos'
         | 
| 544 522 | 
             
                build_path_arg = "buildPath=#{UNITY_MACOS_BUILD_PATH}"
         | 
| 545 523 | 
             
                development_build_arg = development_build ? ';developmentBuild=' : ''
         | 
| @@ -569,7 +547,7 @@ def unity_build(configuration, unity_platform, unity_path, development_build, ke | |
| 569 547 |  | 
| 570 548 | 
             
              clean_working_copy(false)
         | 
| 571 549 |  | 
| 572 | 
            -
              success( | 
| 550 | 
            +
              success("Unity build complete!\n")
         | 
| 573 551 | 
             
            end
         | 
| 574 552 |  | 
| 575 553 | 
             
            def tag_icon(short_version)
         | 
| @@ -591,10 +569,12 @@ def tag_icon(short_version) | |
| 591 569 | 
             
            end
         | 
| 592 570 |  | 
| 593 571 | 
             
            def backup_info_plists
         | 
| 572 | 
            +
              puts
         | 
| 594 573 | 
             
              @info_plist_backup_name                    = backup_info_plist(@config_settings[PRODUCT_SETTINGS_PATH_KEY],                    nil)
         | 
| 595 574 | 
             
              @watchkit_app_info_plist_backup_name       = backup_info_plist(@config_settings[WATCHKIT_APP_PRODUCT_SETTINGS_PATH_KEY],       WATCHKIT_APP_PREFIX)
         | 
| 596 575 | 
             
              @watchkit_extension_info_plist_backup_name = backup_info_plist(@config_settings[WATCHKIT_EXTENSION_PRODUCT_SETTINGS_PATH_KEY], WATCHKIT_EXTENSION_PREFIX)
         | 
| 597 576 | 
             
              @widget_info_plist_backup_name             = backup_info_plist(@config_settings[WIDGET_PRODUCT_SETTINGS_PATH_KEY],             WIDGET_PREFIX)
         | 
| 577 | 
            +
              puts
         | 
| 598 578 | 
             
            end
         | 
| 599 579 |  | 
| 600 580 | 
             
            def backup_info_plist(product_settings_path, description)
         | 
| @@ -634,14 +614,17 @@ def update_info_plist(product_settings_path, monotonic_revision, revision, bundl | |
| 634 614 | 
             
                error("Update #{description}Info.plist error!", e)
         | 
| 635 615 | 
             
              end
         | 
| 636 616 |  | 
| 637 | 
            -
               | 
| 617 | 
            +
              puts "#{description}Info.plist was updated."
         | 
| 618 | 
            +
              puts
         | 
| 638 619 | 
             
            end
         | 
| 639 620 |  | 
| 640 621 | 
             
            def restore_info_plists
         | 
| 622 | 
            +
              puts
         | 
| 641 623 | 
             
              restore_info_plist(@config_settings[PRODUCT_SETTINGS_PATH_KEY],                    @info_plist_backup_name,                    nil)
         | 
| 642 624 | 
             
              restore_info_plist(@config_settings[WATCHKIT_APP_PRODUCT_SETTINGS_PATH_KEY],       @watchkit_app_info_plist_backup_name,       WATCHKIT_APP_PREFIX)
         | 
| 643 625 | 
             
              restore_info_plist(@config_settings[WATCHKIT_EXTENSION_PRODUCT_SETTINGS_PATH_KEY], @watchkit_extension_info_plist_backup_name, WATCHKIT_EXTENSION_PREFIX)
         | 
| 644 626 | 
             
              restore_info_plist(@config_settings[WIDGET_PRODUCT_SETTINGS_PATH_KEY],             @widget_info_plist_backup_name,             WIDGET_PREFIX)
         | 
| 627 | 
            +
              puts
         | 
| 645 628 | 
             
            end
         | 
| 646 629 |  | 
| 647 630 | 
             
            def restore_info_plist(product_settings_path, info_plist_backup_name, description)
         | 
| @@ -659,55 +642,22 @@ def deploy(deliver_deploy) | |
| 659 642 | 
             
              deploy_password               = @config_settings[DEPLOY_PASSWORD_KEY].blank?               ? ENV[DEPLOY_PASSWORD_KEY]               : @config_settings[DEPLOY_PASSWORD_KEY]
         | 
| 660 643 | 
             
              deploy_itunesconnect_username = @config_settings[DEPLOY_ITUNESCONNECT_USERNAME_KEY].blank? ? ENV[DEPLOY_ITUNESCONNECT_USERNAME_KEY] : @config_settings[DEPLOY_ITUNESCONNECT_USERNAME_KEY]
         | 
| 661 644 |  | 
| 662 | 
            -
               | 
| 663 | 
            -
              deliver_deploy = deliver_deploy ? 1 : 0
         | 
| 664 | 
            -
             | 
| 665 | 
            -
              sdk_name = %x[ source _last_build_vars.sh && echo ${SDK_NAME} ].strip!
         | 
| 666 | 
            -
             | 
| 667 | 
            -
              if sdk_name.include?('macos')
         | 
| 668 | 
            -
                build_env_vars        = BuildEnvVarsLoader.load
         | 
| 669 | 
            -
                ipa_bundle_id         = build_env_vars[IPA_BUNDLE_ID_KEY]
         | 
| 670 | 
            -
                current_app_version   = build_env_vars[CURRENT_APP_VERSION_KEY]
         | 
| 671 | 
            -
                current_build_version = build_env_vars[CURRENT_BUILD_VERSION_KEY]
         | 
| 672 | 
            -
                name_for_deployment   = build_env_vars[NAME_FOR_DEPLOYMENT_KEY]
         | 
| 673 | 
            -
                executable_name       = build_env_vars[EXECUTABLE_NAME_KEY]
         | 
| 674 | 
            -
                ipa_product           = build_env_vars[IPA_PRODUCT_KEY]
         | 
| 675 | 
            -
                app_dsym              = build_env_vars[APP_DSYM_KEY]
         | 
| 676 | 
            -
                built_products_dir    = build_env_vars[BUILT_PRODUCTS_DIR_KEY]
         | 
| 677 | 
            -
             | 
| 678 | 
            -
                local_path_to_app = File.join(Dir.tmpdir, ipa_bundle_id)
         | 
| 679 | 
            -
                local_path_to_build = File.join(local_path_to_app, "v.#{current_app_version}_#{current_build_version}")
         | 
| 680 | 
            -
                FileUtils.rm_rf(local_path_to_build)
         | 
| 681 | 
            -
                FileUtils.mkdir_p(local_path_to_build)
         | 
| 682 | 
            -
             | 
| 683 | 
            -
                configuration_full_path = File.join(local_path_to_build, name_for_deployment)
         | 
| 684 | 
            -
                FileUtils.mkdir(configuration_full_path)
         | 
| 685 | 
            -
                FileUtils.cp(ipa_product, File.join(configuration_full_path, executable_name) + ZIP_EXT)
         | 
| 686 | 
            -
             | 
| 687 | 
            -
                # TODO: mds currently doesn't support dsym for mac projects. Will be implemented later.
         | 
| 688 | 
            -
                # if File.exist?(app_dsym)
         | 
| 689 | 
            -
                #   Dir.chdir(built_products_dir)
         | 
| 690 | 
            -
                #   destination = File.join(configuration_full_path, "#{executable_name + APP_EXT + DSYM_EXT + ZIP_EXT}")
         | 
| 691 | 
            -
                #   system("zip -r '#{destination}' '#{executable_name + APP_EXT + DSYM_EXT}'")
         | 
| 692 | 
            -
                # end
         | 
| 693 | 
            -
             | 
| 694 | 
            -
                deploy_path    = @config_settings[DEPLOY_PATH_KEY].blank? ? MACOS_PROJECTS_DEPLOY_PATH : @config_settings[DEPLOY_PATH_KEY]
         | 
| 695 | 
            -
                deploy_success = system("#{DEPLOY_SCRIPT_PATH} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password} #{local_path_to_app}")
         | 
| 696 | 
            -
              else
         | 
| 697 | 
            -
                deploy_path    = @config_settings[DEPLOY_PATH_KEY].blank? ? ENV[DEPLOY_PATH_KEY] : @config_settings[DEPLOY_PATH_KEY]
         | 
| 698 | 
            -
                deploy_success = system("#{DEPLOY_IPA_SCRIPT_PATH} #{deploy_host} #{deploy_path} #{deploy_username} #{deploy_password} #{deploy_itunesconnect_username} #{deliver_deploy}")
         | 
| 699 | 
            -
              end
         | 
| 645 | 
            +
              sdk_name = BuildEnvVarsLoader.load_last_build_vars[SDK_NAME_KEY]
         | 
| 700 646 |  | 
| 701 | 
            -
               | 
| 647 | 
            +
              deploy_path = sdk_name.include?('macos') ? MACOS_PROJECTS_DEPLOY_PATH : ENV[DEPLOY_PATH_KEY]
         | 
| 648 | 
            +
              deploy_path = @config_settings[DEPLOY_PATH_KEY] if @config_settings[DEPLOY_PATH_KEY].present?
         | 
| 649 | 
            +
              Deployer.deploy(deploy_host, deploy_path, deploy_username, deploy_password, deploy_itunesconnect_username, deliver_deploy)
         | 
| 650 | 
            +
             | 
| 651 | 
            +
              success('Deploy complete!')
         | 
| 702 652 | 
             
            end
         | 
| 703 653 |  | 
| 704 654 | 
             
            def clean
         | 
| 705 655 | 
             
              FileUtils.rm_f(Dir.glob('*.pyc'))
         | 
| 706 | 
            -
              FileUtils.rm_f( | 
| 707 | 
            -
              FileUtils.rm_f( | 
| 708 | 
            -
              FileUtils.rm_f( | 
| 709 | 
            -
              FileUtils.rm_f( | 
| 710 | 
            -
              FileUtils.rm_rf( | 
| 656 | 
            +
              FileUtils.rm_f(AUTOGENERATED_LAST_REVISION)
         | 
| 657 | 
            +
              FileUtils.rm_f(AUTOGENERATED_LAST_BUILD_VARS)
         | 
| 658 | 
            +
              FileUtils.rm_f(AUTOGENERATED_COVERAGE)
         | 
| 659 | 
            +
              FileUtils.rm_f(AUTOGENERATED_DUPLICATION)
         | 
| 660 | 
            +
              FileUtils.rm_rf(AUTOGENERATED_TEST_RESULTS)
         | 
| 711 661 | 
             
              Xcodebuild.clean_all_targets
         | 
| 712 662 | 
             
            end
         | 
| 713 663 |  | 
| @@ -738,32 +688,18 @@ def code_coverage | |
| 738 688 | 
             
            end
         | 
| 739 689 |  | 
| 740 690 | 
             
            def code_duplication_report
         | 
| 741 | 
            -
              duplication_success = system("#{CODE_DUPLICATION_REPORT_SCRIPT_PATH}  | 
| 691 | 
            +
              duplication_success = system("#{CODE_DUPLICATION_REPORT_SCRIPT_PATH} '#{@config_settings[EXCLUDE_PATTERN_FOR_CODE_DUPLICATION_KEY]}' #{AUTOGENERATED_DUPLICATION}")
         | 
| 742 692 | 
             
              error('Generate code duplication error!') unless duplication_success
         | 
| 743 693 | 
             
            end
         | 
| 744 694 |  | 
| 745 | 
            -
            def tag
         | 
| 746 | 
            -
              tag_success = system("#{MAKE_TAG_SCRIPT_PATH} \"#{ENV[SCM_USERNAME_KEY]}\" \"#{ENV[SCM_PASSWORD_KEY]}\"")
         | 
| 747 | 
            -
              error('Make tag error!') unless tag_success
         | 
| 748 | 
            -
            end
         | 
| 749 | 
            -
             | 
| 750 | 
            -
            # 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
         | 
| 751 | 
            -
            # 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
         | 
| 752 | 
            -
            # Additional |echo| is needed in order to add newline, otherwise base64 encoding doesn't work
         | 
| 753 | 
            -
            def svn_tag_from_jenkins
         | 
| 754 | 
            -
              ENV[SCM_USERNAME_KEY]=%x[ $(shell xpath ../subversion.credentials \(//userName\)[1]/text\(\)) ]
         | 
| 755 | 
            -
              ENV[SCM_PASSWORD_KEY]=%x[ $(shell echo $$(xpath ../subversion.credentials \(//password\)[1]/text\(\) 2>/dev/null && echo) | openssl base64 -d) ]
         | 
| 756 | 
            -
             | 
| 757 | 
            -
              tag
         | 
| 758 | 
            -
            end
         | 
| 759 | 
            -
             | 
| 760 695 | 
             
            def clean_working_copy(all)
         | 
| 761 | 
            -
               | 
| 762 | 
            -
               | 
| 763 | 
            -
              error('Clean working copy error!') unless clean_success
         | 
| 696 | 
            +
              SCM.clean_working_copy(all)
         | 
| 697 | 
            +
              error('Clean working copy error!') unless $?.success?
         | 
| 764 698 | 
             
            end
         | 
| 765 699 |  | 
| 766 700 | 
             
            def error(msg, e = nil)
         | 
| 701 | 
            +
              puts
         | 
| 702 | 
            +
             | 
| 767 703 | 
             
              if e.present?
         | 
| 768 704 | 
             
                puts e.inspect
         | 
| 769 705 | 
             
                puts e.backtrace
         | 
| @@ -773,5 +709,6 @@ def error(msg, e = nil) | |
| 773 709 | 
             
            end
         | 
| 774 710 |  | 
| 775 711 | 
             
            def success(msg)
         | 
| 712 | 
            +
              puts
         | 
| 776 713 | 
             
              puts msg.green.bold
         | 
| 777 714 | 
             
            end
         | 
    
        data/lib/nixenvironment.rb
    CHANGED
    
    
| @@ -50,16 +50,18 @@ module Nixenvironment | |
| 50 50 | 
             
                  end
         | 
| 51 51 |  | 
| 52 52 | 
             
                  def make_macos_zip
         | 
| 53 | 
            -
                     | 
| 54 | 
            -
                    built_products_dir | 
| 55 | 
            -
                    executable_name | 
| 56 | 
            -
                    target_name | 
| 57 | 
            -
                    configuration | 
| 58 | 
            -
                    app_product | 
| 53 | 
            +
                    load_last_build_vars = BuildEnvVarsLoader.load_last_build_vars
         | 
| 54 | 
            +
                    built_products_dir   = load_last_build_vars[BUILT_PRODUCTS_DIR_KEY].presence
         | 
| 55 | 
            +
                    executable_name      = load_last_build_vars[EXECUTABLE_NAME_KEY].presence
         | 
| 56 | 
            +
                    target_name          = load_last_build_vars[TARGET_NAME_KEY].presence
         | 
| 57 | 
            +
                    configuration        = load_last_build_vars[CONFIGURATION_KEY].presence
         | 
| 58 | 
            +
                    app_product          = load_last_build_vars[APP_PRODUCT_KEY].presence
         | 
| 59 59 |  | 
| 60 60 | 
             
                    new_ipa_name = "#{executable_name}-#{target_name}-#{configuration}"
         | 
| 61 61 | 
             
                    new_ipa_path = File.join(built_products_dir, new_ipa_name) + ZIP_EXT
         | 
| 62 | 
            +
                    puts
         | 
| 62 63 | 
             
                    puts "IPA_PRODUCT = #{new_ipa_path}"
         | 
| 64 | 
            +
                    puts
         | 
| 63 65 |  | 
| 64 66 | 
             
                    Dir.mktmpdir do |tmp_dir|
         | 
| 65 67 | 
             
                      dest_app_dir     = File.join(tmp_dir, new_ipa_name)
         | 
| @@ -77,10 +79,7 @@ module Nixenvironment | |
| 77 79 | 
             
                      end
         | 
| 78 80 |  | 
| 79 81 | 
             
                      puts "--> Zip '#{tmp_dir}' into '#{new_ipa_path}' ..."
         | 
| 80 | 
            -
                      Dir.chdir(tmp_dir)  | 
| 81 | 
            -
                        zip_success = system("/usr/bin/zip --symlinks --verbose --recurse-paths \"#{new_ipa_path}\" .")
         | 
| 82 | 
            -
                        raise unless zip_success
         | 
| 83 | 
            -
                      end
         | 
| 82 | 
            +
                      Dir.chdir(tmp_dir) { system("/usr/bin/zip --symlinks --verbose --recurse-paths '#{new_ipa_path}' .") }
         | 
| 84 83 | 
             
                    end
         | 
| 85 84 |  | 
| 86 85 | 
             
                    ipa_bundle_id = get_bundle_id(File.join(app_product, 'Contents'))
         | 
| @@ -89,7 +88,7 @@ module Nixenvironment | |
| 89 88 | 
             
            IPA_PRODUCT='#{new_ipa_path}'
         | 
| 90 89 | 
             
            IPA_BUNDLE_ID='#{ipa_bundle_id}'
         | 
| 91 90 | 
             
            NAME_FOR_DEPLOYMENT='#{configuration}'
         | 
| 92 | 
            -
                \" >>  | 
| 91 | 
            +
                \" >> #{AUTOGENERATED_LAST_BUILD_VARS}")
         | 
| 93 92 | 
             
                  end
         | 
| 94 93 |  | 
| 95 94 | 
             
                  private
         | 
| @@ -99,43 +98,34 @@ NAME_FOR_DEPLOYMENT='#{configuration}' | |
| 99 98 | 
             
                    is_appstore = ipa_product_suffix.present? && ipa_product_suffix.include?('Appstore')
         | 
| 100 99 | 
             
                    is_adhoc    = ipa_product_suffix.present? && ipa_product_suffix.include?('AdHoc')
         | 
| 101 100 |  | 
| 102 | 
            -
                     | 
| 103 | 
            -
                    built_products_dir | 
| 104 | 
            -
                    executable_name | 
| 105 | 
            -
                    target_name | 
| 106 | 
            -
                    configuration | 
| 107 | 
            -
                    app_product | 
| 108 | 
            -
             | 
| 109 | 
            -
                    watchkit_app_relative_product        =  | 
| 110 | 
            -
                    watchkit_extension_relative_product  =  | 
| 111 | 
            -
                    widget_relative_product              =  | 
| 112 | 
            -
             | 
| 113 | 
            -
                    resigned_bundle_id                            = is_resigned ?  | 
| 114 | 
            -
                    resigned_watchkit_app_bundle_id               = is_resigned ?  | 
| 115 | 
            -
                    resigned_watchkit_extension_bundle_id         = is_resigned ?  | 
| 116 | 
            -
                    resigned_widget_bundle_id                     = is_resigned ?  | 
| 117 | 
            -
                    resigned_bundle_name                          = is_resigned ?  | 
| 118 | 
            -
                    resigned_entitlements_path                    = is_resigned ?  | 
| 119 | 
            -
                    resigned_watchkit_extension_entitlements_path = is_resigned ?  | 
| 120 | 
            -
                    resigned_widget_entitlements_path             = is_resigned ?  | 
| 101 | 
            +
                    load_last_build_vars = BuildEnvVarsLoader.load_last_build_vars
         | 
| 102 | 
            +
                    built_products_dir   = load_last_build_vars[BUILT_PRODUCTS_DIR_KEY].presence
         | 
| 103 | 
            +
                    executable_name      = load_last_build_vars[EXECUTABLE_NAME_KEY].presence
         | 
| 104 | 
            +
                    target_name          = load_last_build_vars[TARGET_NAME_KEY].presence
         | 
| 105 | 
            +
                    configuration        = load_last_build_vars[CONFIGURATION_KEY].presence
         | 
| 106 | 
            +
                    app_product          = load_last_build_vars[APP_PRODUCT_KEY].presence
         | 
| 107 | 
            +
             | 
| 108 | 
            +
                    watchkit_app_relative_product        = load_last_build_vars['WATCHKIT_APP_RELATIVE_PRODUCT'].presence
         | 
| 109 | 
            +
                    watchkit_extension_relative_product  = load_last_build_vars['WATCHKIT_EXTENSION_RELATIVE_PRODUCT'].presence
         | 
| 110 | 
            +
                    widget_relative_product              = load_last_build_vars['WIDGET_RELATIVE_PRODUCT'].presence
         | 
| 111 | 
            +
             | 
| 112 | 
            +
                    resigned_bundle_id                            = is_resigned ? load_last_build_vars[RESIGNED_BUNDLE_ID_KEY].presence                            : nil
         | 
| 113 | 
            +
                    resigned_watchkit_app_bundle_id               = is_resigned ? load_last_build_vars[RESIGNED_WATCHKIT_APP_BUNDLE_ID_KEY].presence               : nil
         | 
| 114 | 
            +
                    resigned_watchkit_extension_bundle_id         = is_resigned ? load_last_build_vars[RESIGNED_WATCHKIT_EXTENSION_BUNDLE_ID_KEY].presence         : nil
         | 
| 115 | 
            +
                    resigned_widget_bundle_id                     = is_resigned ? load_last_build_vars[RESIGNED_WIDGET_BUNDLE_ID_KEY].presence                     : nil
         | 
| 116 | 
            +
                    resigned_bundle_name                          = is_resigned ? load_last_build_vars[RESIGNED_BUNDLE_NAME_KEY].presence                          : nil
         | 
| 117 | 
            +
                    resigned_entitlements_path                    = is_resigned ? load_last_build_vars[RESIGNED_ENTITLEMENTS_PATH_KEY].presence                    : nil
         | 
| 118 | 
            +
                    resigned_watchkit_extension_entitlements_path = is_resigned ? load_last_build_vars[RESIGNED_WATCHKIT_EXTENSION_ENTITLEMENTS_PATH_KEY].presence : nil
         | 
| 119 | 
            +
                    resigned_widget_entitlements_path             = is_resigned ? load_last_build_vars[RESIGNED_WIDGET_ENTITLEMENTS_PATH_KEY].presence             : nil
         | 
| 121 120 |  | 
| 122 121 | 
             
                    ipa_product = "#{built_products_dir}/#{executable_name}-#{target_name}-#{configuration}#{ipa_product_suffix}.ipa"
         | 
| 123 122 | 
             
                    puts "#{ipa_product_key} = #{ipa_product}"
         | 
| 124 123 |  | 
| 125 | 
            -
                    if is_appstore
         | 
| 126 | 
            -
                      app_name         = File.basename(app_product)
         | 
| 127 | 
            -
                      temp_app_product = File.join(Dir.tmpdir, app_name)
         | 
| 128 | 
            -
             | 
| 129 | 
            -
                      FileUtils.cp_r(app_product, temp_app_product)
         | 
| 130 | 
            -
             | 
| 131 | 
            -
                      set_plist_values_in_app_path(temp_app_product, 'Configuration' => 'Appstore')
         | 
| 132 | 
            -
                    end
         | 
| 133 | 
            -
             | 
| 134 124 | 
             
                    @valid_keychain_identities_cache = get_valid_keychain_identities
         | 
| 135 125 |  | 
| 136 126 | 
             
                    resign(app_product, ipa_product, watchkit_app_relative_product, watchkit_extension_relative_product, widget_relative_product,
         | 
| 137 127 | 
             
                           resigned_bundle_id, resigned_watchkit_app_bundle_id, resigned_watchkit_extension_bundle_id, resigned_widget_bundle_id,
         | 
| 138 | 
            -
                           resigned_bundle_name, resigned_entitlements_path, resigned_watchkit_extension_entitlements_path, resigned_widget_entitlements_path, profile_type)
         | 
| 128 | 
            +
                           resigned_bundle_name, resigned_entitlements_path, resigned_watchkit_extension_entitlements_path, resigned_widget_entitlements_path, profile_type, is_appstore)
         | 
| 139 129 |  | 
| 140 130 | 
             
                    ipa_bundle_id = is_resigned ? resigned_bundle_id : get_bundle_id(app_product)
         | 
| 141 131 |  | 
| @@ -147,13 +137,11 @@ NAME_FOR_DEPLOYMENT='#{configuration}' | |
| 147 137 | 
             
                      name_for_deployment = configuration
         | 
| 148 138 | 
             
                    end
         | 
| 149 139 |  | 
| 150 | 
            -
                    system("echo \"\n | 
| 140 | 
            +
                    system("echo \"\n
         | 
| 151 141 | 
             
            #{ipa_product_key}='#{ipa_product}'
         | 
| 152 142 | 
             
            #{ipa_bundle_id_key}='#{ipa_bundle_id}'
         | 
| 153 143 | 
             
            #{name_for_deployment_key}='#{name_for_deployment}'
         | 
| 154 | 
            -
                    \" >>  | 
| 155 | 
            -
             | 
| 156 | 
            -
                    FileUtils.rm_rf(temp_app_product) if is_appstore
         | 
| 144 | 
            +
                    \" >> #{AUTOGENERATED_LAST_BUILD_VARS}")
         | 
| 157 145 | 
             
                  end
         | 
| 158 146 |  | 
| 159 147 | 
             
                  # Resigns specified .app product and packages it into .ipa file. Finds best matching provisioning profile based on specified options.
         | 
| @@ -163,7 +151,7 @@ NAME_FOR_DEPLOYMENT='#{configuration}' | |
| 163 151 | 
             
                  def resign(app_product_path, new_ipa_path, watchkit_app_relative_product_path = nil, watchkit_extension_relative_product_path = nil,
         | 
| 164 152 | 
             
                             widget_relative_product_path = nil, new_bundle_id = nil, new_watchkit_app_bundle_id = nil, new_watchkit_extension_bundle_id = nil,
         | 
| 165 153 | 
             
                             new_widget_bundle_id = nil, new_bundle_name = nil, new_entitlements_path = nil, new_watchkit_extension_entitlements_path = nil,
         | 
| 166 | 
            -
                             new_widget_entitlements_path = nil, profile_type = PROFILE_TYPE_DEVELOPER)
         | 
| 154 | 
            +
                             new_widget_entitlements_path = nil, profile_type = PROFILE_TYPE_DEVELOPER, is_appstore = false)
         | 
| 167 155 | 
             
                    raise "Unknown profile type '#{profile_type}'! Must be from #{AVAILABLE_PROFILE_TYPES}" unless AVAILABLE_PROFILE_TYPES.include?(profile_type)
         | 
| 168 156 |  | 
| 169 157 | 
             
                    new_bundle_id   ||= get_bundle_id(app_product_path)
         | 
| @@ -207,7 +195,7 @@ NAME_FOR_DEPLOYMENT='#{configuration}' | |
| 207 195 | 
             
                                        new_bundle_id, new_watchkit_app_bundle_id, new_watchkit_extension_bundle_id, new_widget_bundle_id, new_bundle_name,
         | 
| 208 196 | 
             
                                        new_entitlements_path, new_watchkit_extension_entitlements_path, new_widget_entitlements_path,
         | 
| 209 197 | 
             
                                        profile_info.path, identity_name, watchkit_app_profile_path, watchkit_app_identity_name, watchkit_extension_profile_path, watchkit_extension_identity_name,
         | 
| 210 | 
            -
                                        widget_profile_path, widget_identity_name)
         | 
| 198 | 
            +
                                        widget_profile_path, widget_identity_name, is_appstore)
         | 
| 211 199 | 
             
                  end
         | 
| 212 200 |  | 
| 213 201 | 
             
                  def find_profile_info_and_identity_name(profile_type, new_bundle_id)
         | 
| @@ -224,12 +212,13 @@ NAME_FOR_DEPLOYMENT='#{configuration}' | |
| 224 212 | 
             
                    profiles_and_identities.each { |item| pp item.first.to_s, item.last }
         | 
| 225 213 |  | 
| 226 214 | 
             
                    puts "--> Looking for the best match among found profiles, based on similarity between profile's app id and desired bundle id ..."
         | 
| 227 | 
            -
                    best_match = find_best_match_for_bundle_id(profiles_and_identities, new_bundle_id)
         | 
| 228 | 
            -
                    puts_header "--> Best match: #{best_match.to_s}"
         | 
| 229 215 |  | 
| 216 | 
            +
                    best_match = find_best_match_for_bundle_id(profiles_and_identities, new_bundle_id)
         | 
| 230 217 | 
             
                    profile_info  = best_match.first
         | 
| 231 218 | 
             
                    identity_name = best_match.last
         | 
| 232 219 |  | 
| 220 | 
            +
                    puts_header "--> Best match: #{profile_info.to_s}, identity_name='#{identity_name}'"
         | 
| 221 | 
            +
             | 
| 233 222 | 
             
                    return profile_info, identity_name
         | 
| 234 223 | 
             
                  end
         | 
| 235 224 |  | 
| @@ -256,7 +245,7 @@ NAME_FOR_DEPLOYMENT='#{configuration}' | |
| 256 245 | 
             
                                          new_bundle_id, new_watchkit_app_bundle_id, new_watchkit_extension_bundle_id, new_widget_bundle_id, new_bundle_name,
         | 
| 257 246 | 
             
                                          new_entitlements_path, new_watchkit_extension_entitlements_path, new_widget_entitlements_path,
         | 
| 258 247 | 
             
                                          profile_path, identity_name, watchkit_app_profile_path, watchkit_app_identity_name, watchkit_extension_profile_path, watchkit_extension_identity_name,
         | 
| 259 | 
            -
                                          widget_profile_path, widget_identity_name)
         | 
| 248 | 
            +
                                          widget_profile_path, widget_identity_name, is_appstore)
         | 
| 260 249 | 
             
                    Dir.mktmpdir do |tmp_dir|
         | 
| 261 250 | 
             
                      dest_app_dir          = File.join(tmp_dir, "Payload")
         | 
| 262 251 | 
             
                      dest_app_product_path = File.join(dest_app_dir, File.basename(app_product_path))
         | 
| @@ -267,6 +256,8 @@ NAME_FOR_DEPLOYMENT='#{configuration}' | |
| 267 256 | 
             
                      puts "--> Copy '#{app_product_path}' into '#{dest_app_product_path}' ..."
         | 
| 268 257 | 
             
                      FileUtils.cp_r(app_product_path, dest_app_product_path)
         | 
| 269 258 |  | 
| 259 | 
            +
                      set_plist_values_in_app_path(app_product_path, 'Configuration' => 'Appstore') if is_appstore
         | 
| 260 | 
            +
             | 
| 270 261 | 
             
                      # replace provision, rename bundle_id and bundle_name
         | 
| 271 262 | 
             
                      is_provision_replaced        = replace_provision(dest_app_product_path, profile_path)
         | 
| 272 263 | 
             
                      is_bundle_id_or_name_changed = rename_bundle_id_and_name(dest_app_product_path, new_bundle_id, new_bundle_name)
         | 
| @@ -320,11 +311,13 @@ NAME_FOR_DEPLOYMENT='#{configuration}' | |
| 320 311 |  | 
| 321 312 | 
             
                      if Dir.exist?(new_ipa_path)
         | 
| 322 313 | 
             
                        puts "--> Remove old '#{new_ipa_path}' ..."
         | 
| 323 | 
            -
                        FileUtils. | 
| 314 | 
            +
                        FileUtils.rm_rf(new_ipa_path)
         | 
| 324 315 | 
             
                      end
         | 
| 325 316 |  | 
| 326 317 | 
             
                      puts "--> Zip '#{tmp_dir}' into '#{new_ipa_path}' ..."
         | 
| 327 318 | 
             
                      Dir.chdir(tmp_dir) { system("/usr/bin/zip --symlinks --verbose --recurse-paths '#{new_ipa_path}' .") }
         | 
| 319 | 
            +
             | 
| 320 | 
            +
                      puts
         | 
| 328 321 | 
             
                    end
         | 
| 329 322 | 
             
                  end
         | 
| 330 323 |  |