Changeset 15092


Ignore:
Timestamp:
Nov 23, 2011, 11:35:43 PM (8 years ago)
Author:
rme
Message:

Convert Interface Builder files to .xib format. This requires
more work at build time, because .xib files must be compiled
into a deployable .nib file. Make additions to ide-bundle.lisp
to do this. (We use the ibtool program, which is installed as
part of Xcode.)

Put the .xib files (and other localizable resources) into
a new directory named en.lproj. This is what Xcode uses
when creating new projects. Delete the old English.lproj
directory and its contents.

Update the Info.plist template accordingly.

Location:
trunk/source/cocoa-ide
Files:
16 added
1 deleted
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/Info.plist-proto

    r14908 r15092  
    44<dict>
    55        <key>CFBundleDevelopmentRegion</key>
    6         <string>English</string>
     6        <string>en</string>
    77        <key>CFBundleDocumentTypes</key>
    88        <array>
  • trunk/source/cocoa-ide/ide-bundle.lisp

    r13034 r15092  
    1010;;; else.
    1111
     12(defvar *ibtool-program* "/Developer/usr/bin/ibtool")
     13
     14(defun compile-xib (xib &optional output-nib)
     15  (unless output-nib
     16    (setq output-nib (make-pathname :type "nib" :defaults xib)))
     17  (with-output-to-string (s)
     18    (let* ((nib-namestring (native-translated-namestring output-nib))
     19           (xib-namestring (native-translated-namestring xib))
     20           (p (run-program *ibtool-program*
     21                           (list "--errors" "--warnings" "--notices"
     22                                 "--output-format" "human-readable-text"
     23                                 "--compile" nib-namestring
     24                                 xib-namestring)
     25                           :output s
     26                           :error :output)))
     27      (multiple-value-bind (status exit-code)
     28          (external-process-status p)
     29        (unless (and (eq :exited status)
     30                     (zerop exit-code))
     31          (error "Error compiling xib file ~s:~%~a" xib
     32                 (or (describe-external-process-failure p "no ibtool?")
     33                     (get-output-stream-string s))))))))
     34
     35(defun process-nibs (src-contents-path dest-contents-path)
     36  (let* ((dest-dir (ensure-directory-pathname dest-contents-path))
     37         (src-dir (ensure-directory-pathname src-contents-path))
     38         (dest-nib-dir (merge-pathnames #p"Resources/en.lproj/"
     39                                        dest-dir))
     40         (src-nib-dir (merge-pathnames #p"Resources/en.lproj/"
     41                                       src-dir)))
     42    ;; process xib files
     43    (ensure-directories-exist dest-nib-dir)
     44    (format t "~&;building nib files...")
     45    (dolist (x (directory (merge-pathnames #p"*.xib" src-nib-dir)))
     46      (let ((dest (make-pathname :name (pathname-name x)
     47                                 :type "nib"
     48                                 :defaults dest-nib-dir)))
     49        (compile-xib x dest)))
     50    (format t "done.~%")))
     51
    1252(defun create-ide-bundle (bundle-path &key (source "ccl:cocoa-ide;ide-contents;")
    13                                            (source-ignore '(".svn" "cvs" ".cvsignore"))
     53                                           (source-ignore '(".svn" "cvs" ".cvsignore" "English.lproj" ".nib"))
    1454                                           (copy-headers *cocoa-application-copy-headers-p*)
    1555                                           (install-altconsole *cocoa-application-install-altconsole*)
     
    2666                           (and (> len 0)
    2767                                (or (eql (aref name (1- len)) #\~)
    28                                     (eql (aref name 0) #\#)))))))
     68                                    (eql (aref name 0) #\#))))))
     69                  (nib-p (p)
     70                    (let* ((s (car (last (pathname-directory p))))
     71                           (len (length s)))
     72                      (and (> len 4)
     73                           (string= ".nib" (subseq s (- len 4)))))))
     74             
    2975             (not (or (member (car (last (pathname-directory p))) source-ignore :test #'equalp)
    3076                      (backup-p (file-namestring p))
     77                      (nib-p p)
     78                      (equalp (pathname-type p) "xib")
     79                      (equalp (pathname-type p) "nib")
    3180                      (member (file-namestring p) source-ignore :test #'equalp))))))
    3281    (let* ((source-dir (ensure-directory-pathname source))
     
    3483           (contents-dir (subdir target-dir "Contents")))
    3584      (recursive-copy-directory source-dir contents-dir :if-exists if-exists :test #'ignore-test)
     85      (process-nibs source-dir contents-dir)
    3686      (when copy-headers
    3787        (let* ((subdirs (ccl::cdb-subdirectory-path))
Note: See TracChangeset for help on using the changeset viewer.