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

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented Sep 2, 2020

OCMock is currently set up only for iOS, but I need it in a Mac test in flutter/engine#20531.

@justinmc justinmc requested a review from gaaclarke September 2, 2020 23:29
@justinmc justinmc self-assigned this Sep 2, 2020
@justinmc justinmc marked this pull request as draft September 2, 2020 23:29
@justinmc justinmc mentioned this pull request Sep 2, 2020
@gaaclarke
Copy link
Member

gaaclarke commented Sep 2, 2020

If you do this then make your macos target depend on ocmock_src it fixes your mac problem and keeps iOS building:

# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

#assert(is_ios)

ocmock_path = "//third_party/ocmock/Source"

# OCMock headers use `#import <OCMock/Foo.h>`.
config("ocmock_config") {
  include_dirs = [ "$ocmock_path" ]
}

source_set("ocmock_src") {
  configs -= [ "//build/config/compiler:chromium_code" ]
  all_dependent_configs = [ ":ocmock_config" ]
  cflags = [
    "-fvisibility=default",
    "-Wno-misleading-indentation",
  ]
  sources = [
    "$ocmock_path/OCMock/NSInvocation+OCMAdditions.h",
    "$ocmock_path/OCMock/NSInvocation+OCMAdditions.m",
    "$ocmock_path/OCMock/NSMethodSignature+OCMAdditions.h",
    "$ocmock_path/OCMock/NSMethodSignature+OCMAdditions.m",
    "$ocmock_path/OCMock/NSNotificationCenter+OCMAdditions.h",
    "$ocmock_path/OCMock/NSNotificationCenter+OCMAdditions.m",
    "$ocmock_path/OCMock/NSObject+OCMAdditions.h",
    "$ocmock_path/OCMock/NSObject+OCMAdditions.m",
    "$ocmock_path/OCMock/NSValue+OCMAdditions.h",
    "$ocmock_path/OCMock/NSValue+OCMAdditions.m",
    "$ocmock_path/OCMock/OCClassMockObject.h",
    "$ocmock_path/OCMock/OCClassMockObject.m",
    "$ocmock_path/OCMock/OCMArg.h",
    "$ocmock_path/OCMock/OCMArg.m",
    "$ocmock_path/OCMock/OCMArgAction.h",
    "$ocmock_path/OCMock/OCMArgAction.m",
    "$ocmock_path/OCMock/OCMBlockArgCaller.h",
    "$ocmock_path/OCMock/OCMBlockArgCaller.m",
    "$ocmock_path/OCMock/OCMBlockCaller.h",
    "$ocmock_path/OCMock/OCMBlockCaller.m",
    "$ocmock_path/OCMock/OCMBoxedReturnValueProvider.h",
    "$ocmock_path/OCMock/OCMBoxedReturnValueProvider.m",
    "$ocmock_path/OCMock/OCMConstraint.h",
    "$ocmock_path/OCMock/OCMConstraint.m",
    "$ocmock_path/OCMock/OCMExceptionReturnValueProvider.h",
    "$ocmock_path/OCMock/OCMExceptionReturnValueProvider.m",
    "$ocmock_path/OCMock/OCMExpectationRecorder.h",
    "$ocmock_path/OCMock/OCMExpectationRecorder.m",
    "$ocmock_path/OCMock/OCMFunctions.h",
    "$ocmock_path/OCMock/OCMFunctions.m",
    "$ocmock_path/OCMock/OCMFunctionsPrivate.h",
    "$ocmock_path/OCMock/OCMIndirectReturnValueProvider.h",
    "$ocmock_path/OCMock/OCMIndirectReturnValueProvider.m",
    "$ocmock_path/OCMock/OCMInvocationExpectation.h",
    "$ocmock_path/OCMock/OCMInvocationExpectation.m",
    "$ocmock_path/OCMock/OCMInvocationMatcher.h",
    "$ocmock_path/OCMock/OCMInvocationMatcher.m",
    "$ocmock_path/OCMock/OCMInvocationStub.h",
    "$ocmock_path/OCMock/OCMInvocationStub.m",
    "$ocmock_path/OCMock/OCMLocation.h",
    "$ocmock_path/OCMock/OCMLocation.m",
    "$ocmock_path/OCMock/OCMMacroState.h",
    "$ocmock_path/OCMock/OCMMacroState.m",
    "$ocmock_path/OCMock/OCMNotificationPoster.h",
    "$ocmock_path/OCMock/OCMNotificationPoster.m",
    "$ocmock_path/OCMock/OCMObserverRecorder.h",
    "$ocmock_path/OCMock/OCMObserverRecorder.m",
    "$ocmock_path/OCMock/OCMPassByRefSetter.h",
    "$ocmock_path/OCMock/OCMPassByRefSetter.m",
    "$ocmock_path/OCMock/OCMRealObjectForwarder.h",
    "$ocmock_path/OCMock/OCMRealObjectForwarder.m",
    "$ocmock_path/OCMock/OCMRecorder.h",
    "$ocmock_path/OCMock/OCMRecorder.m",
    "$ocmock_path/OCMock/OCMReturnValueProvider.h",
    "$ocmock_path/OCMock/OCMReturnValueProvider.m",
    "$ocmock_path/OCMock/OCMStubRecorder.h",
    "$ocmock_path/OCMock/OCMStubRecorder.m",
    "$ocmock_path/OCMock/OCMVerifier.h",
    "$ocmock_path/OCMock/OCMVerifier.m",
    "$ocmock_path/OCMock/OCMock.h",
    "$ocmock_path/OCMock/OCMockObject.h",
    "$ocmock_path/OCMock/OCMockObject.m",
    "$ocmock_path/OCMock/OCObserverMockObject.h",
    "$ocmock_path/OCMock/OCObserverMockObject.m",
    "$ocmock_path/OCMock/OCPartialMockObject.h",
    "$ocmock_path/OCMock/OCPartialMockObject.m",
    "$ocmock_path/OCMock/OCProtocolMockObject.h",
    "$ocmock_path/OCMock/OCProtocolMockObject.m",
  ]
}

