From 0f837b003317970d50774df99bd474d3144120f8 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 10 Dec 2021 15:14:38 +0530 Subject: [PATCH] diceware: convert to an Android library --- passgen/diceware/build.gradle.kts | 5 ++++- passgen/diceware/src/main/AndroidManifest.xml | 6 ++++++ .../src/main/{resources => res/raw}/diceware_wordlist.txt | 0 .../msfjarvis/aps/passgen/diceware/WordListParserTest.kt | 5 ++--- 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 passgen/diceware/src/main/AndroidManifest.xml rename passgen/diceware/src/main/{resources => res/raw}/diceware_wordlist.txt (100%) diff --git a/passgen/diceware/build.gradle.kts b/passgen/diceware/build.gradle.kts index 8a10f467..a6d0f119 100644 --- a/passgen/diceware/build.gradle.kts +++ b/passgen/diceware/build.gradle.kts @@ -4,10 +4,13 @@ */ plugins { - kotlin("jvm") + id("com.github.android-password-store.android-library") + id("com.github.android-password-store.kotlin-android") id("com.github.android-password-store.kotlin-library") } +android { sourceSets { getByName("test") { resources.srcDir("src/main/res/raw") } } } + dependencies { implementation(libs.dagger.hilt.core) testImplementation(libs.bundles.testDependencies) diff --git a/passgen/diceware/src/main/AndroidManifest.xml b/passgen/diceware/src/main/AndroidManifest.xml new file mode 100644 index 00000000..6dff3e51 --- /dev/null +++ b/passgen/diceware/src/main/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + diff --git a/passgen/diceware/src/main/resources/diceware_wordlist.txt b/passgen/diceware/src/main/res/raw/diceware_wordlist.txt similarity index 100% rename from passgen/diceware/src/main/resources/diceware_wordlist.txt rename to passgen/diceware/src/main/res/raw/diceware_wordlist.txt diff --git a/passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt b/passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt index a1633c69..9364085d 100644 --- a/passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt +++ b/passgen/diceware/src/test/kotlin/dev/msfjarvis/aps/passgen/diceware/WordListParserTest.kt @@ -30,9 +30,8 @@ class WordListParserTest { companion object { fun getDefaultWordList(): InputStream { - return requireNotNull( - this::class.java.classLoader.getResourceAsStream("diceware_wordlist.txt") - ) + return requireNotNull(this::class.java.classLoader) + .getResourceAsStream("diceware_wordlist.txt") } } }