Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 236a746

Browse files
authored
Re-split ocmock into source set and static lib (#403)
This re-lands #399 with complete_static_lib=true in the static library target. static_library does not includes sources from its dependencies, and since this target had no (direct) sources of its own, was being built empty in the original version of this split. The complete_static_lib forces the library to include sources from its dependencies.
1 parent f83d1d7 commit 236a746

File tree

1 file changed

+17
-6
lines changed
  • build/secondary/third_party/ocmock

1 file changed

+17
-6
lines changed

build/secondary/third_party/ocmock/BUILD.gn

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@ config("ocmock_config") {
99
include_dirs = [ "$ocmock_path" ]
1010
}
1111

12-
static_library("ocmock") {
12+
# Target that compiles all sources to .o files but does not produce a static
13+
# library for use in macOS desktop tests.
14+
source_set("ocmock_src") {
1315
configs -= [ "//build/config/compiler:chromium_code" ]
1416
all_dependent_configs = [ ":ocmock_config" ]
1517
cflags = [
1618
"-fvisibility=default",
1719
"-Wno-misleading-indentation",
1820
]
19-
if (is_ios) {
20-
cflags += [
21-
"-mios-simulator-version-min=$ios_testing_deployment_target",
22-
]
23-
}
2421
sources = [
2522
"$ocmock_path/OCMock/NSInvocation+OCMAdditions.h",
2623
"$ocmock_path/OCMock/NSInvocation+OCMAdditions.m",
@@ -96,3 +93,17 @@ static_library("ocmock") {
9693
"$ocmock_path/OCMock/OCProtocolMockObject.m",
9794
]
9895
}
96+
97+
# Generates a static library, used in iOS unit test targets
98+
static_library("ocmock") {
99+
# Force the static lib to include code from dependencies
100+
complete_static_lib = true
101+
if (is_ios) {
102+
cflags = [
103+
"-mios-simulator-version-min=$ios_testing_deployment_target",
104+
]
105+
}
106+
public_deps = [
107+
":ocmock_src",
108+
]
109+
}

0 commit comments

Comments
 (0)