Skip to content

Commit

Permalink
Enhancement/modifiable source path of string files (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin-4K authored Mar 7, 2022
1 parent 12a41a7 commit e86170c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ configure<OneSkyPluginExtension> {
// list of files to sync in your src/main/res/values directory,
// e.g.: listOf("strings.xml", "plurals.xml")
sourceStringFiles = emptyList()
sourcePath = "path-to-your-string-values-directory"
// has src/main/res/ as a default value,
// can be overriden with your custom path (optional)
}
```

Expand Down
3 changes: 2 additions & 1 deletion plugin/src/main/java/co/brainly/onesky/OneSkyPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ open class OneSkyPluginExtension(
var apiKey: String = "",
var apiSecret: String = "",
var projectId: Int = -1,
var sourceStringFiles: List<String> = emptyList()
var sourceStringFiles: List<String> = emptyList(),
var sourcePath: String = "src/main/res"
) {
internal var oneSkyApiUrl: String = ONESKY_API_URL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ open class DownloadTranslationsTask @Inject constructor(

private val projectId = extension.projectId
private val files = extension.sourceStringFiles
private val sourcePath = extension.sourcePath

private val logger = LoggerFactory.getLogger("downloadTranslations")
private val progressLogger by lazy {
Expand Down Expand Up @@ -112,5 +113,5 @@ open class DownloadTranslationsTask @Inject constructor(
}

private val Project.androidResDir: File
get() = projectDir.resolve("src/main/res")
get() = projectDir.resolve(sourcePath)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ open class UploadTranslationTask @Inject constructor(

private val projectId = extension.projectId
private val files = extension.sourceStringFiles
private val sourcePath = extension.sourcePath

private val client = OneSkyApiClient(
apiKey = extension.apiKey,
Expand Down Expand Up @@ -73,5 +74,5 @@ open class UploadTranslationTask @Inject constructor(
}

private val Project.androidResDir: File
get() = projectDir.resolve("src/main/res")
get() = projectDir.resolve(sourcePath)
}

0 comments on commit e86170c

Please sign in to comment.