Introduction to windows in IOS development environment

Source: Internet
Author: User
Tags diff patch sourcetree

1. XCode

Perference
General
Double Click Navigation-the default Double-Click Window will pop up the new Window (Use Seperate Window), which is different from vc. The main position and size of this Window are usually incoherent. Change to Same as Click, just like vc

Text Editing
Editing
While editing Automatically trim trailing whitespace (Remove trailing space)
Including whitespace-only lines)
This is actually what we normally code, but it may conflict with the patch after the old code is handed over. If you are used to it, we recommend that you do not check it.
Select Simplified Chinese (Mac OS) for Default text encoding)
Windows (CRLF) for Default line ending)
Convert existing files on save does not check

Make sure that the Code settings are consistent with those for windows. Do not change the settings for the baseline, otherwise, the diff of mac port will make the full screen of your diff file ^ M (there are two types of line tail formats in a single file)

Indentation
Prefer indent using: Tabs
Tab width: 4 spaces
Indent width: 4 space
Tab Key: Inserts tab charater
Line wrapping: Wrap Line to editor width check
Indent wrapped lines by: 4 space
Syntax-aware indenting is not checked and automatic modification is annoying, especially when you copy conflicting parts from the diff File

Key Bindings: Make sure that the Key is the same as vc/va. Alt + <-> and alt + o alt + m of va are not found. For other commonly used Key keys, modify as follows:

(\ Shift | Alt upper left arrow Home)

You have conflicted with the system shortcut key. You can choose System Preference Settings> keyboard shortcut to modify it.

By the way, there is a filter under Navigators (the column on the left), but sometimes you forget to find that the result is not found. Check whether the last filter keyword is left in it.

2. Version Management Tools

Svn:
Versions is unfortunately not free. It is a bit difficult to get the old version. in the upper left corner, click select. In revision, enter the version number and switch between After and Before. It is better to select the old version.
Hg/Git:
SourceTree is better than the MacHG stream, regardless of efficiency or usage habits, and is free of charge. Register a user on his official website and export a lensence file to the private network.

Text editing:
Sublimt Text2 is a very refreshing editor with many special functions. For me, it is mainly a shortcut key that can be used to change operations such as Copy. It supports syntax highlighting of various files and does not support GBK well, to add a plug-in. However, this plug-in slows down the opening of large files.

7z decompression:
7zX and so on seem to be all about to be thrown into the Dock, and then dragged and used. The efficiency of decompression with two large packages seems to be very poor, so I uploaded zip files to Mac now.

3. Version Synchronization

A) MacOS diff/patch

Because diff/patch is included in the mac, it is not necessary to copy the exe files of gnuwin32 (and those files are not supported due to different formats)
Modify the content in mydiff. bat and add mac-related filtering,-x. DS_Store-x *. xcworkspacedata-xxcuserdata, and change the original % 1 to $1 $2.
For exampleCopy codeThe Code is as follows: diff-Nur -- ignore-file-name-case-xDebug-xRelease-release-xRelease_Kalydo-xEnv-xEnvNormal-xEnvWeb-xpdb-xVTune-xboost-xstlport-xDXSDK-x. svn-x. hg-x *. hgignore-x. git-x. gitignore-x *. vsp-x *. upload SS-x *. swp-x *. ncb-x *. opt-x *. scc-x *. plg-x *. clw-x *. aps-x *. org-x *. orig-x *. rej-x *. rar-x *. administrator. user-x *. suo-x *. bak-x *. map-x *. ico-x *. vcproj. list-x *. vcproj. lnt-x. DS_Store-x *. xcworkspacedata-xxcuserdata $1 $2

Note that there should be no line breaks after $2; otherwise, the path may be faulty during diff.
Remove the suffix and place it in any path in etc/paths (or your preferred path and add it to etc/paths) to set the environment variable.
Then, run chmod 777 mydiff to grant the shell script permission.

In this way, you can use mydiff like windows.

B) use windows-style diff files on Mac

