forked from cashapp/paparazzi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
134 lines (116 loc) · 3.37 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
apply plugin: 'com.github.ben-manes.versions'
buildscript {
repositories {
mavenCentral()
google()
gradlePluginPortal()
//mavenLocal()
}
dependencies {
classpath libs.plugin.kotlin
classpath libs.plugin.kotlinApiDump
classpath libs.plugin.android
classpath libs.plugin.mavenPublish
classpath libs.plugin.dokka
classpath libs.plugin.versions
classpath libs.plugin.spotless
classpath libs.plugin.buildConfig
classpath libs.plugin.poko
classpath libs.grgit
// Normally you would declare a version here, but we use dependency substitution in
// settings.gradle to use the version built from inside the repo.
classpath 'app.cash.paparazzi:paparazzi-gradle-plugin'
}
}
apply plugin: 'binary-compatibility-validator'
apiValidation {
ignoredProjects += ['libs', 'sample']
}
subprojects {
version = property("VERSION_NAME") as String
repositories {
mavenCentral()
google()
//mavenLocal()
}
tasks.withType(Test).configureEach {
testLogging {
events "passed", "failed", "skipped", "standardOut", "standardError"
exceptionFormat "full"
showExceptions true
showStackTraces true
showCauses true
}
}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = libs.versions.javaTarget.get()
targetCompatibility = libs.versions.javaTarget.get()
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile).configureEach {
kotlinOptions {
jvmTarget = libs.versions.javaTarget.get()
}
}
plugins.withId('org.jetbrains.kotlin.jvm') {
extensions.getByName('kotlin').explicitApi()
}
plugins.withId('com.vanniktech.maven.publish') {
publishing {
repositories {
maven {
name = "projectLocalMaven"
url = rootProject.layout.buildDirectory.dir("localMaven")
}
/**
* Want to push to an internal repository for testing?
* Set the following properties in ~/.gradle/gradle.properties.
*
* internalUrl=YOUR_INTERNAL_URL
* internalUsername=YOUR_USERNAME
* internalPassword=YOUR_PASSWORD
*/
maven {
name = "internal"
url = providers.gradleProperty("internalUrl")
credentials(PasswordCredentials)
}
}
}
}
tasks.register('emptySourcesJar', Jar) {
// TODO: fetch sources from the corresponding AOSP repos.
archiveClassifier = 'sources'
}
tasks.register('emptyJavadocJar', Jar) {
archiveClassifier = 'javadoc'
}
apply plugin: 'com.diffplug.spotless'
spotless {
kotlin {
target("src/**/*.kt")
ktlint(libs.versions.ktlint.get())
.setEditorConfigPath(rootProject.file(".editorconfig"))
}
}
}
tasks.register("clean", Delete).configure {
delete(rootProject.layout.buildDirectory)
}
allprojects { project ->
tasks.register("mavenLocalize").configure { task ->
def projectRootDir = project.projectDir
task.doFirst {
projectRootDir.eachFileRecurse(groovy.io.FileType.FILES) { file ->
if (file.name != 'build.gradle') {
return
}
def text = file.text
file.withWriter { w ->
// Intentional concatenation to prevent self-replacement
w << text.replace("//" + "mavenLocal()", "mavenLocal()")
}
}
}
}
}