PocketByte / LocoLaser

Localization tool to import localized strings from external source to your project.
Apache License 2.0
31 stars 1 forks source link

Kotlin multiplatform gradle doesn't generate anything #6

Closed ATizik closed 5 years ago

ATizik commented 5 years ago

Kotlin-common, kotlin-android and kotlin-ios do not generate any files with the corresponding config:

{
  "platform": [
    {
      "type": "kotlin-common",
      "res_dir": "./greeting/src/commonMain/kotlin",
      "res_name": "org.greeting.StringRepository"
    },
    {
      "type": "kotlin-android",
      "res_dir": "./greeting/src/androidLibMain/kotlin",
      "res_name": "org.greeting.StringRepository.AndroidStringRepository",
      "implements": "org.greeting.StringRepository",
      "app_id": "org.konan.multiplatform"
    }
  ],
  "source": {
    "type": "googlesheet",
    "id": "1cCzyipNx0VNZTmtUvpc32MUECvFB2yp0_5dawMYMODA",
    "column_key": "key",
    "column_locales": [
      "en",
      "sp"
    ]
  },
  "temp_dir": "./build/temp/"
}

root build.gradle:

    ext.kotlin_version = '1.3.31'

    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://kotlin.bintray.com/kotlinx" }
        maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
        maven { url "https://plugins.gradle.org/m2/" }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
        classpath "gradle.plugin.ru.pocketbyte.locolaser:plugin:1.0.2"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url "https://dl.bintray.com/soywiz/soywiz" }
        maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
}
apply plugin: "ru.pocketbyte.locolaser"
dependencies {
    localize 'ru.pocketbyte.locolaser:source-googlesheet:1.2.5'
    localize "ru.pocketbyte.locolaser:platform-kotlin-mobile:1.2.5"
}

output:

Reading config file /home/atizik/AndroidStudioProjects/convergence/localize_config.json
Force import. All resource files will be refreshed.
Conflict strategy: keep_new_platform
Open sheet: 111
1 worksheets found.
Use default worksheet with index 0. Worksheet title: 1112
Title row: 1
Total time: 3671 millis.

BUILD SUCCESSFUL in 4s
KamiSempai commented 5 years ago

This is a bug. Google Sheet source not respond to following contract: First locale will import as base locale. Will be fixed in the next release. To workaround it for now you should rename locale "en" to "base". Also I would recommend you to add platform "android" into "platform" list, cause "kotlin-android" only generates repository class but not resource files. You can find declaration of "android" for multiplatform projects in following example config https://github.com/PocketByte/LocoLaser/wiki/Platform:-Kotlin-Mobile-Multiplatform#usage