-
Notifications
You must be signed in to change notification settings - Fork 729
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move epoxy-modelfactory tests to their own module (#834)
To avoid shipping test code.
- Loading branch information
1 parent
d98658a
commit 9a51d5b
Showing
36 changed files
with
202 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import org.gradle.internal.jvm.Jvm | ||
|
||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-kapt' | ||
|
||
android { | ||
compileSdkVersion rootProject.COMPILE_SDK_VERSION | ||
|
||
defaultConfig { | ||
// Using 16 here as it is the minimum version of Paris, which we are restricted to. | ||
minSdkVersion 16 | ||
targetSdkVersion rootProject.TARGET_SDK_VERSION | ||
} | ||
|
||
testOptions.unitTests.includeAndroidResources = true | ||
} | ||
|
||
configurations.all { strategy -> | ||
strategy.resolutionStrategy.force rootProject.deps.junit, rootProject.deps.robolectric, | ||
rootProject.deps.mockito | ||
} | ||
|
||
// Java files in the "resources" folder are not included in the build for some reason (seems like source files are skipped?) | ||
// This files are needed to test the annotation processor, so we manually copy them into the build. | ||
task('copyDebugTestResources', type: Copy) { | ||
from("${projectDir}/src/test/resources") | ||
into("${buildDir}/intermediates/sourceFolderJavaResources/debug") | ||
} | ||
|
||
task('copyReleaseTestResources', type: Copy) { | ||
from("${projectDir}/src/test/resources") | ||
into("${buildDir}/intermediates/sourceFolderJavaResources/release") | ||
} | ||
|
||
preBuild.dependsOn copyReleaseTestResources | ||
preBuild.dependsOn copyDebugTestResources | ||
|
||
dependencies { | ||
implementation project(':epoxy-adapter') | ||
implementation project(':epoxy-modelfactory') | ||
implementation rootProject.deps.paris | ||
implementation rootProject.deps.kotlin | ||
implementation rootProject.deps.androidRecyclerView | ||
|
||
kapt project(':epoxy-processor') | ||
|
||
// Need to include the processors directly since we create an instance of it in code for testing | ||
testImplementation project(':epoxy-processor') | ||
testImplementation rootProject.deps.parisProcessor | ||
|
||
testImplementation project(':epoxy-processortest') | ||
testImplementation rootProject.deps.googleTestingCompile | ||
testImplementation rootProject.deps.junit | ||
testImplementation rootProject.deps.robolectric | ||
testImplementation files(getRuntimeJar()) | ||
testImplementation files(Jvm.current().getToolsJar()) | ||
} | ||
|
||
static def getRuntimeJar() { | ||
try { | ||
final File javaBase = new File(System.getProperty("java.home")).getCanonicalFile() | ||
File runtimeJar = new File(javaBase, "lib/rt.jar") | ||
if (runtimeJar.exists()) { | ||
return runtimeJar | ||
} | ||
runtimeJar = new File(javaBase, "jre/lib/rt.jar") | ||
return runtimeJar.exists() ? runtimeJar : null | ||
} catch (IOException e) { | ||
throw new RuntimeException(e) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<manifest package="com.airbnb.epoxy.modelfactorytest" | ||
xmlns:android="http://schemas.android.com/apk/res/android" /> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<string name="app_name">Epoxy Model Factory Test</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.