cocos2dx gitignore 設定調査

## 調査手順


cocos2dx 3.9のluaプロジェクトでandroid,iosのgitignoreをどうするのがいいのか調査をしてみました。


* cocos new
* git init
* cocos compile
* git status
* gitignore
以下ループをしてみた


## 成果物


```
# android-studio
frameworks/cocos2d-x/cocos/platform/android/libcocos2dx/build/
frameworks/runtime-src/proj.android-studio/app/assets/
frameworks/runtime-src/proj.android-studio/app/libs/
frameworks/runtime-src/proj.android-studio/app/obj/
frameworks/runtime-src/proj.android-studio/app/gradle.properties

# android
frameworks/cocos2d-x/cocos/platform/android/java/bin/
frameworks/cocos2d-x/cocos/platform/android/java/gen/
frameworks/runtime-src/proj.android/assets/
frameworks/runtime-src/proj.android/bin/
frameworks/runtime-src/proj.android/gen/
frameworks/runtime-src/proj.android/libs/
frameworks/runtime-src/proj.android/obj/
frameworks/runtime-src/proj.android/ant.properties


# ios
frameworks/cocos2d-x/build/build/
frameworks/cocos2d-x/cocos/scripting/lua-bindings/proj.ios_mac/build/
frameworks/runtime-src/proj.ios_mac/build/


# cocos build
simulator/
publish/

# android studio ide
*.iml
.idea


# xcode
xcuserdata/

# local
local.properties

# keystore
*.keystore
```


## 作業ログ

箱をつくってコミットする

```
$ cocos new -p com.hogehoge.lua39 -l lua -d ~/Documents lua39
$ cd ~/Documents/lua39/
$ git init
$ git add -A
$ git commit -am "first commit"
```

android-studioでcompileしてみる

```
$ cocos compile -s ~/Documents/lua39 -p android -m debug --android-studio
$ git status
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   frameworks/runtime-src/proj.android-studio/app/project.properties

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        frameworks/cocos2d-x/cocos/platform/android/libcocos2dx/build/
        frameworks/runtime-src/proj.android-studio/app/assets/
        frameworks/runtime-src/proj.android-studio/app/build.xml
        frameworks/runtime-src/proj.android-studio/app/libs/
        frameworks/runtime-src/proj.android-studio/app/local.properties
        frameworks/runtime-src/proj.android-studio/app/obj/
        frameworks/runtime-src/proj.android-studio/app/proguard-project.txt
        simulator/

no changes added to commit (use "git add" and/or "git commit -a")
```

https://github.com/github/gitignore/blob/master/Android.gitignore
を参考に必要ないものを追記


```gitignore
# android-studio
frameworks/cocos2d-x/cocos/platform/android/libcocos2dx/build/
frameworks/runtime-src/proj.android-studio/app/assets/
frameworks/runtime-src/proj.android-studio/app/libs/
frameworks/runtime-src/proj.android-studio/app/obj/
simulator/


# local
local.properties
```

simulatorはapkファイルがはかれる、local.propertiesは全体を拒否っていい気がしたので


gitignoreを変更したのでcommit



つぎにandroid-studioでのreleaseにしたときのパターンを

```
$ cocos compile -s ~/Documents/lua39 -p android -m release --android-studio
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        frameworks/runtime-src/proj.android-studio/app/gradle.properties
        publish/
        sample.keystore

nothing added to commit but untracked files present (use "git add" to track)
```

keystoreとgradle.propertiesにkeystoreのpasswordとか入っているので上げない方がいいかもprivateなレポジトリだったらあげたほうがjenkinsでbuildとかも楽なのかな。
この辺りの自動化周りもよくわからない。


```gitignore
# android-studio
frameworks/cocos2d-x/cocos/platform/android/libcocos2dx/build/
frameworks/runtime-src/proj.android-studio/app/assets/
frameworks/runtime-src/proj.android-studio/app/libs/
frameworks/runtime-src/proj.android-studio/app/obj/
simulator/
frameworks/runtime-src/proj.android-studio/app/gradle.properties
publish/


# local
local.properties

# keystore
*.keystore
```

gitignoreを変更したのでcommit


androidでのbuildを試して見る

```
$ cocos compile -s ~/Documents/lua39 -p android -m debug
$ cocos compile -s ~/Documents/lua39 -p android -m release
$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   frameworks/cocos2d-x/cocos/platform/android/java/project.properties
        modified:   frameworks/runtime-src/proj.android/ant.properties
        modified:   frameworks/runtime-src/proj.android/project.properties

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        frameworks/cocos2d-x/cocos/platform/android/java/bin/
        frameworks/cocos2d-x/cocos/platform/android/java/gen/
        frameworks/runtime-src/proj.android/assets/
        frameworks/runtime-src/proj.android/bin/
        frameworks/runtime-src/proj.android/gen/
        frameworks/runtime-src/proj.android/libs/
        frameworks/runtime-src/proj.android/obj/

no changes added to commit (use "git add" and/or "git commit -a")
```


