MobileNativeFoundation / XCLogParser

Tool to parse Xcode and xcodebuild logs stored in the xcactivitylog format
Apache License 2.0
1.73k stars 121 forks source link

xcactivitylog is not a valid xcactivitylog #52

Closed mobileben closed 4 years ago

mobileben commented 4 years ago

I've been testing some builds generated with xcodebuild. The command generally looks like:

xcodebuild -workspace Project.xcworkspace -scheme Project  -derivedDataPath 'd_d/Project' clean build -resultBundlePath testResult/Project.test_result

I've noticed that when I try and run xclogparser using the --derived_data argument, I get the following error:

Project/Logs/Build/UUID.xcactivitylog is not a valid xcactivitylog

If I run file on the xcactivitylog, it returns

gzip compressed data, original size modulo 2^32 1025420490 gzip compressed data, reserved method, ASCII, has CRC, encrypted, from FAT filesystem (MS-DOS, OS/2, NT), original size modulo 2^32 1025420490

I'm not quite too sure where the reserved method, ASCII, has CRC, encrypted, from FAT filesystem (MS-DOS, OS/2, NT) came from. It consistently builds this way.

BalestraPatrick commented 4 years ago

Does the same happen if you wait a while after the xcodebuild command returns before running xclogparser? We have noticed that sometimes Xcode/xcodebuild take a while to finish writing the log to disk, so if you try to parse it immediately after, xclogparser will not be able to read the file structure correctly since it hasn't been written fully yet.

mobileben commented 4 years ago

Hmm, that is interesting. I did see one case where the next day, I ran my script (which calls xclogparser) and is magically worked.

I've run a few tests with xcodebuild and those xcactivitylog files don't seem to work even if I try a few hours later. Doesn't seem to matter if I use -resultBundlePath or override the derived data. It has worked sometimes so I'm just not quite sure. These are quite large files. 1-5GB (what zip says it would uncompress if it could).

mobileben commented 4 years ago

BTW, I read your article regarding usage of Rome. Very interesting! Do you happen to know if there is an equivalent for Pods? Or maybe asked another way ... do you use pods at all or have you been able to use Carthage for all your dependencies?

BalestraPatrick commented 4 years ago

@mobileben There are some CocoaPods plugins to use binaries instead of rebuilding all the dependencies from source. Take a look at https://github.com/leavez/cocoapods-binary.

mobileben commented 4 years ago

@BalestraPatrick Cool thanks. I tried using it, though it seems to have some issues with some pods. Ideally I want to have us ditch pods altogether.

Just curious. Do you have internal libs/frameworks which are Carthage packages? And if so, how do you facilitate debugging or modifying it when used with the app? For example we are using private pods (these are locally linked and are committed in our monorepo). Right now the pods project file is included in the workspace. So this means that you essentially have access to all code in the Xcode project.

I'm trying to move us away from that and to prebuilts. However, due to how the app is built, many of those private pods more or less need to app in order to develop for. Do you have a similar circumstance and if so how do you work around this?

I'm working on a proof of concept of using xcodegen to build project files which by default will use prebuilts. But if you need say private pod A or B, it will include those as subprojects. Part of my plan is to move away from pods and to create Xcode projects for everything that can then be added to the app when one needs to debug.

BalestraPatrick commented 4 years ago

@mobileben That's one way of doing it. We don't really use Carthage or CocoaPods for internal code exactly for that reason.