Giter Club home page Giter Club logo

Comments (6)

egorikftp avatar egorikftp commented on July 18, 2024 2

@Moozart

i can suggest more optimized dsl

fun NamedDomainObjectContainer<TargetConfigDsl>.ios(block: TargetConfigDsl.() -> Unit) {
    listOf("iosArm64", "iosSimulatorArm64", "iosX64").forEach {
        create(it, block)
    }
}

fun NamedDomainObjectContainer<TargetConfigDsl>.android(block: TargetConfigDsl.() -> Unit) {
    create("android", block)
}

fun TargetConfigDsl.buildConfigField(name: String, value: String) {
    buildConfigField(type = STRING, name = name, value = value, const = true)
}

Usage

buildkonfig {
    defaultConfigs {
        buildConfigField(name = "versionName", value = "0.0.0")
    }
    
    targetConfigs {
        android {
            buildConfigField(name = "versionName", value = "2.0.0")
        }
        ios {
            buildConfigField(name = "versionName", value = "1.0.0")
        }
    }
}

from buildkonfig.

RyuNen344 avatar RyuNen344 commented on July 18, 2024 1

Thanks, I'll see later 😉

from buildkonfig.

egorikftp avatar egorikftp commented on July 18, 2024 1

@RyuNen344

I have made investigation, and looks like issue fixes if we specify ios target like this:

targetConfigs {
        create("android") {
            buildConfigField(...)
        }
        create("iosArm64") {
            buildConfigField(...)
        }
        create("iosSimulatorArm64") {
            buildConfigField(...)
        }
        create("iosX64") {
            buildConfigField(...)
        }
    }

from buildkonfig.

RyuNen344 avatar RyuNen344 commented on July 18, 2024

@Moozart
could you give me more info?

e.g) kotlin version, kmp plugin version, gradle version

from buildkonfig.

Moozart avatar Moozart commented on July 18, 2024

@RyuNen344 Ofcourse,

kotlin = "1.9.23"
distributionUrl=https://services.gradle.org/distributions/gradle-8.2-bin.zip
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }

from buildkonfig.

Moozart avatar Moozart commented on July 18, 2024

@egorikftp Thanks for the research. I haven't tried it but if it works I will use it with this scoped func. Writing all ios modules one by one made me a bit lazy :)

fun NamedDomainObjectContainer<TargetConfigDsl>.crateForIOS() { listOf("iosArm64", "iosSimulatorArm64", "iosX64").forEach { create(it) { buildConfigField(FieldSpec.Type.STRING, "target", "ios") } } }

from buildkonfig.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.