Skip to content

Commit 71fc32d

Browse files
committed
[CHORE] #4 : 자동으로 git/hooks 에 pre-commit 파일 삽입하는 Task 구현
1 parent 5cf0eef commit 71fc32d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

app/build.gradle.kts

+18
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,21 @@ dependencies {
3131
androidTestImplementation(libs.androidx.test.junit)
3232
androidTestImplementation(libs.androidx.test.espresso)
3333
}
34+
35+
tasks.getByPath(":app:preBuild").dependsOn("installGitHook")
36+
37+
tasks.register<Copy>("installGitHook") {
38+
dependsOn("deletePreviousGitHook")
39+
from("${rootProject.rootDir}/script/pre-commit")
40+
into("${rootProject.rootDir}/.git/hooks")
41+
eachFile {
42+
fileMode = 777
43+
}
44+
}
45+
46+
tasks.register<Delete>("deletePreviousGitHook") {
47+
val prePush = "${rootProject.rootDir}/.git/hooks/pre-commit"
48+
if (file(prePush).exists()) {
49+
delete(prePush)
50+
}
51+
}

gradlew

100644100755
File mode changed.

0 commit comments

Comments
 (0)