-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Setup development environment (#27)
Closes #3
- Loading branch information
Showing
56 changed files
with
907 additions
and
286 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,59 @@ | ||
apply plugin: 'jacoco' | ||
|
||
jacoco { | ||
toolVersion '0.8.5' | ||
} | ||
|
||
task jacocoAndroidTestReport(type: JacocoReport) { | ||
|
||
sourceDirectories.from = files(["$project.projectDir/src/main/java"]) | ||
classDirectories.from = files([ | ||
fileTree( | ||
dir: project.buildDir, | ||
includes: [ | ||
"intermediates/javac/debug/**", | ||
"tmp/kotlin-classes/debug/**" | ||
], | ||
excludes: [ | ||
'android/**/*.*', | ||
'**/R.class', | ||
'**/R$*.class', | ||
'**/BuildConfig.*', | ||
'**/Manifest*.*', | ||
'**/*Test*.*', | ||
// Dagger | ||
'**/*Module.*', | ||
'**/*Module*Factory.*', | ||
'**/*Module$Companion.*', | ||
'**/*Dagger*.*', | ||
'**/*MembersInjector*.*', | ||
'**/*_Provide*Factory*.*', | ||
'**/*_Factory.*', | ||
// Epoxy | ||
'**/*ViewModel_.*', | ||
'**/EpoxyModelKotlinExtensionsKt.*', | ||
] | ||
) | ||
]) | ||
|
||
executionData.from = fileTree(dir: project.buildDir, includes: [ | ||
'jacoco/testDebugUnitTest.exec', | ||
'outputs/code_coverage/debugAndroidTest/connected/**/*.ec' | ||
]) | ||
|
||
if (project.hasProperty('codeCoverageDataLocation')) { | ||
executionData.from += fileTree(dir: codeCoverageDataLocation, includes: ['**/*.ec']) | ||
} | ||
|
||
reports { | ||
html.enabled true | ||
html.destination file("${buildDir}/reports/coverage") | ||
xml.enabled true | ||
xml.destination file("${buildDir}/reports/coverage.xml") | ||
csv.enabled false | ||
} | ||
|
||
doLast { | ||
println "Wrote HTML coverage report to ${reports.html.destination}/index.html" | ||
} | ||
} |
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,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<lint> | ||
<!-- We're using dependabot to keep dependencies up-to-date --> | ||
<issue id="NewerVersionAvailable" severity="ignore"/> | ||
<issue id="GradleDependency" severity="ignore"/> | ||
<issue id="LockedOrientationActivity" severity="ignore"/> | ||
|
||
<issue id="InvalidPackage"> | ||
<!-- Ignore errors about BC importing javax.naming because we don't use those modules --> | ||
<ignore path="**/bcpkix-*.jar" /> | ||
<!-- Temporary until https://github.com/Kotlin/kotlinx.coroutines/issues/2004 is resolved. --> | ||
<ignore path="**/kotlinx-coroutines-core-*.jar" /> | ||
</issue> | ||
<issue id="TrustAllX509TrustManager"> | ||
<ignore path="org/bouncycastle/est/jcajce/*.class" /> | ||
</issue> | ||
</lint> |
34 changes: 34 additions & 0 deletions
34
app/schemas/tech.relaycorp.gateway.data.database.AppDatabase/1.json
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,34 @@ | ||
{ | ||
"formatVersion": 1, | ||
"database": { | ||
"version": 1, | ||
"identityHash": "f4d34def0a467a21b391ecb53e2175d2", | ||
"entities": [ | ||
{ | ||
"tableName": "Message", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, PRIMARY KEY(`id`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "id", | ||
"columnName": "id", | ||
"affinity": "INTEGER", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"columnNames": [ | ||
"id" | ||
], | ||
"autoGenerate": false | ||
}, | ||
"indices": [], | ||
"foreignKeys": [] | ||
} | ||
], | ||
"views": [], | ||
"setupQueries": [ | ||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f4d34def0a467a21b391ecb53e2175d2')" | ||
] | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/androidTest/java/tech/relaycorp/gateway/AppTest.kt
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,15 @@ | ||
package tech.relaycorp.gateway | ||
|
||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import tech.relaycorp.gateway.test.AppTestProvider.app | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class AppTest { | ||
@Test | ||
fun mode() { | ||
assertEquals(App.Mode.Test, app.mode) | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
app/src/androidTest/java/tech/relaycorp/gateway/ExampleInstrumentedTest.kt
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
app/src/androidTest/java/tech/relaycorp/gateway/test/AppTestProvider.kt
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,30 @@ | ||
package tech.relaycorp.gateway.test | ||
|
||
import android.content.Context | ||
import androidx.room.Room | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import kotlinx.coroutines.asExecutor | ||
import kotlinx.coroutines.test.TestCoroutineDispatcher | ||
import tech.relaycorp.gateway.App | ||
import tech.relaycorp.gateway.data.database.AppDatabase | ||
|
||
object AppTestProvider { | ||
private val context: Context | ||
get() = InstrumentationRegistry.getInstrumentation().targetContext | ||
|
||
val app | ||
get() = context.applicationContext as App | ||
|
||
val component | ||
get() = app.component | ||
|
||
val database | ||
get() = | ||
Room | ||
.inMemoryDatabaseBuilder(context, AppDatabase::class.java) | ||
.setTransactionExecutor(testDispatcher.asExecutor()) | ||
.setQueryExecutor(testDispatcher.asExecutor()) | ||
.build() | ||
|
||
private val testDispatcher by lazy { TestCoroutineDispatcher() } | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.