This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
forked from cashapp/paparazzi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
188 lines (170 loc) · 5.43 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
apply plugin: 'com.github.ben-manes.versions'
buildscript {
ext.repoDir = new File("$rootProject.buildDir/prebuilts/studio/layoutlib")
// maps to this commit: https://android.googlesource.com/platform/prebuilts/studio/layoutlib/+/573f070
// which runs on JDK 11
ext.layoutLibPrebuiltSha = '573f070'
ext.versions = [
kotlin: '1.5.31',
agp: '7.1.2',
layoutlib: "2021.1.1-$layoutLibPrebuiltSha", // "should" be similar to versions.agp
compose: '1.0.5',
jcodec: '0.2.5',
moshi: '1.12.0',
bytebuddy: '1.11.22',
releasedPaparazzi: '0.9.3'
]
ext.deps = [
plugins: [
android: "com.android.tools.build:gradle:${versions.agp}",
kotlin: "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
],
compose: [
compiler: "androidx.compose.compiler:compiler:${versions.compose}",
],
kotlin: [
bom: "org.jetbrains.kotlin:kotlin-bom:${versions.kotlin}",
],
kotlinx: [
coroutines: [
core: 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2',
],
],
tools: [
common: 'com.android.tools:common:27.1.2',
layoutlib: 'com.android.tools.layoutlib:layoutlib-api:27.2.2',
sdkcommon: 'com.android.tools:sdk-common:26.6.4',
],
kxml2: 'kxml2:kxml2:2.3.0',
androidx: [
annotations: 'androidx.annotation:annotation:1.3.0',
lifecycleCommon: 'androidx.lifecycle:lifecycle-common:2.4.0',
],
layoutlib: [
native: [
jdk11: "app.cash.paparazzi:layoutlib-native-jdk11:${versions.layoutlib}",
macArm: "app.cash.paparazzi:layoutlib-native-macarm:${versions.layoutlib}",
macOsX: "app.cash.paparazzi:layoutlib-native-macosx:${versions.layoutlib}",
windows: "app.cash.paparazzi:layoutlib-native-win:${versions.layoutlib}",
linux: "app.cash.paparazzi:layoutlib-native-linux:${versions.layoutlib}",
]
],
okio: 'com.squareup.okio:okio:3.0.0',
moshi: [
core: "com.squareup.moshi:moshi:${versions.moshi}",
adapters: "com.squareup.moshi:moshi-adapters:${versions.moshi}",
kotlinCodegen: "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}",
],
jcodec: [
core: "org.jcodec:jcodec:${versions.jcodec}",
javase: "org.jcodec:jcodec-javase:${versions.jcodec}"
],
bytebuddy: [
core: "net.bytebuddy:byte-buddy:${versions.bytebuddy}",
agent: "net.bytebuddy:byte-buddy-agent:${versions.bytebuddy}",
],
guava: 'com.google.guava:guava:31.0.1-jre',
junit: 'junit:junit:4.13.2',
truth: 'com.google.truth:truth:1.1.3',
assertj: 'org.assertj:assertj-core:3.21.0',
testparameterinjector: 'com.google.testparameterinjector:test-parameter-injector:1.5',
]
repositories {
mavenCentral()
google()
gradlePluginPortal()
//mavenLocal()
}
dependencies {
classpath deps.plugins.kotlin
classpath deps.plugins.android
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'
classpath 'org.ajoberstar.grgit:grgit-gradle:4.1.0'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.39.0'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.5.31'
classpath "app.cash.paparazzi:paparazzi-gradle-plugin:${versions.releasedPaparazzi}"
}
}
subprojects {
repositories {
mavenCentral()
google()
//mavenLocal()
}
group = GROUP
version = VERSION_NAME
tasks.withType(Test).configureEach {
testLogging {
events "failed"
exceptionFormat "full"
showExceptions true
showStackTraces true
showCauses true
}
}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}
plugins.withId('com.vanniktech.maven.publish') {
publishing {
repositories {
maven {
name = "projectLocalMaven"
url = "${rootProject.buildDir}/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").forUseAtConfigurationTime()
credentials(PasswordCredentials)
}
}
}
mavenPublish {
releaseSigningEnabled = hasProperty('signingKey')
}
}
tasks.register('emptySourcesJar', Jar) {
// TODO: fetch sources from the corresponding AOSP repos.
archiveClassifier = 'sources'
}
tasks.register('emptyJavadocJar', Jar) {
archiveClassifier = 'javadoc'
}
}
tasks.register("clean", Delete).configure {
delete rootProject.buildDir
}
tasks.named("wrapper").configure {
distributionType = Wrapper.DistributionType.ALL
}
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()")
}
}
}
}
}