2012年3月21日 星期三

Eclipse+Android SDK/NDK 開發環境的過程 (1/2)

後記: 

02/11/2014, 我重灌電腦, 再度安裝 andriod 開發環境, 發現 andriod 官網已經把下述之 Eclipse IDE 跟 SDK (step 7~21) 整合成一個 adt-bundle 了, 下載該包後, 解壓縮到硬碟任何地方即可以. (但前提 JRE 還是要先裝), 我沒有再新建專案, 去測試剩餘的步驟的有無差異. 
參見再度安裝 andriod 開發環境



-------------------
Eclipse+Android SDK/NDK 開發環境的過程

以下為我記錄第一次就搞定 Eclipse + Android SDK/NDK 開發環境的過程

時間為 2012/3/21 當時下載的最新版軟體及 SDK

其實在參照人家分享的過程中, 我發現

1. Cygwin 根本不用裝到 devel 整個套件
2. 不必修改任何 Cygwin 的 bash profile 檔案, 就可以讓 ndk 正常運作, 可
   能是我習慣 "不用多做的事情盡量不要做" 吧, 所以試著少做一些看看...


以下:
p.s. 這是記錄日誌, 不是教學~
--------------------------------------------------------------------

1. 下載 Java SE(Standard Edition) Development Kit
   url: http://www.oracle.com/technetwork/java/javase/downloads/
   ref: jdk-7u3-windows-i586.exe (84.1MB)

2. 下載 Eclipse IDE for Java Developers
   url: http://www.eclipse.org/downloads/
   ref: eclipse-java-indigo-SR2-win32.zip (128MB)

3. 下載 Android SDK
   url: http://developer.android.com/sdk/
   ref: android-sdk_r16-windows.zip (28.1MB)
        installer_r16-windows.exe (28.1MB)

4. 下載 Android NDK
   (*** only needed for developing C/C++ native code libraries ***)
   url: http://developer.android.com/sdk/ndk/
   ref: android-ndk-r7b-windows.zip (76.6MB)

   NOTE: 開發 NDK 還需要有 GNU 的 bash 和 make 工具, Windows 下可以安
         裝 Cygwin 環境

   下載 Cygwin (only needed for NDK)
   url: http://cygwin.com/install.html
   ref: setup.exe (681KB)

2012年2月23日 星期四

SVN folder as sub module of GIT

這是上一篇中 '方法B' 的筆記

1) Prepare svn:// protocol:

(NOTE: don't use file:/// because it might has file format compilable problem)

In my case:

    1. svn repo at d:\work\repo\my_projects

    2. set svn service (I had set root at d:\work\repo) and make sure service was activated

    3. test svn checkout from svn://localhost/my_projects (or relative to yout root  in step2) has no polblem

    where repo tree is like:

    svn://my_projects/bla1/...
                     /bla2/...
                     /src/boo1/...
                     /src/boo2/...
                     /src/boo3/...
                     /src/...


    (NOTE: I don't use /trunk /branches /tags naming layout)
 

2) Purpose: 

the svn://my_projects/src/boo3/* is the library part, I need it to be used as

a git clone where in d:\work\my_test\boo3-clone

so git://d:\work\my_test\boo3-clone

will sync to/and from svn://localhost/my_projects/src/boo3


3)  using msysgit:

1. use GIT for windows' 'GIT bash here' at d:\work\my_test

2. use 'git svn clone url_of_svn_repo folde_rname

(NOTE: if using /trunk /branches /tags naming layout, use 'git svn clone -s ...' as -s is -stdlayout)

3. in my case

$ git svn clone svn://localhost/my_projects/src/boo3 boo3-clone
Initialized empty Git repository in d:/work/my_test/boo3-clone/.git/
r75 = 1324d83fab0b6d93f526b8f8252e8404d49c9e08 (refs/remotes/git-svn)
        A       boo3.vcxproj.user
...
        A       boo3.dsw
        A       boo3.vcxproj.filters
        A       boo3.dsp
