forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the OCHamcrest library to the iOS build.
OCHamcrest is a dependency of the integration testing framework that will be used by iOS code. It is only used for tests (and is marked as so in ios/third_party/ochamcrest/BUILD.gn). The build is a bit involved as OCHamcrest as it mix relative imports "..." with imports of the form <OCHamcrest/...> but the source code is not found in an OCHamcrest directory. So build such a directory structure in <(SHARED_INTERMEDIATE_DIR)/ios/third_party/ochamcrest as part of the build. TBR=dpranke@chromium.org BUG=580730 TEST=None Review URL: https://codereview.chromium.org/1723663002 Cr-Commit-Position: refs/heads/master@{#376985}
- Loading branch information
Showing
11 changed files
with
532 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env python | ||
# Copyright 2016 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
import argparse | ||
import os | ||
import shutil | ||
import sys | ||
|
||
|
||
def DoMain(argv): | ||
parser = argparse.ArgumentParser(description='Generate forwarding headers.') | ||
parser.add_argument('-i', '--list-inputs', action='store_true', | ||
help='List input files and exit.') | ||
parser.add_argument('-o', '--list-outputs', action='store_true', | ||
help='List output files and exit.') | ||
parser.add_argument('-d', '--dest-dir', type=str, | ||
help=('Output directory for forwarding headers.')) | ||
parser.add_argument('filenames', metavar='filename', type=str, nargs='+', | ||
help='Input filenames.') | ||
|
||
args = parser.parse_args(argv) | ||
if args.list_inputs: | ||
return list_inputs(args.filenames) | ||
|
||
if not args.dest_dir: | ||
print '--dest-dir is required for this command.' | ||
sys.exit(1) | ||
if args.list_outputs: | ||
return ' '.join( | ||
os.path.join(args.dest_dir, os.path.basename(filename)) | ||
for filename in args.filenames) | ||
|
||
if not os.path.isdir(args.dest_dir): | ||
os.makedirs(args.dest_dir) | ||
for filename in args.filenames: | ||
target_filename = os.path.join(args.dest_dir, os.path.basename(filename)) | ||
if os.path.isfile(target_filename): | ||
os.unlink(target_filename) | ||
try: | ||
os.link(filename, target_filename) | ||
except OSError as e: | ||
# Fallbacks to copy if hardlinking fails. | ||
shutil.copy(filename, target_filename) | ||
|
||
|
||
if __name__ == '__main__': | ||
results = DoMain(sys.argv[1:]) | ||
if results: | ||
print results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
# Copyright 2016 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
# OCHamcrest sources contains import rules using relative file names | ||
# ("HCAssertThat.h") and other using paths in an installed framework | ||
# (<OCHamcrest/HCMatcher.h>). In order to build, copy all the sources | ||
# to <(SHARED_INTERMEDIATE_DIR)/ios/third_party/ochmacrest/OCHamcrest | ||
# so that both type of import work (another option considered was to | ||
# build forwarding headers but this required duplicating the list of | ||
# files in GN build and was ruled out). | ||
# | ||
# To avoid ODR violation, direct import of ios/third_party/ochamcrest | ||
# is forbidden in ios/DEPS and code should instead use import as if | ||
# OCHamcrest was in a framework (i.e. #import <OCHamcrest/OCHamcrest.h>). | ||
copy("ochamcrest_copy_files") { | ||
testonly = true | ||
visibility = [ ":ochamcrest" ] | ||
sources = [ | ||
"src/Source/Core/HCAssertThat.h", | ||
"src/Source/Core/HCAssertThat.m", | ||
"src/Source/Core/HCBaseDescription.h", | ||
"src/Source/Core/HCBaseDescription.m", | ||
"src/Source/Core/HCBaseMatcher.h", | ||
"src/Source/Core/HCBaseMatcher.m", | ||
"src/Source/Core/HCDescription.h", | ||
"src/Source/Core/HCDiagnosingMatcher.h", | ||
"src/Source/Core/HCDiagnosingMatcher.m", | ||
"src/Source/Core/HCMatcher.h", | ||
"src/Source/Core/HCSelfDescribing.h", | ||
"src/Source/Core/HCStringDescription.h", | ||
"src/Source/Core/HCStringDescription.m", | ||
"src/Source/Core/Helpers/HCCollect.h", | ||
"src/Source/Core/Helpers/HCCollect.m", | ||
"src/Source/Core/Helpers/HCInvocationMatcher.h", | ||
"src/Source/Core/Helpers/HCInvocationMatcher.m", | ||
"src/Source/Core/Helpers/HCRequireNonNilObject.h", | ||
"src/Source/Core/Helpers/HCRequireNonNilObject.m", | ||
"src/Source/Core/Helpers/HCWrapInMatcher.h", | ||
"src/Source/Core/Helpers/HCWrapInMatcher.m", | ||
"src/Source/Core/Helpers/NSInvocation+OCHamcrest.h", | ||
"src/Source/Core/Helpers/NSInvocation+OCHamcrest.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCBoolReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCBoolReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCCharReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCCharReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCDoubleReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCDoubleReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCFloatReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCFloatReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCIntReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCIntReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCLongLongReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCLongLongReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCLongReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCLongReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCObjectReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCObjectReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCReturnTypeHandlerChain.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCReturnTypeHandlerChain.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCReturnValueGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCReturnValueGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCShortReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCShortReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedCharReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedCharReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedIntReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedIntReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedLongLongReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedLongLongReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedLongReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedLongReturnGetter.m", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedShortReturnGetter.h", | ||
"src/Source/Core/Helpers/ReturnValueGetters/HCUnsignedShortReturnGetter.m", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCGenericTestFailureReporter.h", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCGenericTestFailureReporter.m", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCSenTestFailureReporter.h", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCSenTestFailureReporter.m", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCTestFailure.h", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCTestFailure.m", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCTestFailureReporter.h", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCTestFailureReporter.m", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCTestFailureReporterChain.h", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCTestFailureReporterChain.m", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCXCTestFailureReporter.h", | ||
"src/Source/Core/Helpers/TestFailureReporters/HCXCTestFailureReporter.m", | ||
"src/Source/Library/Collection/HCEvery.h", | ||
"src/Source/Library/Collection/HCEvery.m", | ||
"src/Source/Library/Collection/HCHasCount.h", | ||
"src/Source/Library/Collection/HCHasCount.m", | ||
"src/Source/Library/Collection/HCIsCollectionContaining.h", | ||
"src/Source/Library/Collection/HCIsCollectionContaining.m", | ||
"src/Source/Library/Collection/HCIsCollectionContainingInAnyOrder.h", | ||
"src/Source/Library/Collection/HCIsCollectionContainingInAnyOrder.m", | ||
"src/Source/Library/Collection/HCIsCollectionContainingInOrder.h", | ||
"src/Source/Library/Collection/HCIsCollectionContainingInOrder.m", | ||
"src/Source/Library/Collection/HCIsCollectionContainingInRelativeOrder.h", | ||
"src/Source/Library/Collection/HCIsCollectionContainingInRelativeOrder.m", | ||
"src/Source/Library/Collection/HCIsCollectionOnlyContaining.h", | ||
"src/Source/Library/Collection/HCIsCollectionOnlyContaining.m", | ||
"src/Source/Library/Collection/HCIsDictionaryContaining.h", | ||
"src/Source/Library/Collection/HCIsDictionaryContaining.m", | ||
"src/Source/Library/Collection/HCIsDictionaryContainingEntries.h", | ||
"src/Source/Library/Collection/HCIsDictionaryContainingEntries.m", | ||
"src/Source/Library/Collection/HCIsDictionaryContainingKey.h", | ||
"src/Source/Library/Collection/HCIsDictionaryContainingKey.m", | ||
"src/Source/Library/Collection/HCIsDictionaryContainingValue.h", | ||
"src/Source/Library/Collection/HCIsDictionaryContainingValue.m", | ||
"src/Source/Library/Collection/HCIsEmptyCollection.h", | ||
"src/Source/Library/Collection/HCIsEmptyCollection.m", | ||
"src/Source/Library/Collection/HCIsIn.h", | ||
"src/Source/Library/Collection/HCIsIn.m", | ||
"src/Source/Library/Decorator/HCDescribedAs.h", | ||
"src/Source/Library/Decorator/HCDescribedAs.m", | ||
"src/Source/Library/Decorator/HCIs.h", | ||
"src/Source/Library/Decorator/HCIs.m", | ||
"src/Source/Library/Logical/HCAllOf.h", | ||
"src/Source/Library/Logical/HCAllOf.m", | ||
"src/Source/Library/Logical/HCAnyOf.h", | ||
"src/Source/Library/Logical/HCAnyOf.m", | ||
"src/Source/Library/Logical/HCIsAnything.h", | ||
"src/Source/Library/Logical/HCIsAnything.m", | ||
"src/Source/Library/Logical/HCIsNot.h", | ||
"src/Source/Library/Logical/HCIsNot.m", | ||
"src/Source/Library/Number/HCIsCloseTo.h", | ||
"src/Source/Library/Number/HCIsCloseTo.m", | ||
"src/Source/Library/Number/HCIsEqualToNumber.h", | ||
"src/Source/Library/Number/HCIsEqualToNumber.m", | ||
"src/Source/Library/Number/HCIsTrueFalse.h", | ||
"src/Source/Library/Number/HCIsTrueFalse.m", | ||
"src/Source/Library/Number/HCNumberAssert.h", | ||
"src/Source/Library/Number/HCNumberAssert.m", | ||
"src/Source/Library/Number/HCOrderingComparison.h", | ||
"src/Source/Library/Number/HCOrderingComparison.m", | ||
"src/Source/Library/Object/HCArgumentCaptor.h", | ||
"src/Source/Library/Object/HCArgumentCaptor.m", | ||
"src/Source/Library/Object/HCClassMatcher.h", | ||
"src/Source/Library/Object/HCClassMatcher.m", | ||
"src/Source/Library/Object/HCConformsToProtocol.h", | ||
"src/Source/Library/Object/HCConformsToProtocol.m", | ||
"src/Source/Library/Object/HCHasDescription.h", | ||
"src/Source/Library/Object/HCHasDescription.m", | ||
"src/Source/Library/Object/HCHasProperty.h", | ||
"src/Source/Library/Object/HCHasProperty.m", | ||
"src/Source/Library/Object/HCIsEqual.h", | ||
"src/Source/Library/Object/HCIsEqual.m", | ||
"src/Source/Library/Object/HCIsInstanceOf.h", | ||
"src/Source/Library/Object/HCIsInstanceOf.m", | ||
"src/Source/Library/Object/HCIsNil.h", | ||
"src/Source/Library/Object/HCIsNil.m", | ||
"src/Source/Library/Object/HCIsSame.h", | ||
"src/Source/Library/Object/HCIsSame.m", | ||
"src/Source/Library/Object/HCIsTypeOf.h", | ||
"src/Source/Library/Object/HCIsTypeOf.m", | ||
"src/Source/Library/Object/HCThrowsException.h", | ||
"src/Source/Library/Object/HCThrowsException.m", | ||
"src/Source/Library/Text/HCIsEqualIgnoringCase.h", | ||
"src/Source/Library/Text/HCIsEqualIgnoringCase.m", | ||
"src/Source/Library/Text/HCIsEqualIgnoringWhiteSpace.h", | ||
"src/Source/Library/Text/HCIsEqualIgnoringWhiteSpace.m", | ||
"src/Source/Library/Text/HCStringContains.h", | ||
"src/Source/Library/Text/HCStringContains.m", | ||
"src/Source/Library/Text/HCStringContainsInOrder.h", | ||
"src/Source/Library/Text/HCStringContainsInOrder.m", | ||
"src/Source/Library/Text/HCStringEndsWith.h", | ||
"src/Source/Library/Text/HCStringEndsWith.m", | ||
"src/Source/Library/Text/HCStringStartsWith.h", | ||
"src/Source/Library/Text/HCStringStartsWith.m", | ||
"src/Source/Library/Text/HCSubstringMatcher.h", | ||
"src/Source/Library/Text/HCSubstringMatcher.m", | ||
"src/Source/OCHamcrest.h", | ||
] | ||
outputs = [ | ||
"$root_gen_dir/ios/third_party/ochamcrest/OCHamcrest/{{source_file_part}}", | ||
] | ||
} | ||
|
||
config("ochamcrest_config") { | ||
visibility = [ ":ochamcrest" ] | ||
libs = [ "XCTest.framework" ] | ||
include_dirs = [ "$root_gen_dir/ios/third_party/ochamcrest" ] | ||
} | ||
|
||
config("ochamcrest_private_config") { | ||
visibility = [ ":ochamcrest" ] | ||
|
||
# TODO(crbug.com/589097): remove this once OCHamcrest source has been fixed | ||
# by removing the semicolon in HCGenericTestFailureReporter.m. | ||
cflags = [ "-Wno-semicolon-before-method-body" ] | ||
cflags_objc = [ "-fobjc-arc" ] | ||
} | ||
|
||
source_set("ochamcrest") { | ||
testonly = true | ||
configs += [ | ||
":ochamcrest_config", | ||
":ochamcrest_private_config", | ||
"//build/config/compiler:no_chromium_code", | ||
] | ||
public_configs = [ ":ochamcrest_config" ] | ||
public_deps = [ | ||
":ochamcrest_copy_files", | ||
] | ||
sources = get_target_outputs(":ochamcrest_copy_files") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
OCHamcrest by Jon Reid, http://qualitycoding.org/about/ | ||
Copyright 2016 hamcrest.org | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
Neither the name of Hamcrest nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
(BSD License) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
justincohen@chromium.org | ||
rohitrao@chromium.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Name: OCHamcrest | ||
Short Name: OCHamcrest | ||
URL: https://github.com/hamcrest/OCHamcrest | ||
Version: 5.2.0 | ||
License: BSD | ||
License File: NOT_SHIPPED | ||
Security Critical: no | ||
|
||
Description: | ||
OCHamcrest is the Objective-C implementation of Hamcrest, which | ||
provides the ability to create "matchers" which contain rules | ||
to verify that a given object matches those rules. |
Oops, something went wrong.