-
Notifications
You must be signed in to change notification settings - Fork 763
/
Copy pathbuild.gradle
154 lines (132 loc) · 5.78 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
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
kotlinOptions {
freeCompilerArgs = ['-Xjvm-default=all']
}
defaultConfig {
minSdkVersion rootProject.minSdkVersion
}
testOptions {
unitTests.includeAndroidResources = true
unitTests.all {
// Because of native libraries loading (Yoga), we can never reuse a class loader and
// need to fork a new process per class.
forkEvery = 1
maxParallelForks = 4
jvmArgs '-Dcom.facebook.litho.is_oss=true', '-Dlitho.animation.disabled=true'
testLogging {
events 'skipped', 'failed', 'standardOut', 'standardError'
exceptionFormat = 'full'
}
// This test requires some resources configuration with Gradle and Robolectric
// that we haven't had time to figure out
exclude '/com/facebook/litho/ApplyStylesTest.class'
// This test has failed on gradle since we upgraded to robolectric 4.9
exclude 'com/facebook/litho/MountStateTest.class'
// When using Gradle sometimes resources needed for this test are not copied into the
// proper folder (see block around line 120). So, skip them for Gradle as they still
// will be run for BUCK.
exclude '/com/facebook/litho/processor/integration/ProcessorIntegrationTest.class'
/*
T94395240
The following tests fail when run using gradle. The javac tools used in the test
environment skips some method parameters when API/Build Tools version >=v30. These
tests will still run for BUCK. The test class needs to be excluded because the
android plugin's UnitTest options doesn't allow excluding specific tests.
*/
exclude 'com/facebook/litho/sections/specmodels/generator/GroupSectionSpecGeneratorTest.class'
}
}
compileOptions {
sourceCompatibility rootProject.sourceCompatibilityVersion
targetCompatibility rootProject.targetCompatibilityVersion
}
sourceSets.test.java.srcDir project(':litho-processor').file("src/test/java")
sourceSets.test.java.srcDir project(':litho-sections-processor').file("src/test/java")
namespace 'com.facebook.litho.it'
lint {
abortOnError false
}
}
dependencies {
// For main targets
implementation project(':litho-core')
implementation project(':litho-widget')
implementation project(':litho-sections-core')
implementation project(':litho-sections-widget')
implementation project(':litho-testing')
implementation deps.inferAnnotations
implementation deps.supportAppCompat
implementation deps.supportRecyclerView
implementation deps.supportSwipeRefresh
implementation deps.kotlinStandardLib
implementation files('../lib/tools.jar')
implementation files('../lib/rt.jar')
compileOnly project(':litho-sections-annotations')
annotationProcessor project(':litho-processor')
annotationProcessor project(':litho-sections-processor')
kapt project(':litho-processor')
kapt project(':litho-sections-processor')
// Test project dependencies
testCompileOnly project(':litho-sections-annotations')
testImplementation project(':litho-rendercore-testing')
testImplementation project(':litho-widget')
testImplementation project(':litho-widget-kotlin')
testImplementation project(':litho-processor')
testImplementation project(':litho-sections-core')
testImplementation project(':litho-sections-processor')
testImplementation project(':litho-sections-widget')
testImplementation project(':litho-perf-logger')
testImplementation project(':litho-intellij-plugin')
testImplementation project(':test-specs')
testImplementation files('../lib/tools.jar')
testImplementation files('../lib/rt.jar')
// Testing deps
testCompileOnly deps.jsr305
testImplementation deps.assertjCore
testImplementation deps.compileTesting
testImplementation deps.junit
testImplementation deps.mockitoCore
testImplementation deps.mockitokotlin
testImplementation deps.javapoet
testImplementation deps.robolectric
testImplementation deps.soloader
testImplementation deps.supportAppCompat
testImplementation deps.supportRecyclerView
testImplementation deps.supportTestCore
testImplementation deps.khronos
}
gradle.projectsEvaluated {
// Base path which is recognized by android studio.
def testClassesPath = "${buildDir}/intermediates/classes/test/"
// Copy must be done for each variant.
def variants = android.libraryVariants.collect()
variants.each { variant ->
def variationName = variant.name.capitalize()
def variationPath = variant.buildType.name
task "copyTest${variationName}Resources"(type: Copy) {
from "${projectDir}/src/test/resources"
into "${testClassesPath}/${variationPath}"
}
test.dependsOn "copyTest${variationName}Resources"
}
}