-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
68 lines (57 loc) · 1.81 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: "com.github.ben-manes.versions"
buildscript {
ext.kotlin_version = '2.1.0'
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:8.8.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:12.1.2"
classpath "com.github.ben-manes:gradle-versions-plugin:0.51.0"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
configurations.all {
resolutionStrategy.eachDependency { details ->
def requested = details.requested
if (requested.group == 'org.jetbrains.kotlin' && requested.name == 'kotlin-reflect') {
details.useVersion kotlin_version
}
if (requested.group == 'com.pinterest' && requested.name == 'ktlint') {
details.useVersion '0.48.0'
}
}
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
tasks.register("installGitHook", Copy) {
def suffix = "macos"
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
suffix = "windows"
}
from new File(rootProject.rootDir, "automation/scripts/pre-commit-$suffix")
into { new File(rootProject.rootDir, '.git/hooks') }
rename("pre-commit-$suffix", 'pre-commit')
fileMode 0775
}
tasks.register("installCodeStyle", Copy) {
from new File(rootProject.rootDir, 'automation/codeStyles/Project.xml')
into { new File(rootProject.rootDir, '.idea/codeStyles') }
}
tasks.getByPath(':app:compileKotlin').dependsOn installGitHook, installCodeStyle
apply plugin: "org.jlleitschuh.gradle.ktlint"
subprojects {
apply plugin: "org.jlleitschuh.gradle.ktlint"
}