Insert Subversion revision number in Xcode

后端 未结 7 1620
花落未央
花落未央 2020-11-30 18:29

I would like to insert the current Subversion revision number (as reported by svnversion) into my Xcode project. I managed to insert the revision number into th

7条回答
  •  一整个雨季
    2020-11-30 18:54

    Another version, written in the Apple Script. Regexp for the previousValue could be changed, currently it supports only versions in XX.XX.XX format (major, minor, svn rev).

    Run by /usr/bin/osascript

    set myVersion to do shell script "svn info | grep \"^Revision:\""
    set myVersion to do shell script "echo " & quoted form of myVersion & "| sed 's/Revision: \\([0-9]\\)/\\1/'" as string
    
    set myFile to do shell script "echo ${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
    set theOutputFolder to myFile as string
    set thePListPath to POSIX path of (theOutputFolder & "Info.plist")
    tell application "System Events"
       tell property list file thePListPath
          tell contents
             set previousValue to value of property list item "CFBundleVersion"
    
             set previousValue to do shell script "echo " & quoted form of previousValue & "| sed 's/\\([0-9]*\\.[0-9]*\\)\\(\\.[0-9]*\\)*/\\1/'" as string
    
             set value of property list item "CFBundleVersion" to (previousValue & "." & myVersion)
          end tell
       end tell
    end tell
    

提交回复
热议问题