Skip to content

Instantly share code, notes, and snippets.

@kalaiselvan369
Created April 17, 2020 11:11
Show Gist options
  • Select an option

  • Save kalaiselvan369/3a942b6d390c727ab0353f8caa1f4ff6 to your computer and use it in GitHub Desktop.

Select an option

Save kalaiselvan369/3a942b6d390c727ab0353f8caa1f4ff6 to your computer and use it in GitHub Desktop.
Project build gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.28.1"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
ext {
// query git for the commit count to automate versioning.
gitCommitCount = 100 +
Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
}
// adding pre-commit to .git/hooks directory before app starts building
task installGitHook(type: Copy) {
from new File(rootProject.rootDir, 'pre-commit')
into { new File(rootProject.rootDir, '.git/hooks') }
fileMode 0777
}
tasks.getByPath('app:preBuild').dependsOn installGitHook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment