Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defpackage "XCODEBUILD-FILTER"
- (:use :cl))
- (in-package "XCODEBUILD-FILTER")
- (defvar *known-commands* (list "cd" "setenv"
- "CompileXIB" "CopyStringsFile"
- "CopyPlistFile" "CpResource"
- "ProcessInfoPlistFile" "builtin-infoPlistUtility"
- "ProcessPCH" "CompileC"
- "PhaseScriptExecution" "Touch"
- "GenerateDSYMFile" "Ld"))
- (defun line-begins (line tag)
- "Return t when the string in 'line' begins with the string in 'tag'."
- (when (eql 0 (search tag line))
- t))
- (defun empty-line? (line)
- "Return t when the string in 'line' is empty."
- (string-equal line ""))
- (defun line-command (line)
- "Get the first space separated substring from the string in 'line' and return the substring."
- (let ((pos (search " " line)))
- (when pos
- (subseq line 0 pos))))
- (defun known (command)
- "Return t when the string in 'command' is known."
- (member command *known-commands* :test #'string-equal))
- (with-open-file (out "/tmp/sexp"
- :direction :output
- :if-exists :overwrite
- :if-does-not-exist :create)
- (with-open-file (in "/Users/wg/xcodebuild-log" ; created via xcodebuild -sdk iphonesimulator4.2 -configuration Debug build>~/xcodebuild-log
- :direction :input)
- (let ((line nil)
- (mode 'initial)
- (node nil))
- (loop for line = (read-line in nil nil nil) do
- (null line
- (return))
- (setf line (string-trim " " line))
- (case mode
- (initial (when (line-begins line "Check dependencies") ; This tag was found by investigating the xcodebuild output.
- (setf mode 'begin)))
- (begin (if (empty-line? line)
- (let ((msgs (cdr node)))
- (when msgs
- (print (reverse msgs) out))
- (setf node nil)
- (setf mode 'end))
- (when (not (known (line-command line)))
- (push line node))))
- (end (when (not (empty-line? line))
- (when (not (known (line-command line)))
- (push line node))
- (setf mode 'begin))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement