Mercurial .hgignore for Android Studio projects

前端 未结 4 860
灰色年华
灰色年华 2020-12-29 06:35

What files should be ignored in Mercurial when using Android Studio (1.0 RC4 Windows) for development?

Creating new application project also creates .gitignore

相关标签:
4条回答
  • 2020-12-29 07:22

    I suggest you add all the files listed above to .hgignore except for the build.gradle and settings.gradle. The files in .idea directory are generated automatically by Android Studio and you shouldn't track them, or manually edit. I don't think you will ever need to edit gradlew or gradlew.bat so you can ingore them also. You can add gradle.properties and gradle-wrapper.properties later, when you will need to change the default versions (personally, I've these two to ignore also).

    0 讨论(0)
  • 2020-12-29 07:25

    IntelliJ IDEA mercurial .hgignore file for regular gradle / maven java multi project including wrappers (wrappers also should be committed)

    syntax: regexp
    .gradle/*
    .idea/*
    syntax: glob
    .git/*
    */out/*
    */build/*
    */target/*
    .DS_Store
    *.iml
    *.ipr
    *.iws
    *.log
    
    0 讨论(0)
  • 2020-12-29 07:34

    This is what I ended up with for gradle based Android Studio (1.5) projects:

    syntax: glob
    *.iml
    .gradle
    .idea/dictionaries
    .idea/libraries
    .idea/tasks.xml
    .idea/workspace.xml
    build
    gen
    local.properties
    

    I think this is a very complete list. The only questionable option imho is whether you ignore *.iml files or not. They duplicate information from build.gradle, are automatically generated and constantly updated by Android Studio, but on the other hand new developers will need to "Import project" instead of "Open an existing Android Studio project" if you decide not to track them.

    Contrary to the other answer, I would strongly recommend checking all the gradle wrapper files into VCS. The wrapper's purpose is to bootsrap the installation of gradle. If you for example want to set up automatic builds, you only need to check out the project, create local.properties or corresponding environment variables and execute gradlew assemble. The build system will then automatically install the gradle version specified in your gradle-wrapper.properties to perform the assemble task. This is valuable information to share.

    Also check this official JetBrains Support article: https://intellij-support.jetbrains.com/hc/en-us/articles/206827587-How-to-manage-projects-under-Version-Control-Systems

    0 讨论(0)
  • 2020-12-29 07:34

    By dint of .ignore plugin you can generate .hgignore just in two clicks. Open the context menu on a root folder, select 'New >> .ignore file >> .hgignore'. Then for Android Studio project simply tick the checkboxes (templates) listed below:

    • Android
    • Gradle (optional)
    • JetBrains
    • AppEngine (optional)

    Add syntax: glob to the top of the generated file.

    0 讨论(0)
提交回复
热议问题