Comments (28)
OK, sounds just like the main purpose of -packager except for not packaging the dependencies. I am thinking this should be an option to the standard action, like --omit-dependencies
or so.
from cocoapods-packager.
I think omitting the dependencies is the killer feature of packager (and is what this issue is about).
from cocoapods-packager.
@segiddins Omitting dependencies isn’t what you really want. What you want to do is include all the dependencies exactly as specified but obfuscate all of the symbols exported by the dependencies.
For example, consider a closed source library that uses FMDB internally. If a user of that library also wishes to use FMDB, you’d want to allow two copies of it to exist within the application address space without affecting one another. If you omit the dependencies, then you aren’t necessarily producing a compatible runtime environment for the closed source library. And the developers of that library aren’t going to want to have to try to support a version of their package that has been statically linked against an arbitrary combination of dependencies. The private library dependencies themselves shouldn’t even be public knowledge — you’ll just want to link FooLib.a and have it work without knowing what its leveraging internally.
from cocoapods-packager.
@blakewatters I understand your arguments, but the problem with this approach is that if your closed source library uses FMDB v2.3 (let's say, the latest version) and the user appends to wish to use FMDB 2.3 too (which seems reasonable), you will have two copies of the compiled code in your final binary : one embedded in your closed source library, with FMDB's symbols obfuscated, and the other one from the app itself.
This means that you will have duplication of your executable code and a bigger application binary at the end. If it only concerns a small dependency, it may be ok, but if you drag a whole dependency tree with a lot of internal libraries, you may end up with an app 3 times bigger…
Actually maybe the best choice for cocoapods-packager
is to propose both options, not including dependencies by default, and including then but obfuscating their symbols when a flag --with-dependencies
is given?
from cocoapods-packager.
Actually maybe the best choice for
cocoapods-packager
is to propose both options, not including dependencies by default, and including then but obfuscating their symbols when a flag--with-dependencies
is given?
While this would be great, I don’t see a reliable way to do this. Are there standard tools that can reliably mangle symbols taking Objective-C semantics into account? (E.g. class/category/method names.)
from cocoapods-packager.
@AliSoftware I’d argue that its exactly what you’d want. Imagine that you’ve integrated a third-party framework (libAwesome) that uses FMDB v2.3 and you also build your app against v2.3. Time passes and you wish to upgrade to FMDB v3.0 to get access to some whiz bang killer new feature, but libAwesome is in maintenance mode pending a major release 3 months away. Your application development decisions are now completely dominated by the implementation details of a third-party.
Responsible third-party SDK developers should be mindful of the number of dependencies they use and try to be respectful in the footprint they impose on applications adopting their work. But I also don’t think that the footprint would be that significant in the larger scheme of things. Image assets are going to add up much faster than stripped optimized code segments. I’d wager that most developers would gladly sacrifice 800k of binary space on potentially duplicated code segments for autonomy and isolation from third-party implementation details.
from cocoapods-packager.
@alloy the nm
utility available with the Xcode build change lists the symbol table for object files. Below is a dump of the symbols from a Pod build of TransitionKit, which we are using internally within LayerKit. It captures all the classes, categories, methods, and constants exported. If these symbols were aliased by injecting pre-processor definitions into the PCH when the target was built I think you could completely isolate the dependency:
libPods-Unit Tests-TransitionKit.a(Pods-Unit Tests-TransitionKit-dummy.o):
U _OBJC_CLASS_$_NSObject
0000038c S _OBJC_CLASS_$_PodsDummy_Pods_Unit_Tests_TransitionKit
U _OBJC_METACLASS_$_NSObject
00000378 S _OBJC_METACLASS_$_PodsDummy_Pods_Unit_Tests_TransitionKit
U __objc_empty_cache
00000350 s l_OBJC_CLASS_RO_$_PodsDummy_Pods_Unit_Tests_TransitionKit
00000328 s l_OBJC_METACLASS_RO_$_PodsDummy_Pods_Unit_Tests_TransitionKit
libPods-Unit Tests-TransitionKit.a(TKEvent.o):
00000000 t +[TKEvent eventWithName:transitioningFromStates:toState:]
000038fc s +[TKEvent eventWithName:transitioningFromStates:toState:].eh
00000f90 t -[TKEvent .cxx_destruct]
00003b14 s -[TKEvent .cxx_destruct].eh
000008e0 t -[TKEvent copyWithZone:]
0000399c s -[TKEvent copyWithZone:].eh
00000220 t -[TKEvent description]
0000391c s -[TKEvent description].eh
00000cb0 t -[TKEvent destinationState]
00003a28 s -[TKEvent destinationState].eh
00000ec0 t -[TKEvent didFireEventBlock]
00003ad8 s -[TKEvent didFireEventBlock].eh
00000770 t -[TKEvent encodeWithCoder:]
0000397c s -[TKEvent encodeWithCoder:].eh
00000570 t -[TKEvent initWithCoder:]
0000395c s -[TKEvent initWithCoder:].eh
00000b70 t -[TKEvent name]
000039b8 s -[TKEvent name].eh
00000ce0 t -[TKEvent setDestinationState:]
00003a44 s -[TKEvent setDestinationState:].eh
00000f10 t -[TKEvent setDidFireEventBlock:]
00003af4 s -[TKEvent setDidFireEventBlock:].eh
00000bc0 t -[TKEvent setName:]
000039d4 s -[TKEvent setName:].eh
00000d70 t -[TKEvent setShouldFireEventBlock:]
00003a7c s -[TKEvent setShouldFireEventBlock:].eh
00000c60 t -[TKEvent setSourceStates:]
00003a0c s -[TKEvent setSourceStates:].eh
00000e40 t -[TKEvent setWillFireEventBlock:]
00003ab8 s -[TKEvent setWillFireEventBlock:].eh
00000d20 t -[TKEvent shouldFireEventBlock]
00003a60 s -[TKEvent shouldFireEventBlock].eh
00000c10 t -[TKEvent sourceStates]
000039f0 s -[TKEvent sourceStates].eh
00000df0 t -[TKEvent willFireEventBlock]
00003a9c s -[TKEvent willFireEventBlock].eh
000038e4 s EH_frame0
U _NSInvalidArgumentException
U _NSStringFromClass
U _OBJC_CLASS_$_NSException
U _OBJC_CLASS_$_NSMutableString
U _OBJC_CLASS_$_NSObject
U _OBJC_CLASS_$_NSString
000030fc S _OBJC_CLASS_$_TKEvent
00002d68 S _OBJC_IVAR_$_TKEvent._destinationState
00002d74 S _OBJC_IVAR_$_TKEvent._didFireEventBlock
00002d60 S _OBJC_IVAR_$_TKEvent._name
00002d6c S _OBJC_IVAR_$_TKEvent._shouldFireEventBlock
00002d64 S _OBJC_IVAR_$_TKEvent._sourceStates
00002d70 S _OBJC_IVAR_$_TKEvent._willFireEventBlock
U _OBJC_METACLASS_$_NSObject
000030e8 S _OBJC_METACLASS_$_TKEvent
000003c0 t _TKDescribeSourceStates
0000393c s _TKDescribeSourceStates.eh
U __NSConcreteStackBlock
U ___CFConstantStringClassReference
000010a0 t ___TKDescribeSourceStates_block_invoke
00003b34 s ___TKDescribeSourceStates_block_invoke.eh
00003110 s ___block_descriptor_tmp
00001240 t ___copy_helper_block_
00003b54 s ___copy_helper_block_.eh
000012b0 t ___destroy_helper_block_
00003b74 s ___destroy_helper_block_.eh
U __objc_empty_cache
U _objc_autoreleaseReturnValue
U _objc_getProperty
U _objc_msgSend
U _objc_release
U _objc_retain
U _objc_retainAutoreleasedReturnValue
U _objc_setProperty_nonatomic_copy
U _objc_storeStrong
00002adc s l_.str
00002c87 s l_.str100
00002c8d s l_.str102
00002c90 s l_.str104
00002b21 s l_.str14
00002b4a s l_.str28
00002afc s l_.str3
00002b4f s l_.str32
00002b5c s l_.str34
00002c7c s l_.str93
00002c86 s l_.str98
00002e40 s l_OBJC_$_CLASS_METHODS_TKEvent
00002ed4 s l_OBJC_$_INSTANCE_METHODS_TKEvent
00002fa8 s l_OBJC_$_INSTANCE_VARIABLES_TKEvent
00003028 s l_OBJC_$_PROP_LIST_TKEvent
00002e54 s l_OBJC_$_PROTOCOL_INSTANCE_METHODS_NSCoding
00002e80 s l_OBJC_$_PROTOCOL_INSTANCE_METHODS_NSCopying
00002e78 s l_OBJC_$_PROTOCOL_METHOD_TYPES_NSCoding
00002e98 s l_OBJC_$_PROTOCOL_METHOD_TYPES_NSCopying
00002e9c s l_OBJC_CLASS_PROTOCOLS_$_TKEvent
00003060 s l_OBJC_CLASS_RO_$_TKEvent
000030e0 S l_OBJC_LABEL_PROTOCOL_$_NSCoding
000030e4 S l_OBJC_LABEL_PROTOCOL_$_NSCopying
00002eac s l_OBJC_METACLASS_RO_$_TKEvent
00003088 S l_OBJC_PROTOCOL_$_NSCoding
000030b4 S l_OBJC_PROTOCOL_$_NSCopying
libPods-Unit Tests-TransitionKit.a(TKState.o):
00000000 t +[TKState stateWithName:]
00002714 s +[TKState stateWithName:].eh
00000a30 t -[TKState .cxx_destruct]
000028d8 s -[TKState .cxx_destruct].eh
00000210 t -[TKState copyWithZone:]
00002754 s -[TKState copyWithZone:].eh
00000130 t -[TKState description]
00002734 s -[TKState description].eh
000007c0 t -[TKState didEnterStateBlock]
00002824 s -[TKState didEnterStateBlock].eh
00000960 t -[TKState didExitStateBlock]
0000289c s -[TKState didExitStateBlock].eh
00000590 t -[TKState encodeWithCoder:]
00002790 s -[TKState encodeWithCoder:].eh
00000450 t -[TKState initWithCoder:]
00002770 s -[TKState initWithCoder:].eh
00000650 t -[TKState name]
000027b0 s -[TKState name].eh
00000810 t -[TKState setDidEnterStateBlock:]
00002840 s -[TKState setDidEnterStateBlock:].eh
000009b0 t -[TKState setDidExitStateBlock:]
000028b8 s -[TKState setDidExitStateBlock:].eh
000006a0 t -[TKState setName:]
000027cc s -[TKState setName:].eh
00000740 t -[TKState setWillEnterStateBlock:]
00002804 s -[TKState setWillEnterStateBlock:].eh
000008e0 t -[TKState setWillExitStateBlock:]
0000287c s -[TKState setWillExitStateBlock:].eh
000006f0 t -[TKState willEnterStateBlock]
000027e8 s -[TKState willEnterStateBlock].eh
00000890 t -[TKState willExitStateBlock]
00002860 s -[TKState willExitStateBlock].eh
000026fc s EH_frame0
U _NSInvalidArgumentException
U _NSStringFromClass
U _OBJC_CLASS_$_NSException
U _OBJC_CLASS_$_NSObject
U _OBJC_CLASS_$_NSString
00001db8 S _OBJC_CLASS_$_TKState
00001de8 S _OBJC_IVAR_$_TKState._didEnterStateBlock
00001df0 S _OBJC_IVAR_$_TKState._didExitStateBlock
00001de0 S _OBJC_IVAR_$_TKState._name
00001de4 S _OBJC_IVAR_$_TKState._willEnterStateBlock
00001dec S _OBJC_IVAR_$_TKState._willExitStateBlock
U _OBJC_METACLASS_$_NSObject
00001dcc S _OBJC_METACLASS_$_TKState
U ___CFConstantStringClassReference
U __objc_empty_cache
U _objc_autoreleaseReturnValue
U _objc_getProperty
U _objc_msgSend
U _objc_release
U _objc_retain
U _objc_retainAutoreleasedReturnValue
U _objc_setProperty_nonatomic_copy
U _objc_storeStrong
00001c78 s l_.str
00001ca1 s l_.str37
00001c94 s l_.str9
00001e90 s l_OBJC_$_CLASS_METHODS_TKState
00001f24 s l_OBJC_$_INSTANCE_METHODS_TKState
00001fe0 s l_OBJC_$_INSTANCE_VARIABLES_TKState
00002050 s l_OBJC_$_PROP_LIST_TKState
00001ea4 s l_OBJC_$_PROTOCOL_INSTANCE_METHODS_NSCoding
00001ed0 s l_OBJC_$_PROTOCOL_INSTANCE_METHODS_NSCopying
00001ec8 s l_OBJC_$_PROTOCOL_METHOD_TYPES_NSCoding
00001ee8 s l_OBJC_$_PROTOCOL_METHOD_TYPES_NSCopying
00001eec s l_OBJC_CLASS_PROTOCOLS_$_TKState
00002080 s l_OBJC_CLASS_RO_$_TKState
00002100 S l_OBJC_LABEL_PROTOCOL_$_NSCoding
00002104 S l_OBJC_LABEL_PROTOCOL_$_NSCopying
00001efc s l_OBJC_METACLASS_RO_$_TKState
000020a8 S l_OBJC_PROTOCOL_$_NSCoding
000020d4 S l_OBJC_PROTOCOL_$_NSCopying
libPods-Unit Tests-TransitionKit.a(TKStateMachine.o):
00000000 t +[TKStateMachine keyPathsForValuesAffectingValueForKey:]
00008d68 s +[TKStateMachine keyPathsForValuesAffectingValueForKey:].eh
00004c20 t -[TKStateMachine .cxx_destruct]
0000911c s -[TKStateMachine .cxx_destruct].eh
00002140 t -[TKStateMachine activate]
00008f28 s -[TKStateMachine activate].eh
000014e0 t -[TKStateMachine addEvent:]
00008ec8 s -[TKStateMachine addEvent:].eh
00001b60 t -[TKStateMachine addEvents:]
00008ee8 s -[TKStateMachine addEvents:].eh
000008d0 t -[TKStateMachine addState:]
00008e28 s -[TKStateMachine addState:].eh
00000bb0 t -[TKStateMachine addStates:]
00008e48 s -[TKStateMachine addStates:].eh
000024f0 t -[TKStateMachine canFireEvent:]
00008f48 s -[TKStateMachine canFireEvent:].eh
00003f40 t -[TKStateMachine copyWithZone:]
00008fc8 s -[TKStateMachine copyWithZone:].eh
000049f0 t -[TKStateMachine currentState]
00009004 s -[TKStateMachine currentState].eh
00000400 t -[TKStateMachine description]
00008da8 s -[TKStateMachine description].eh
00003d20 t -[TKStateMachine encodeWithCoder:]
00008fa8 s -[TKStateMachine encodeWithCoder:].eh
00001e10 t -[TKStateMachine eventNamed:]
00008f08 s -[TKStateMachine eventNamed:].eh
00001450 t -[TKStateMachine events]
00008ea8 s -[TKStateMachine events].eh
000027e0 t -[TKStateMachine fireEvent:userInfo:error:]
00008f68 s -[TKStateMachine fireEvent:userInfo:error:].eh
00003a30 t -[TKStateMachine initWithCoder:]
00008f88 s -[TKStateMachine initWithCoder:].eh
00000260 t -[TKStateMachine init]
00008d88 s -[TKStateMachine init].eh
000049c0 t -[TKStateMachine initialState]
00008fe8 s -[TKStateMachine initialState].eh
00004b40 t -[TKStateMachine isActive]
000090ac s -[TKStateMachine isActive].eh
00001190 t -[TKStateMachine isInState:]
00008e88 s -[TKStateMachine isInState:].eh
00004bb0 t -[TKStateMachine lock]
000090e4 s -[TKStateMachine lock].eh
00004ad0 t -[TKStateMachine mutableEvents]
00009074 s -[TKStateMachine mutableEvents].eh
00004a60 t -[TKStateMachine mutableStates]
0000903c s -[TKStateMachine mutableStates].eh
00004b70 t -[TKStateMachine setActive:]
000090c8 s -[TKStateMachine setActive:].eh
00004a20 t -[TKStateMachine setCurrentState:]
00009020 s -[TKStateMachine setCurrentState:].eh
00000770 t -[TKStateMachine setInitialState:]
00008de8 s -[TKStateMachine setInitialState:].eh
00004be0 t -[TKStateMachine setLock:]
00009100 s -[TKStateMachine setLock:].eh
00004b00 t -[TKStateMachine setMutableEvents:]
00009090 s -[TKStateMachine setMutableEvents:].eh
00004a90 t -[TKStateMachine setMutableStates:]
00009058 s -[TKStateMachine setMutableStates:].eh
00000e60 t -[TKStateMachine stateNamed:]
00008e68 s -[TKStateMachine stateNamed:].eh
00000840 t -[TKStateMachine states]
00008e08 s -[TKStateMachine states].eh
00008d50 s EH_frame0
U _NSInternalInconsistencyException
U _NSInvalidArgumentException
U _NSLocalizedDescriptionKey
U _NSLocalizedFailureReasonErrorKey
U _NSStringFromClass
U _OBJC_CLASS_$_NSDictionary
U _OBJC_CLASS_$_NSError
U _OBJC_CLASS_$_NSException
U _OBJC_CLASS_$_NSMutableArray
U _OBJC_CLASS_$_NSMutableDictionary
U _OBJC_CLASS_$_NSMutableSet
U _OBJC_CLASS_$_NSNotificationCenter
U _OBJC_CLASS_$_NSObject
U _OBJC_CLASS_$_NSRecursiveLock
U _OBJC_CLASS_$_NSSet
U _OBJC_CLASS_$_NSString
U _OBJC_CLASS_$_TKEvent
U _OBJC_CLASS_$_TKState
00007704 S _OBJC_CLASS_$_TKStateMachine
U _OBJC_CLASS_$_TKTransition
00007d84 S _OBJC_IVAR_$_TKStateMachine._active
00007d78 S _OBJC_IVAR_$_TKStateMachine._currentState
00007d74 S _OBJC_IVAR_$_TKStateMachine._initialState
00007d88 S _OBJC_IVAR_$_TKStateMachine._lock
00007d80 S _OBJC_IVAR_$_TKStateMachine._mutableEvents
00007d7c S _OBJC_IVAR_$_TKStateMachine._mutableStates
U _OBJC_METACLASS_$_NSObject
000076f0 S _OBJC_METACLASS_$_TKStateMachine
000076d8 S _TKErrorDomain
00000680 t _TKQuoteString
00008dc8 s _TKQuoteString.eh
000076e8 S _TKStateMachineDidChangeStateEventUserInfoKey
000076e4 S _TKStateMachineDidChangeStateNewStateUserInfoKey
000076dc S _TKStateMachineDidChangeStateNotification
000076e0 S _TKStateMachineDidChangeStateOldStateUserInfoKey
000076ec S _TKStateMachineIsImmutableException
U ___CFConstantStringClassReference
U ___stack_chk_fail
U ___stack_chk_guard
U __objc_empty_cache
U _memset
00008d37 s _memset$stub
U _objc_autorelease
U _objc_autoreleaseReturnValue
U _objc_enumerationMutation
U _objc_msgSend
U _objc_msgSendSuper2
U _objc_release
U _objc_retain
U _objc_retainAutoreleasedReturnValue
U _objc_storeStrong
00006eb0 s l_.str
00006ed6 s l_.str1
0000710f s l_.str101
0000718d s l_.str107
00006f30 s l_.str11
000071bb s l_.str122
00007225 s l_.str126
00007245 s l_.str130
000072c7 s l_.str132
000072cc s l_.str136
000072cf s l_.str140
00006f37 s l_.str15
00007301 s l_.str153
0000735e s l_.str155
0000737e s l_.str177
0000738b s l_.str181
00007398 s l_.str183
00006f45 s l_.str21
00006f4c s l_.str23
000074be s l_.str251
00006eff s l_.str3
00006f5a s l_.str41
00006f03 s l_.str5
00006faa s l_.str59
00006fae s l_.str61
00006fb1 s l_.str66
00006f07 s l_.str7
00006fff s l_.str75
00007034 s l_.str79
00007058 s l_.str89
00006f0d s l_.str9
000070c1 s l_.str91
000070e0 s l_.str95
00007e68 s l_OBJC_$_CLASS_METHODS_TKStateMachine
00007efc s l_OBJC_$_INSTANCE_METHODS_TKStateMachine
0000806c s l_OBJC_$_INSTANCE_VARIABLES_TKStateMachine
000080f0 s l_OBJC_$_PROP_LIST_TKStateMachine
00007e7c s l_OBJC_$_PROTOCOL_INSTANCE_METHODS_NSCoding
00007ea8 s l_OBJC_$_PROTOCOL_INSTANCE_METHODS_NSCopying
00007ea0 s l_OBJC_$_PROTOCOL_METHOD_TYPES_NSCoding
00007ec0 s l_OBJC_$_PROTOCOL_METHOD_TYPES_NSCopying
00007ec4 s l_OBJC_CLASS_PROTOCOLS_$_TKStateMachine
00008138 s l_OBJC_CLASS_RO_$_TKStateMachine
000081b8 S l_OBJC_LABEL_PROTOCOL_$_NSCoding
000081bc S l_OBJC_LABEL_PROTOCOL_$_NSCopying
00007ed4 s l_OBJC_METACLASS_RO_$_TKStateMachine
00008160 S l_OBJC_PROTOCOL_$_NSCoding
0000818c S l_OBJC_PROTOCOL_$_NSCopying
libPods-Unit Tests-TransitionKit.a(TKTransition.o):
00000000 t +[TKTransition transitionForEvent:fromState:inStateMachine:userInfo:]
00001940 s +[TKTransition transitionForEvent:fromState:inStateMachine:userInfo:].eh
00000460 t -[TKTransition .cxx_destruct]
00001a5c s -[TKTransition .cxx_destruct].eh
000001f0 t -[TKTransition destinationState]
00001960 s -[TKTransition destinationState].eh
00000270 t -[TKTransition event]
0000197c s -[TKTransition event].eh
000002a0 t -[TKTransition setEvent:]
00001998 s -[TKTransition setEvent:].eh
00000310 t -[TKTransition setSourceState:]
000019d0 s -[TKTransition setSourceState:].eh
00000380 t -[TKTransition setStateMachine:]
00001a08 s -[TKTransition setStateMachine:].eh
00000410 t -[TKTransition setUserInfo:]
00001a40 s -[TKTransition setUserInfo:].eh
000002e0 t -[TKTransition sourceState]
000019b4 s -[TKTransition sourceState].eh
00000350 t -[TKTransition stateMachine]
000019ec s -[TKTransition stateMachine].eh
000003c0 t -[TKTransition userInfo]
00001a24 s -[TKTransition userInfo].eh
00001928 s EH_frame0
U _OBJC_CLASS_$_NSObject
00001414 S _OBJC_CLASS_$_TKTransition
00001208 S _OBJC_IVAR_$_TKTransition._event
0000120c S _OBJC_IVAR_$_TKTransition._sourceState
00001210 S _OBJC_IVAR_$_TKTransition._stateMachine
00001214 S _OBJC_IVAR_$_TKTransition._userInfo
U _OBJC_METACLASS_$_NSObject
00001400 S _OBJC_METACLASS_$_TKTransition
U __objc_empty_cache
U _objc_autoreleaseReturnValue
U _objc_getProperty
U _objc_msgSend
U _objc_release
U _objc_retain
U _objc_retainAutoreleasedReturnValue
U _objc_setProperty_nonatomic_copy
U _objc_storeStrong
00001290 s l_OBJC_$_CLASS_METHODS_TKTransition
000012cc s l_OBJC_$_INSTANCE_METHODS_TKTransition
0000134c s l_OBJC_$_INSTANCE_VARIABLES_TKTransition
000013a8 s l_OBJC_$_PROP_LIST_TKTransition
000013d8 s l_OBJC_CLASS_RO_$_TKTransition
000012a4 s l_OBJC_METACLASS_RO_$_TKTransition
``
from cocoapods-packager.
The problem is that since Objective-C has a dynamic runtime, we cannot reliably know if we’ve renamed everything. E.g.
[object performSelector:NSStringFromSelector([NSString stringWithFormat:@"perform%@", action])];
from cocoapods-packager.
We actually wouldn't need to rename selectors, since they are uniqued. Just classes and protocols and exported c function names.
-Samuel E. Giddins
On May 16, 2014, at 12:45 PM, Eloy Durán [email protected] wrote:
The problem is that since Objective-C has a dynamic runtime, we cannot reliably know if we’ve renamed everything. E.g.
[object performSelector:NSStringFromSelector([NSString stringWithFormat:@"perform%@", action])];
—
Reply to this email directly or view it on GitHub.
from cocoapods-packager.
@segiddins Multiple methods on the same class (from e.g. categories) with the same selector would still pose a problem.
from cocoapods-packager.
I don’t think you actually need to rename methods except for those exported on categories. And it would be the responsibility of whoever is creating the package to ensure that it works as intended
from cocoapods-packager.
it would be the responsibility of whoever is creating the package to ensure that it works as intended
While this is definitely true, it means we cannot build such a package which is guaranteed to work out of the box. I’m slightly afraid that that will lead to people doing the wrong thing.
Having said that, I don’t see an alternative, and it would indeed be great if we can automate it as much as possible. I guess time will have to tell.
from cocoapods-packager.
Never used it in practice so not sure it applies here, but wouldn't it be a use case where @compatibility_alias
could be useful?
from cocoapods-packager.
@AliSoftware Nope, that would make both names be usable in the runtime to refer to the same class instance.
from cocoapods-packager.
I think if you invoke the packager with the --mangle-dependency-symbols
(or whatever) then we just emit a warning indicating that symbol integrity cannot be programmatically guaranteed. In practice the only folks who will be doing this are those building closed source libraries with open source dependencies. They should have a handle on their dependencies and have a commercial grade QA process for the binaries anyway.
The concern around category methods really doesn’t bother me much. I’m don’t have any category methods introduced in any of my dependencies. IMHO category methods have been overused in the community and should be avoided if you are shipping closed source bits. And if you do have them and follow prefixing conventions then they’ll be easy to alias away. That should narrow the dynamic invocation concerns to category methods that are dynamically invoked from selectors composed via strings. That’s a pretty narrow corner.
from cocoapods-packager.
Renamed this to reflect that this is actually just about implementing the symbol mangling
from cocoapods-packager.
Here is my Podspec. Given this, I want to be able to generate a framework, static library + headers, and a Podspec for installing the public version of the bits:
Pod::Spec.new do |s|
s.name = 'LayerKit'
s.version = '0.50.0'
s.license = 'Commercial'
s.summary = 'LayerKit is the iOS client interface for the Layer communications cloud.'
s.homepage = 'https://github.com/layerhq/LayerKit'
s.authors = { 'Blake Watters' => '[email protected]', 'Klemen Verdnik' => '[email protected]' }
s.source = { :git => 'https://github.com/layerhq/LayerKit.git', :tag => "v#{s.version}" }
s.requires_arc = true
s.ios.deployment_target = '7.0'
s.source_files = 'Code/**/*.{h,m}'
s.public_header_files = 'Code/*.h'
s.private_header_files = 'Code/Private/**/*.h'
s.prefix_header_file = 'Code/Private/LayerKit-Prefix.pch'
s.libraries = 'sqlite3', 'z'
s.ios.frameworks = 'CFNetwork', 'Security', 'MobileCoreServices', 'SystemConfiguration'
s.prefix_header_contents = <<-PCH
#import <DDLog.h>
#include "LYRLog.h"
PCH
s.ios.deployment_target = '5.0'
s.osx.deployment_target = '10.7'
# Dependencies
s.dependency 'CocoaSPDY', '~> 1.0.1'
s.dependency 'CocoaLumberjack', '~> 1.8.1'
s.dependency 'FMDB', '~> 2.2'
s.dependency 'layer-thrift', '~> 0.50.0'
s.dependency 'TransitionKit', '~> 2.1.0'
end
from cocoapods-packager.
Is this still needed with the new modules stuff?
from cocoapods-packager.
I'm pretty sure it is.
from cocoapods-packager.
Implemented in 4259238
from cocoapods-packager.
I use cocoapods-packager
v1.1.0 and Cocoapods
v0.35.0, but I found the symbols still exist.
My pod spec:
s.dependency 'MTDates', '0.14.0'
I run pod package testFramework.podspec
, then I found the size of binary is 1MB!!
I use the nm
to test it.
$ nm TestFramework
TestFramework(NSDate+MTDates.o):
0000000000008fae t +[NSDate(MTDates) mt_calendar]
0000000000009065 t +[NSDate(MTDates) mt_components]
0000000000001234 t +[NSDate(MTDates) mt_dateFromComponents:]
00000000000004e7 t +[NSDate(MTDates) mt_dateFromISOString:]
0000000000000865 t +[NSDate(MTDates) mt_dateFromString:usingFormat:]
00000000000009e6 t +[NSDate(MTDates) mt_dateFromYear:month:day:]
0000000000000adb t +[NSDate(MTDates) mt_dateFromYear:month:day:hour:minute:]
0000000000000bc5 t +[NSDate(MTDates) mt_dateFromYear:month:day:hour:minute:second:]
0000000000000d2a t +[NSDate(MTDates) mt_dateFromYear:week:weekday:]
0000000000000e1f t +[NSDate(MTDates) mt_dateFromYear:week:weekday:hour:minute:]
0000000000000f09 t +[NSDate(MTDates) mt_dateFromYear:week:weekday:hour:minute:second:]
00000000000084c9 t +[NSDate(MTDates) mt_datesCollectionFromDate:untilDate:]
0000000000001562 t +[NSDate(MTDates) mt_endOfToday]
00000000000016e4 t +[NSDate(MTDates) mt_endOfTomorrow]
0000000000001623 t +[NSDate(MTDates) mt_endOfYesterday]
0000000000008dd5 t +[NSDate(MTDates) mt_maxValueForUnit:]
0000000000008d1c t +[NSDate(MTDates) mt_minValueForUnit:]
0000000000001aa9 t +[NSDate(MTDates) mt_monthlySymbols]
0000000000008e92 t +[NSDate(MTDates) mt_prepareDefaults]
000000000000921f t +[NSDate(MTDates) mt_reset]
000000000000017b t +[NSDate(MTDates) mt_setCalendarIdentifier:]
00000000000003bb t +[NSDate(MTDates) mt_setFirstDayOfWeek:]
00000000000073be t +[NSDate(MTDates) mt_setFormatterDateStyle:]
0000000000007479 t +[NSDate(MTDates) mt_setFormatterTimeStyle:]
000000000000023b t +[NSDate(MTDates) mt_setLocale:]
00000000000002fb t +[NSDate(MTDates) mt_setTimeZone:]
0000000000000451 t +[NSDate(MTDates) mt_setWeekNumberingSystem:]
0000000000000000 t +[NSDate(MTDates) mt_sharedFormatter]
00000000000019e8 t +[NSDate(MTDates) mt_shortMonthlySymbols]
00000000000017a5 t +[NSDate(MTDates) mt_shortWeekdaySymbols]
000000000000131f t +[NSDate(MTDates) mt_startOfToday]
00000000000014a1 t +[NSDate(MTDates) mt_startOfTomorrow]
00000000000013e0 t +[NSDate(MTDates) mt_startOfYesterday]
0000000000001b6a t +[NSDate(MTDates) mt_veryShortMonthlySymbols]
0000000000001927 t +[NSDate(MTDates) mt_veryShortWeekdaySymbols]
0000000000001866 t +[NSDate(MTDates) mt_weekdaySymbols]
00000000000092d8 t +[NSDate(MTDates) sharedRecursiveLock]
0000000000021800 b +[NSDate(MTDates) sharedRecursiveLock].lock
0000000000021808 b +[NSDate(MTDates) sharedRecursiveLock].onceToken
0000000000002568 t -[NSDate(MTDates) mt_components]
000000000000106e t -[NSDate(MTDates) mt_dateByAddingYears:months:weeks:days:hours:minutes:seconds:]
0000000000004c9f t -[NSDate(MTDates) mt_dateDaysAfter:]
0000000000004bce t -[NSDate(MTDates) mt_dateDaysBefore:]
00000000000056e2 t -[NSDate(MTDates) mt_dateHoursAfter:]
0000000000005615 t -[NSDate(MTDates) mt_dateHoursBefore:]
0000000000006138 t -[NSDate(MTDates) mt_dateMinutesAfter:]
000000000000606b t -[NSDate(MTDates) mt_dateMinutesBefore:]
0000000000003797 t -[NSDate(MTDates) mt_dateMonthsAfter:]
00000000000036c5 t -[NSDate(MTDates) mt_dateMonthsBefore:]
00000000000067c1 t -[NSDate(MTDates) mt_dateSecondsAfter:]
00000000000066f4 t -[NSDate(MTDates) mt_dateSecondsBefore:]
0000000000004247 t -[NSDate(MTDates) mt_dateWeeksAfter:]
0000000000004176 t -[NSDate(MTDates) mt_dateWeeksBefore:]
0000000000002d74 t -[NSDate(MTDates) mt_dateYearsAfter:]
0000000000002ca2 t -[NSDate(MTDates) mt_dateYearsBefore:]
0000000000002131 t -[NSDate(MTDates) mt_dayOfMonth]
0000000000001de9 t -[NSDate(MTDates) mt_dayOfYear]
00000000000089c3 t -[NSDate(MTDates) mt_daysInCurrentMonth]
0000000000008b2b t -[NSDate(MTDates) mt_daysInNextMonth]
0000000000008a77 t -[NSDate(MTDates) mt_daysInPreviousMonth]
0000000000004d6d t -[NSDate(MTDates) mt_daysSinceDate:]
0000000000004e77 t -[NSDate(MTDates) mt_daysUntilDate:]
000000000000488f t -[NSDate(MTDates) mt_endOfCurrentDay]
00000000000052e0 t -[NSDate(MTDates) mt_endOfCurrentHour]
0000000000005d36 t -[NSDate(MTDates) mt_endOfCurrentMinute]
0000000000003385 t -[NSDate(MTDates) mt_endOfCurrentMonth]
0000000000003e37 t -[NSDate(MTDates) mt_endOfCurrentWeek]
0000000000002962 t -[NSDate(MTDates) mt_endOfCurrentYear]
0000000000004979 t -[NSDate(MTDates) mt_endOfNextDay]
00000000000053c7 t -[NSDate(MTDates) mt_endOfNextHour]
0000000000005e1d t -[NSDate(MTDates) mt_endOfNextMinute]
000000000000346f t -[NSDate(MTDates) mt_endOfNextMonth]
0000000000003f21 t -[NSDate(MTDates) mt_endOfNextWeek]
0000000000002a4c t -[NSDate(MTDates) mt_endOfNextYear]
00000000000047cf t -[NSDate(MTDates) mt_endOfPreviousDay]
0000000000005220 t -[NSDate(MTDates) mt_endOfPreviousHour]
0000000000005c76 t -[NSDate(MTDates) mt_endOfPreviousMinute]
00000000000032c5 t -[NSDate(MTDates) mt_endOfPreviousMonth]
0000000000003d77 t -[NSDate(MTDates) mt_endOfPreviousWeek]
00000000000028a2 t -[NSDate(MTDates) mt_endOfPreviousYear]
0000000000002210 t -[NSDate(MTDates) mt_hourOfDay]
000000000000861e t -[NSDate(MTDates) mt_hoursInCurrentDayAsDatesCollection]
00000000000057ac t -[NSDate(MTDates) mt_hoursSinceDate:]
00000000000058b6 t -[NSDate(MTDates) mt_hoursUntilDate:]
0000000000008bdf t -[NSDate(MTDates) mt_inTimeZone:]
0000000000006a9f t -[NSDate(MTDates) mt_isAfter:]
0000000000006b5f t -[NSDate(MTDates) mt_isBefore:]
00000000000072a3 t -[NSDate(MTDates) mt_isBetweenDate:andDate:]
0000000000008795 t -[NSDate(MTDates) mt_isInAM]
0000000000006c1f t -[NSDate(MTDates) mt_isOnOrAfter:]
0000000000006cf1 t -[NSDate(MTDates) mt_isOnOrBefore:]
000000000000882e t -[NSDate(MTDates) mt_isStartOfAnHour]
000000000000707b t -[NSDate(MTDates) mt_isWithinSameDay:]
000000000000717e t -[NSDate(MTDates) mt_isWithinSameHour:]
0000000000006e8f t -[NSDate(MTDates) mt_isWithinSameMonth:]
0000000000006f70 t -[NSDate(MTDates) mt_isWithinSameWeek:]
0000000000006dc3 t -[NSDate(MTDates) mt_isWithinSameYear:]
00000000000022ef t -[NSDate(MTDates) mt_minuteOfHour]
0000000000006202 t -[NSDate(MTDates) mt_minutesSinceDate:]
000000000000630c t -[NSDate(MTDates) mt_minutesUntilDate:]
0000000000002052 t -[NSDate(MTDates) mt_monthOfYear]
0000000000003866 t -[NSDate(MTDates) mt_monthsSinceDate:]
0000000000003970 t -[NSDate(MTDates) mt_monthsUntilDate:]
0000000000004b04 t -[NSDate(MTDates) mt_oneDayNext]
0000000000004a39 t -[NSDate(MTDates) mt_oneDayPrevious]
000000000000554e t -[NSDate(MTDates) mt_oneHourNext]
0000000000005487 t -[NSDate(MTDates) mt_oneHourPrevious]
0000000000005fa4 t -[NSDate(MTDates) mt_oneMinuteNext]
0000000000005edd t -[NSDate(MTDates) mt_oneMinutePrevious]
00000000000035fb t -[NSDate(MTDates) mt_oneMonthNext]
000000000000352f t -[NSDate(MTDates) mt_oneMonthPrevious]
000000000000662d t -[NSDate(MTDates) mt_oneSecondNext]
0000000000006566 t -[NSDate(MTDates) mt_oneSecondPrevious]
00000000000040ac t -[NSDate(MTDates) mt_oneWeekNext]
0000000000003fe1 t -[NSDate(MTDates) mt_oneWeekPrevious]
0000000000002bd8 t -[NSDate(MTDates) mt_oneYearNext]
0000000000002b0c t -[NSDate(MTDates) mt_oneYearPrevious]
00000000000023ce t -[NSDate(MTDates) mt_secondOfMinute]
00000000000024ad t -[NSDate(MTDates) mt_secondsIntoDay]
000000000000688b t -[NSDate(MTDates) mt_secondsSinceDate:]
0000000000006995 t -[NSDate(MTDates) mt_secondsUntilDate:]
00000000000045e9 t -[NSDate(MTDates) mt_startOfCurrentDay]
0000000000005041 t -[NSDate(MTDates) mt_startOfCurrentHour]
0000000000005a80 t -[NSDate(MTDates) mt_startOfCurrentMinute]
0000000000003117 t -[NSDate(MTDates) mt_startOfCurrentMonth]
0000000000003b3a t -[NSDate(MTDates) mt_startOfCurrentWeek]
00000000000026f4 t -[NSDate(MTDates) mt_startOfCurrentYear]
000000000000470f t -[NSDate(MTDates) mt_startOfNextDay]
0000000000005160 t -[NSDate(MTDates) mt_startOfNextHour]
0000000000005bb6 t -[NSDate(MTDates) mt_startOfNextMinute]
0000000000003205 t -[NSDate(MTDates) mt_startOfNextMonth]
00000000000064be t -[NSDate(MTDates) mt_startOfNextSecond]
0000000000003cb7 t -[NSDate(MTDates) mt_startOfNextWeek]
00000000000027e2 t -[NSDate(MTDates) mt_startOfNextYear]
0000000000004529 t -[NSDate(MTDates) mt_startOfPreviousDay]
0000000000004f81 t -[NSDate(MTDates) mt_startOfPreviousHour]
00000000000059c0 t -[NSDate(MTDates) mt_startOfPreviousMinute]
0000000000003057 t -[NSDate(MTDates) mt_startOfPreviousMonth]
0000000000006416 t -[NSDate(MTDates) mt_startOfPreviousSecond]
0000000000003a7a t -[NSDate(MTDates) mt_startOfPreviousWeek]
0000000000002634 t -[NSDate(MTDates) mt_startOfPreviousYear]
00000000000079bf t -[NSDate(MTDates) mt_stringFromDateWithAMPMSymbol]
0000000000007bc0 t -[NSDate(MTDates) mt_stringFromDateWithFormat:localized:]
0000000000007913 t -[NSDate(MTDates) mt_stringFromDateWithFullMonth]
0000000000007b14 t -[NSDate(MTDates) mt_stringFromDateWithFullWeekdayTitle]
0000000000007e4e t -[NSDate(MTDates) mt_stringFromDateWithGreatestComponentsForSecondsPassed:]
0000000000008148 t -[NSDate(MTDates) mt_stringFromDateWithGreatestComponentsUntilDate:]
00000000000077a8 t -[NSDate(MTDates) mt_stringFromDateWithHourAndMinuteFormat:]
0000000000007cf6 t -[NSDate(MTDates) mt_stringFromDateWithISODateTime]
0000000000007867 t -[NSDate(MTDates) mt_stringFromDateWithShortMonth]
0000000000007a68 t -[NSDate(MTDates) mt_stringFromDateWithShortWeekdayTitle]
00000000000075fb t -[NSDate(MTDates) mt_stringValueWithDateStyle:timeStyle:]
0000000000007534 t -[NSDate(MTDates) mt_stringValue]
0000000000001eae t -[NSDate(MTDates) mt_weekOfMonth]
0000000000001d0a t -[NSDate(MTDates) mt_weekOfYear]
0000000000001f8d t -[NSDate(MTDates) mt_weekdayOfWeek]
000000000000890f t -[NSDate(MTDates) mt_weekdayStartOfCurrentMonth]
0000000000004315 t -[NSDate(MTDates) mt_weeksSinceDate:]
000000000000441f t -[NSDate(MTDates) mt_weeksUntilDate:]
0000000000001c2b t -[NSDate(MTDates) mt_year]
0000000000002e43 t -[NSDate(MTDates) mt_yearsSinceDate:]
0000000000002f4d t -[NSDate(MTDates) mt_yearsUntilDate:]
So the symbols still exist, and the dependency be packaged.
from cocoapods-packager.
I found the size of binary is same to the --no-mangle
.
from cocoapods-packager.
Indeed, categories cannot be mangled, otherwise they would extend a class that doesn't exist.
from cocoapods-packager.
I think the categories should be mangled.
I have a repo to manage all categories, and my libraries would dependency it.If the categories are not be mangled, I will get many conflict for the categories.
If the version of the categories is different, so I will find that some categories override the same name function categories.
from cocoapods-packager.
I'm not sure how symbol mangling works in cocoapods-packager
ATM, but what IMHO, one would expect:
- Methods in categories to be mangled, same as methods in classes of the pod, to avoid name conflicts on methods
- Categories applying to a class that is itself defined it the pod to have its related class it applies on mangled as well, as the class name itself will be mangled anyway
- Categories applying to a class that is defined outside a pod (typically one of Apple's class) not to mangle the class it applies on
So for example:
// Inside FooPod, before mangling:
@interface FooPod
- (void)baseMethod;
@end
@interface FooPod(MyCategory)
- (void)categoryMethod;
@end
@interface NSString(FooAdditions)
- (void)additionMethod
@end
Should end up compiled as:
// Inside FooPod, after mangling:
@interface ManglePrefix-FooPod
- (void)manglePrefix-baseMethod;
@end
@interface ManglePrefix-FooPod(MyCategory)
- (void)manglePrefix-categoryMethod;
@end
@interface NSString(FooAdditions)
- (void)manglePrefix-additionMethod
@end
from cocoapods-packager.
OK, I see the unmatched expectation now. The packager does not mangle selectors and will not be able to using the current approach (preprocessor defines). Personally, I don't think it is a good idea for libraries to contain categories, because conflict issues reach far beyond the packager. Nevertheless, I'll open a separate issue to document that this is currently not done.
from cocoapods-packager.
I found that if I build the library without the OTHER_LDFLAGS
in Pods.xcconfig
, the library will be compile well and without any dependency.
It said that I only need the HEADER_SEARCH_PATHS
, so every thing will be ok.
from cocoapods-packager.
Do nobody agree with me?
from cocoapods-packager.
Related Issues (20)
- pod package Generating dynamic framework fail HOT 3
- About the configuration of public Header file HOT 2
- Dependency ModuleMap generation error (.modulemap' not found / underlying Objective-C module not found) HOT 2
- A new plugin support package sdk to a framework
- how only support arm64 HOT 2
- can't open input file: Pods/build-sim/package.a (No such file or directory) HOT 3
- Optimization of copy resource
- ArgumentError - wrong number of arguments (given 3, expected 7..10) HOT 5
- ERROR: gem install cocoapods-packager
- How to resolve `Unable to determine swift version` HOT 3
- Module Map File not found HOT 3
- Error: have the same architectures (i386) and can't be in the same fat output file HOT 3
- not support m1 on mac
- fatal error: module map file 'xx.modulemap' not found HOT 3
- How to get only device architecture without simulator architecture HOT 1
- xcode14 BUILD FAILED HOT 11
- Install cocoapods-packager via Homebrew HOT 1
- 使用 pod package 生成静态 framework 失败
- lipo: can't open input file HOT 1
- Can not use "error: The armv7 architecture is deprecated. You should update your ARCHS build setting to remove the armv7 architecture. (in target 'GoogleToolboxForMac' from project 'Pods')" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocoapods-packager.