blob: 7d4624dd91d4cdbd3cc4a61eaf4466e9991b8ce4 [file] [log] [blame]
* Copyright (c) Facebook, Inc. and its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* See the License for the specific language governing permissions and
* limitations under the License.
{namespace buck.apple_test}
{template .soyweb}
{param title: 'apple_test()' /}
{param navid: 'rule_apple_test' /}
{param prettify: true /}
{param description}
A rule that generates an Apple test.
{param content}
{call buck.rule}
{param status: 'UNFROZEN' /}
{param overview}
An <code>apple_test()</code> rule contains Objective-C/C++ code which can be built and used to test
code contained in other rules. The tests can be executed by running <code>buck test</code>.
{param args}
{call buck.name_arg /}
{call apple_common.info_plist_arg /}
{call apple_common.info_plist_substitutions_arg /}
{call buck.arg}
{param name: 'test_host_app' /}
{param default: 'None' /}
{param desc}
A <a href="{ROOT}concept/build_target.html">build target</a> identifying
an <a href="{ROOT}rule/apple_bundle.html"><code>apple_bundle()</code> rule</a> that builds an
application bundle. Output of the specified rule will be used as a test host of this test. This
implies <code>run_test_separately</code>.
Since symbols that are defined in the test host application and its dependencies will not be
linked into the test binary, to make those symbols accessible to the test target they need
to be specified as a dependency of this target and <code>['-undefined', 'dynamic_lookup']
</code> needs to be added to this target's <code>linker_flags</code> (this will suppress undefined
reference errors during compilation, but if the symbols do not exist, it might result in runtime
{call cxx_common.srcs_arg}
{param sample_file_name : 'foo/bar.m' /}
{call cxx_common.platform_srcs_arg /}
{call apple_common.headers_arg /}
{call apple_common.header_path_prefix_arg /}
{call apple_common.frameworks_arg /}
{call cxx_common.preprocessor_flags_arg /}
{call cxx_common.compiler_flags_arg /}
{call cxx_common.platform_compiler_flags_arg /}
{call cxx_common.linker_flags_arg /}
{call native_common.link_style /}
{call apple_common.target_sdk_version /}
{call buck.run_test_separately_arg /}
{call buck.test_label_arg /}
{call apple_common.extra_xcode_sources /}
{call apple_common.extra_xcode_files /}
{call test_common.contacts_arg /}
{/param} // args
{param examples}
{literal}<pre class="prettyprint lang-py">
name = 'MyTest',
info_plist = 'MyTest-Info.plist',
preprocessor_flags = ['-fobjc-arc'],
srcs = [
deps = [
frameworks = [
{/param} // examples
{/call} // buck.rule