r80 = 9f6afc8b5c2d68c4901de44a99e946b9edab5926 (refs/remotes/git-svn)
..
        M       boo3.dsp
r81 = cbb1be75466bfb695c76c8366828af3fd7c03a80 (refs/remotes/git-svn)
Checked out HEAD:
  svn://localhost/my_projects/src/boo3 r81


4. so now d:\work\my_test\boo3-clone had filled as a git repo where all files/folders/logs

   are the same as svn's

Ref: 使用 git-svn 整合 git 與 svn



 4) Another example by using TortoiseGit:

1. git svn clone setup


2. git svn clone done


3. add submodule


GIT 跟 SVN 一起工作的實驗作法...

情景:
-----
工作在 A project, 其中有一個子模組 B 是來自其他的 SVN controlled project

方法 A:
-------
目前的實驗作法, 是將子模組 B 當成一個目錄, 然後整個 svn checkout 到到該目錄, 此

時可以把他當作 project A 的一個目錄(與其他的目錄一樣) import/commit to GIT

A-+-B-1.c
  |   2.c
  |
  +-C-3.c
  ...

如上圖, 整個 A 是 GIT 控制的, 而 B 目錄是 checkout from SVN,

工作時以 GIT 為主, 如果有修改 1.c, 2.c 也把修改送上 GIT,

唯需要將 1.c, 2.c 的修改也送回 SVN (可以每次 GIT commit 後, 或累積數次) 時,

則切到 B 目錄上操做 SVN 的 commit 動作.

如果 B 的 SVN 源頭有新的修改, 也是在 B 目錄上操作 SVN update(or merge),

然後再 GIT commit 此次的 B 的 SVN update.

問題:
-----
B 目錄(並其子目錄) 下會有一大堆 .svn\* 的控制目錄(可能被隱藏起來)跟檔案.

GIT 不應該管控他, 如果這些檔案被送交 GIT, 則不適當的順序(commit 1.c, 2.c 沒有依先

SVN commit, 再 GIT commit...)操作, 有可能會毀掉 B 的 .svn 的控制.

解決:
-----

就不要把 .svn 之類的目錄跟檔案送進 GIT 控制, 方法是利用在 A 目錄(GIT project 根目錄)下

放一個 .gitignore 文字檔案.

裡面一行文字描述要 GIT 忽略的檔案類型

.svn*

p.s. 建議可以多加一些可忽略的檔案格式(如每次 build VS6/VS2010 都會重新產生的檔案)

.svn*
*.obj
*.pch
*.idb
*.pdb
*.log
*.tlog
*.suo
*.user
*.aps
*.clw
*.ncb
*.opt
*.plg

問題:
-----
如果是 M$ Windows 下, 是不永許產生"無前檔名"的文件 :(

解決:
-----

利用 msysgit 的 bash 環境產生!

開啟 GIT bash 切到 A 目錄下(或在目錄 A 上執行右選單的 GIT Bash here), 執行

>touch .gitignore

看看有沒有產生

>ls -al

explorer 打開目錄 A window, 也能看到 .gitignore, 此時用任何編輯器編輯他...

編輯好後存起來, 可以在 GIT bash 裡面切到 B 目錄, 執行

>git status

應該看不到 .svn 了...

git commit 時, 這些 .gitignore 裡面描述的檔案也是 "不會出現"




方法 B:
-------
一般比較正統的作法是用 git-svn 指令, 見 svn folder as sub module of git 描述方法

我實際試用了一次:

1. clone svn 步驟是需要學習的.

2. [印象中] 在我實際(當前 GIT) project, 我只要 SVN repo 個的一個子目錄(模組), 而非全部目錄,

   不容易這樣子做, 我試了許久, 繞了一圈有做出來, 但又好像怪怪的...

3. [印象中] 可以直接一次 git commit 就送回 SVN repo, 這是方法 A 不及的.

以上 [印象中] 因為時間過太久了, 我忘了為什麼又放棄此法, 有時間我還要再驗證一次.