lib/xcake/project/sugar.rb in xcake-0.7.0 vs lib/xcake/project/sugar.rb in xcake-0.7.1

- old
+ new

@@ -40,10 +40,32 @@ yield(t) if block_given? end end + # Defines a new ui test target. + # + # @param [Target] host target + # host target for which the unit tests are for. + # + # @param [Proc] block + # an optional block that configures the target through the DSL. + # + # @return [Target] the unit test target + # the newly created unit test target + # + def ui_tests_for(host_target) + target do |t| + t.name = "#{host_target.name}UITests" + + t.type = :ui_test_bundle + configure_test_target_for_host_target(t, host_target) + + yield(t) if block_given? + end + end + # Defines a new unit test target. # # @param [Target] host target # host target for which the unit tests are for. # @@ -56,24 +78,32 @@ def unit_tests_for(host_target) target do |t| t.name = "#{host_target.name}Tests" t.type = :unit_test_bundle - t.platform = host_target.platform - t.deployment_target = host_target.deployment_target - t.language = host_target.language + configure_test_target_for_host_target(t, host_target) - host_path = "#{host_target.name}.app/#{host_target.name}" - t.all_configurations.each do |c| - c.settings['TEST_HOST'] = "$(BUILT_PRODUCTS_DIR)/#{host_path}" - end - t.all_configurations.each do |c| - c.settings['BUNDLE_LOADER'] = '$(TEST_HOST)' - end - yield(t) if block_given? end end + + private + + def configure_test_target_for_host_target(test_target, host_target) + test_target.platform = host_target.platform + test_target.deployment_target = host_target.deployment_target + test_target.language = host_target.language + + host_path = "#{host_target.name}.app/#{host_target.name}" + test_target.all_configurations.each do |c| + c.settings['TEST_HOST'] = "$(BUILT_PRODUCTS_DIR)/#{host_path}" + end + test_target.all_configurations.each do |c| + c.settings['BUNDLE_LOADER'] = '$(TEST_HOST)' + end + end + + public # Defines a extension target. # # @param [Target] host target # host target for which the extension is for.