The output of MacPort (Unix) diff (^ ++/^ ---/^ @, etc.) is LF, and the output of the difference part follows the end of the original line. In this way, only the last line (LF) in unix format is supported well.

In the conquer project, windows's line tail character (CRLF) is widely used. Therefore, the file generated by diff is actually a file mixed with two line tails. That is, why the ^ M symbol is displayed when you use gvim to view such files.

This is different from the effect of the gunwin32 diff/patch we use in windows. The latter's output is CRLF, and the difference is still the original one.

In this way, there is an embarrassing situation, that is, it is difficult for a platform to use diff patches on another platform. We usually synchronize windows diff to the Mac version. There are two methods:

I. Use the gunwin32 patch in the windows Virtual Machine of Mac

Note that the patch does not directly support folders in the network location. After setting the sharing (Virtual Machine/sharing, you can resolve this problem by ing network drives (resource managers/tools/ ing network drives) in windows virtual machines.

Ii. directly use shell scripts on Mac.

Create a shell file named iospatch with the following content:

Copy codeThe Code is as follows: awk '/^ \ + | ^ --- | ^ @ | ^ diff | ^ Binary | ^ File/{sub (/\ r$ /, "") };{ print} '> unixLF. diff
Patch $ @ <unixLF. diff

Be sure to handle the path and grant permissions like the above mydiff shell.

The usage is the same as patch, but now we will write iospatch-arg <file, such as iospatch-p1 <... \ win. diff

This method can prevent the hacker from getting worse after the virtual machine is enabled by Apple. It is also compatible with the diff of both Unix and windows styles. We recommend that you use this method.

C) version function synchronization and conflict resolution

Due to review and other reasons of apple, version updates are relatively infrequent, and several major versions are often synchronized once. The synchronization workload is large, and each person must synchronize dozens of patches, however, because windows and mac branches are quite different, there may be a lot of conflicts, and because XCode compilation is slow and resources need to be re-converted, it is difficult to check every patch once, in this way, dozens of patches are usually merged into a large change file, and the file is checked in.
When dozens of patches are resolved, it is basically difficult to see what is going on (for example, if a conflict is not resolved) on svn. We recommend that you use a local version management tool. The SourceTree mentioned above is very easy to use because HG/Git and so on are all Local repositories. Unlike svn, which imposes strict check in requirements, we can connect the orig/rej file check in to our local repository for later check.
It is especially convenient to restore modifications locally, clear redundant files, and view changes. During baseline update, we can also retrieve another branch and merge the branches, the implementation of the patch after the local merge can weaken the demand for the baseline.

Attachment:

