Skip to content

Commit

Permalink
Merge pull request #40 from ob/segiddins/actually-prepend-copts
Browse files Browse the repository at this point in the history
Actually prepend copts so they get passed to tools
  • Loading branch information
segiddins authored Apr 16, 2020
2 parents 6b4f101 + 1fe8f45 commit 33021fe
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
18 changes: 11 additions & 7 deletions rules/library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,18 @@ _DefaultLibraryTools = {
"fetch_default_xcconfig": _error_on_default_xcconfig,
}

def _prepend(list, other):
for item in reversed(other):
list.insert(0, item)

def _prepend_copts(copts_struct, objc_copts, cc_copts, swift_copts, linkopts, ibtool_copts, momc_copts, mapc_copts):
objc_copts = copts_struct.objc_copts + objc_copts
cc_copts = copts_struct.cc_copts + cc_copts
swift_copts = copts_struct.swift_copts + swift_copts
linkopts = copts_struct.linkopts + linkopts
ibtool_copts = copts_struct.ibtool_copts + ibtool_copts
momc_copts = copts_struct.momc_copts + momc_copts
mapc_copts = copts_struct.mapc_copts + mapc_copts
_prepend(objc_copts, copts_struct.objc_copts)
_prepend(copts_struct.cc_copts, cc_copts)
_prepend(copts_struct.swift_copts, swift_copts)
_prepend(copts_struct.linkopts, linkopts)
_prepend(copts_struct.ibtool_copts, ibtool_copts)
_prepend(copts_struct.momc_copts, momc_copts)
_prepend(copts_struct.mapc_copts, mapc_copts)

def _uppercase_string(s):
return s.upper()
Expand Down
8 changes: 8 additions & 0 deletions tests/xcconfig/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,12 @@ apple_framework(
},
)

apple_framework(
name = "wont_build_without_xcconfig",
non_arc_srcs = ["weak_property.m"],
xcconfig = {
"CLANG_ENABLE_OBJC_WEAK": "YES",
},
)

xcconfig_unit_test_suite()
8 changes: 8 additions & 0 deletions tests/xcconfig/weak_property.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@import Foundation;

@interface ClassWithWeakProperty : NSObject
@property (nonatomic, weak) NSObject *weakObject;
@end

@implementation ClassWithWeakProperty
@end

0 comments on commit 33021fe

Please sign in to comment.