Skip to content

Commit

Permalink
Updates LocoExtension with Action instead of Closure to support build…
Browse files Browse the repository at this point in the history
….gradle.kts
  • Loading branch information
yannickpulver committed Feb 6, 2023
1 parent b655fa0 commit 973686b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/src/main/groovy/com/appswithlove/loco/LocoConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class LocoConfig {
def resDir
def fileName = "strings"
def placeholderPattern = null
def hideComments = false
boolean hideComments = false
def tags
def fallbackLang = null
def orderByAssetId = false
boolean orderByAssetId = false
def status
def saveDefLangDuplicate = false
boolean saveDefLangDuplicate = false
def resourceNamePrefix = null
def ignoreMissingTranslationWarnings = false
boolean ignoreMissingTranslationWarnings = false
def index
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.appswithlove.loco

import org.gradle.api.Action
import org.gradle.api.Project

class LocoExtension {
Expand All @@ -12,9 +13,10 @@ class LocoExtension {
this.project = project
}

void config(Closure closure) {
void config(Action<LocoConfig> action) {
LocoConfig config = new LocoConfig()
project.configure(config, closure)
project.configure([config], action)
configList.add(config)
}

}
14 changes: 8 additions & 6 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ dependencies {

// TODO: Update with 0.3.0 as soon as published on mavenCentral
Loco {
apiKey = 'LBsleEFqO2zZeYaxU_d7pB8v4XBralr1'
lang = ['en', 'de']
defLang = 'en'
resDir = "$projectDir/src/main/res"
hideComments = true
orderByAssetId = true
// config {
apiKey = 'LBsleEFqO2zZeYaxU_d7pB8v4XBralr1'
lang = ['en', 'de']
defLang = 'en'
resDir = "$projectDir/src/main/res"
hideComments = true
orderByAssetId = true
// }
}

0 comments on commit 973686b

Please sign in to comment.