IOS development environment: Windows Attack Details _ code attachment .zip
:/201306/other/IOS_windows_fj_jb51.rar
Content (note that some spaces in the shell/bat file are sensitive. If you have any questions, please download one directly)
Convert batch mixed format diff in mac to unix format diff diff2unixCopy codeThe Code is as follows: # diff2unix
# Ruoqian, Chen <piao.polar@gmail.com>
#2013.2.7
#----------
# Trans diff patch with windows LE (CRLF) to Unix LE (LF)
#-----------
# Usage
# Diff2unix trans curent dir
# Diff2unix path trans dir or file
# When trans dir, will trans all files and child dir in it.
#----------
If [$ # = 0]
Then
Path = 'pwd'
Else
Path = $1
Fi
If [-f $ path]
Then
File =$ {path ##*/}
Ext =$ {file ##*.}
If [["$ file "! = Mac *] & [$ ext = "diff"]
Then
New_file = "mac _" $ file
Echo $ path "->" $ new_file
Awk '/^ \ + | ^ --- | ^ @ | ^ diff | ^ Binary | ^ File/{sub (/\ r$ /,"")}; {print} '<$ path> $ new_file
Fi
Else
For file in 'ls $ Path'
Do
Diff2unix $ path "/" $ file
Done
Fi

In windows, convert batch mixed format diff to windows/dos format diff diff2win. batCopy codeThe Code is as follows: diff2win
: Ruoqian, Chen <piao.polar@gmail.com>
::----------
: Trans file with unix LE (LF) or mix LE (LF/CRLF) to window LE (CRLF)
::----------
: 2013.2.16
: Usage
: Diff2win trans curent dir
: Diff2win path trans dir or file
::----------
@ Echo off
Setlocal enabledelayedexpansion
Set WorkPath = % cd %
If [% 1] neq [] set WorkPath = % 1 & (dir/ad % 1> nul 2> nul) & goto TRANS_DIR | goto TRANS_FILE
: TRANS_DIR
For/f "delims =" % I in ('dir! WorkPath! /A-d/B ^ | findstr. diff $ ^ | findstr-v ^ win _ ') do (
Echo! WorkPath! /% I-^> win _ % I
Gawk-v BINMODE = "rw"/^ \ + | ^ --- | ^ diff | ^ Binary | ^ File/{sub (/$/, \ "\ r \") };{ print} "<! WorkPath! /% I> win _ % I
)
Goto: eof
: TRANS_FILE
For/f "delims =" % I in ('dir % WorkPath %/B ') do (
Echo % WorkPath %-^> win _ % I
Gawk-v BINMODE = "rw"/^ \ + | ^ --- | ^ diff | ^ Binary | ^ File/{sub (/$/, \ "\ r \") };{ print} "<% WorkPath %> win _ % I
)
:: Gawk-v BINMODE = "rw"/^ \ + | ^ --- | ^ diff | ^ Binary | ^ File/{sub (/$/, \ "\ r \") };{ print} "<in> out
::----------
: 2013.2.8
: Usage
: Diff2win <file_in> file_out
: E.g.
: Diff2win <unix. diff> win. diff
::----------
: @ Echo off
: Gawk 1
: Http://www.gnu.org/software/gawk/manual/html_node/PC-Using.html
: Under MS-Windows, OS/2 and MS-DOS, gawk (and your other text programs) silently translate end-of-line "\ r \ n" to "\ n" on input and "\ n" to "\ r \ n" on output.

Run diff winpatch. bat in various formats in windonws.Copy codeThe Code is as follows: winpatch
: Ruoqian, Chen <piao.polar@gmail.com>
: 2013.2.16
::
: Call gnu patch to patch a diff file with windows LE (CRLF) or Unix LE (LF) or mix LE
::----------
: Usage
: The same to patch use patch -- help to read it
: E.g. winpatch-p1 <../mac. diff
: Or winpatch-p1-R <../mac. diff
::----------
@ Echo off
Gawk-v BINMODE = "rw"/^ \ + | ^ --- | ^ diff | ^ Binary | ^ File/{sub (/$/, \ "\ r \") };{ print} "> dosCRLF. diff
Patch % 1% 2% 3% 4% 5% 6% 7% 8% 9 <dosCRLF. diff

2013.3.4. Update

1. About Versions
Note that you should not omit the addition or deletion of files during commit. Click Changed to view the changes in the directory. The new file is displayed as a circle question mark, the deleted file is displayed as a dotted question mark, right-click Add or Delete, change the icon to the correct Add/delete icon.
2. About Sublimt Text2
A) Chinese garbled plug-ins
Resources and descriptions see: https://github.com/seanliang/ConvertToUTF8/blob/master/README.zh_CN.md
B) Change the shortcut key to a windows style.
Preferences-> Key Bindings-User: copy the windows version
Or you can get your own https://gist.github.com/piaopolar/5081327 from here.
C. Drag and Drop the file to the window without opening a new window.
Preferences-> Setting-Default
"Open_files_in_new_window": false

D) automatic line feed
Preferences-> Setting-Default
"Word_wrap": "true"
3. The directory of the intermediate files of iospatch and winpatch is not good in the current path, which may lead to reverse migration to the working directory.
Add \ (windows) or/(Unix) to the file name and put it in the root directory. You can avoid this problem by directly accessing the temporary file directory of the system or your expected directory.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.