```
# android-studio
frameworks/cocos2d-x/cocos/platform/android/libcocos2dx/build/
frameworks/runtime-src/proj.android-studio/app/assets/
frameworks/runtime-src/proj.android-studio/app/libs/
frameworks/runtime-src/proj.android-studio/app/obj/
frameworks/runtime-src/proj.android-studio/app/gradle.properties

# android
frameworks/cocos2d-x/cocos/platform/android/java/bin/
frameworks/cocos2d-x/cocos/platform/android/java/gen/
frameworks/runtime-src/proj.android/assets/
frameworks/runtime-src/proj.android/bin/
frameworks/runtime-src/proj.android/gen/
frameworks/runtime-src/proj.android/libs/
frameworks/runtime-src/proj.android/obj/
frameworks/runtime-src/proj.android/ant.properties


# cocos build
simulator/
publish/


# local
local.properties

# keystore
*.keystore
```


iosでのbuild

```
$ cocos compile -s ~/Documents/lua39 -p ios -m debug
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        frameworks/cocos2d-x/build/build/
        frameworks/cocos2d-x/cocos/scripting/lua-bindings/proj.ios_mac/build/
        frameworks/runtime-src/proj.ios_mac/build/

nothing added to commit but untracked files present (use "git add" to track)


```gitignore
# android-studio
frameworks/cocos2d-x/cocos/platform/android/libcocos2dx/build/
frameworks/runtime-src/proj.android-studio/app/assets/
frameworks/runtime-src/proj.android-studio/app/libs/
frameworks/runtime-src/proj.android-studio/app/obj/
frameworks/runtime-src/proj.android-studio/app/gradle.properties

# android
frameworks/cocos2d-x/cocos/platform/android/java/bin/
frameworks/cocos2d-x/cocos/platform/android/java/gen/
frameworks/runtime-src/proj.android/assets/
frameworks/runtime-src/proj.android/bin/
frameworks/runtime-src/proj.android/gen/
frameworks/runtime-src/proj.android/libs/
frameworks/runtime-src/proj.android/obj/
frameworks/runtime-src/proj.android/ant.properties


# ios
frameworks/cocos2d-x/build/build/
frameworks/cocos2d-x/cocos/scripting/lua-bindings/proj.ios_mac/build/
frameworks/runtime-src/proj.ios_mac/build/


# cocos build
simulator/
publish/


# local
local.properties

# keystore
*.keystore
```


android studioで開いてみる
```
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        frameworks/cocos2d-x/cocos/platform/android/libcocos2dx/libcocos2dx.iml
        frameworks/runtime-src/proj.android-studio/.idea/
        frameworks/runtime-src/proj.android-studio/app/lua39.iml
        frameworks/runtime-src/proj.android-studio/proj.android-studio.iml

nothing added to commit but untracked files present (use "git add" to track)
```

https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
ここを参考に追加する


```
# android-studio
frameworks/cocos2d-x/cocos/platform/android/libcocos2dx/build/
frameworks/runtime-src/proj.android-studio/app/assets/
frameworks/runtime-src/proj.android-studio/app/libs/
frameworks/runtime-src/proj.android-studio/app/obj/
frameworks/runtime-src/proj.android-studio/app/gradle.properties

# android
frameworks/cocos2d-x/cocos/platform/android/java/bin/
frameworks/cocos2d-x/cocos/platform/android/java/gen/
frameworks/runtime-src/proj.android/assets/
frameworks/runtime-src/proj.android/bin/
frameworks/runtime-src/proj.android/gen/
frameworks/runtime-src/proj.android/libs/
frameworks/runtime-src/proj.android/obj/
frameworks/runtime-src/proj.android/ant.properties


# ios
frameworks/cocos2d-x/build/build/
frameworks/cocos2d-x/cocos/scripting/lua-bindings/proj.ios_mac/build/
frameworks/runtime-src/proj.ios_mac/build/


# cocos build
simulator/
publish/

# android studio ide
*.iml
.idea

# local
local.properties

# keystore
*.keystore

```


最後にxcodeで開く

https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore
ここを参考に追加する


```
# android-studio
frameworks/cocos2d-x/cocos/platform/android/libcocos2dx/build/
frameworks/runtime-src/proj.android-studio/app/assets/
frameworks/runtime-src/proj.android-studio/app/libs/
frameworks/runtime-src/proj.android-studio/app/obj/
frameworks/runtime-src/proj.android-studio/app/gradle.properties

# android
frameworks/cocos2d-x/cocos/platform/android/java/bin/
frameworks/cocos2d-x/cocos/platform/android/java/gen/
frameworks/runtime-src/proj.android/assets/
frameworks/runtime-src/proj.android/bin/
frameworks/runtime-src/proj.android/gen/
frameworks/runtime-src/proj.android/libs/
frameworks/runtime-src/proj.android/obj/
frameworks/runtime-src/proj.android/ant.properties


# ios
frameworks/cocos2d-x/build/build/
frameworks/cocos2d-x/cocos/scripting/lua-bindings/proj.ios_mac/build/
frameworks/runtime-src/proj.ios_mac/build/


# cocos build
simulator/
publish/

# android studio ide
*.iml
.idea


# xcode
xcuserdata/

# local
local.properties

# keystore
*.keystore
```