【问题标题】:Why long packageName results in a line break just before the import as quantifier?为什么 long packageName 会在作为量词导入之前导致换行?
【发布时间】:2021-12-18 13:38:29
【问题描述】:

在我的 Android 多模块项目中,我有: 模块 A:

sqldelight {
    SomeExampleDb {
        packageName = "com.example.exampleapp.feature.currency.datasource.example.localstorage"
    }
}

模块 B:

sqldelight {
    SomeExampleDb {
        packageName = "com.example.exampleapp.feature.account.datasource.example.localstorage"
        dependency(project(":moduleA"))
    }
}

在构建期间,当编译器为模块 B 生成SomeExampleDb 接口时,会导致这样的导入:

import com.example.exampleapp.feature.currency.datasource.example.localstorage.SomeExampleDb as
    SomeExampleDb0
    
public interface SomeExampleDb : Transacter, SomeExampleDb0 {
 ...
}    

(as后面有换行符) 导致这样的错误:

e: {path to file}/SomeExampleDb.kt: (8, 101): Expecting identifier

当 packageName 较短时,一切正常。在构建过程中是否以任何方式考虑了最大行长度?

SQLDelight 版本

1.5.2

操作系统

macOS Big Sur 11.2.3

Gradle 版本

7.2

Kotlin 版本

1.5.30

AGP 版本

7.0.3

【问题讨论】:

    标签: android kotlin gradle sqldelight


    【解决方案1】:

    这是由sqldelight使用的kotlinpoet(生成kotlin文件的api)中的问题引起的:https://github.com/square/kotlinpoet/issues/1169

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-17
      • 1970-01-01
      • 2013-04-30
      • 2023-01-14
      • 1970-01-01
      • 1970-01-01
      • 2014-04-11
      相关资源
      最近更新 更多