# This is a static library so it can be used by xcode's build system too.
static_library("ocmock") {
  if (is_ios) {
    cflags = [
      "-mios-simulator-version-min=$ios_testing_deployment_target",
    ]
  }
  public_deps = [
    ":ocmock_src",
  ]
}

@justinmc justinmc marked this pull request as ready for review September 3, 2020 00:09
@justinmc justinmc merged commit 940dcf6 into flutter:master Sep 3, 2020
@justinmc justinmc deleted the ocmock-mac branch September 3, 2020 17:29
cbracken added a commit that referenced this pull request Sep 11, 2020
In #399, the static_library target was split into a
source_set and static_library target, but this resulted in libocmock
being built as an empty 88-byte library. We never caught the issue since
this buildroot change was never rolled to the engine.

This reverts things back to match how we build other static libraries
such as libzip and libxml.

This reverts 940dcf6.
cbracken added a commit that referenced this pull request Sep 11, 2020
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.
chinmaygarde pushed a commit to chinmaygarde/flutter_buildroot that referenced this pull request May 4, 2021
Gets ocmock set up so that it can be used by the Mac unit tests (in flutter/engine#20531).
chinmaygarde pushed a commit to chinmaygarde/flutter_buildroot that referenced this pull request May 4, 2021
In flutter#399, the static_library target was split into a
source_set and static_library target, but this resulted in libocmock
being built as an empty 88-byte library. We never caught the issue since
this buildroot change was never rolled to the engine.

This reverts things back to match how we build other static libraries
such as libzip and libxml.

This reverts 940dcf6.
chinmaygarde pushed a commit to chinmaygarde/flutter_buildroot that referenced this pull request May 4, 2021
This re-lands flutter#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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants