All Projects → goncalossilva → kotlinx-resources

goncalossilva / kotlinx-resources

Licence: MIT License
Kotlin Multiplatform (KMP) library for reading resources in tests

Programming Languages

kotlin
9241 projects
shell
77523 projects

Projects that are alternatives of or similar to kotlinx-resources

kgql
GraphQL Document wrapper generator for Kotlin Multiplatform Project and Android
Stars: ✭ 54 (+260%)
Mutual labels:  gradle-plugin, kotlin-multiplatform
moko-network
Network components with codegeneration of rest api for mobile (android & ios) Kotlin Multiplatform development
Stars: ✭ 107 (+613.33%)
Mutual labels:  gradle-plugin, kotlin-multiplatform
kmp-fatframework-cocoa
A Gradle plugin to generate and publish an iOs FatFramework or XCFramework on Kotlin Multiplatform projects.
Stars: ✭ 26 (+73.33%)
Mutual labels:  gradle-plugin, kotlin-multiplatform
KotlinCompilerPluginExample
This is an example project that shows how to create a Kotlin Compiler Plugin. The plugin will print "Hello from" and the name of the file that is being compiled, as a compiler warning to the terminal log.
Stars: ✭ 43 (+186.67%)
Mutual labels:  gradle-plugin, kotlin-multiplatform
awesome-blockchain-bug-bounty
A comprehensive curated list of available Blockchain Bug Bounty Programs.
Stars: ✭ 50 (+233.33%)
Mutual labels:  resources
GitQuery
Sync files and directories from a remote Git repo. CLI and Gradle Plugin.
Stars: ✭ 25 (+66.67%)
Mutual labels:  gradle-plugin
Learn-WebVR
Resources to Learn WebVR 😎
Stars: ✭ 13 (-13.33%)
Mutual labels:  resources
RocketXPlugin
🔥🔥 android 端编译加速插件🚀 自动识别未改动 module 并在编译流程中替换为 aar ,只编译改动模块,加速 Android apk 的编译速度。
Stars: ✭ 408 (+2620%)
Mutual labels:  gradle-plugin
cs-resources
Curated Computer Science and Programming Resource Guide
Stars: ✭ 42 (+180%)
Mutual labels:  resources
resxmanager
Consolidates, synchronizes and translates Microsoft .NET resources (*.resx, *.wxl). Supports export to Excel (*.xlsx) and automating translation.
Stars: ✭ 28 (+86.67%)
Mutual labels:  resources
awesome-internals
A curated list of awesome resources and learning materials in the field of X internals
Stars: ✭ 78 (+420%)
Mutual labels:  resources
gradle-libraries-plugin
No description or website provided.
Stars: ✭ 29 (+93.33%)
Mutual labels:  gradle-plugin
jooq-plugin
Plugin for generating jOOQ classes using dockerized databases
Stars: ✭ 55 (+266.67%)
Mutual labels:  gradle-plugin
cognito-idp
Lightweight AWS Cognito Identity Provider client for Kotlin Multiplatform and Typescript projects.
Stars: ✭ 14 (-6.67%)
Mutual labels:  kotlin-multiplatform
InfosecHouse
Infosec resource center for offensive and defensive security operations.
Stars: ✭ 61 (+306.67%)
Mutual labels:  resources
Dexter
Manage multidexing using simple annotations and gradle tasks.
Stars: ✭ 41 (+173.33%)
Mutual labels:  gradle-plugin
awesome-gwent
Awesome resources for GWENT®: The Witcher Card Game.
Stars: ✭ 19 (+26.67%)
Mutual labels:  resources
svelte-interview-questions
Concepts and Questions related to Svelte - Part of official Svelte resources list
Stars: ✭ 18 (+20%)
Mutual labels:  resources
awesome-frontend-resources
A list of awesome Frontend resources
Stars: ✭ 17 (+13.33%)
Mutual labels:  resources
High-On-DSA
Repository with leetcode solutions and dedicated index to prepare for your FAANGM interviews. Feel free to share and contribute to this awesome repository.
Stars: ✭ 50 (+233.33%)
Mutual labels:  resources

kotlinx-resources

badge-library-version badge-plugin-version badge-jvm badge-js badge-nodejs badge-android badge-ios badge-watchos badge-tvos badge-macos badge-windows badge-linux

Kotlin Multiplatform (KMP) plugin and library that add support for reading resources in tests.

The plugin and a library work in tandem to provide a unified API across platforms for reading resources from each source set's resources folder.

Usage

List the plugin in your build.gradle.kts:

plugins {
    id("com.goncalossilva.resources")
}

And add the dependency to your commonTest source set:

kotlin {
    sourceSets {
        val commonTest by getting {
            dependencies {
                implementation("com.goncalossilva:resources:<version>")
            }
        }
    }
}

Once that's done, a Resource class becomes available in all test sources, with a simple API:

class Resource(path: String) {
    fun exists(): Boolean
    fun readText(): String
}

Note that path should be relative to the project's directory, such as src/commonTest/resources/some/optional/folders/file.txt. This is convenient from an implementation perspective, but also allows having resource files with the same name under difference resource folders.

Example

Library tests use the library itself, so they serve as a practical example. See ResourceTest for example usage, and resources-library/src/commonTest/resources for the associated folder structure for resources.

Acknowledgements

This library is inspired by this gist by @dellisd.

License

Released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].