Git Product home page Git Product logo

Comments (3)

fortmarek avatar fortmarek commented on July 3, 2024

Hey 👋

The best way to do this is to use a setting variable: #2521 (comment)

In this issue, there's a description why what you're trying to do does not work.

I am closing this because there's no action item for us.

from tuist.

kapitoshka438 avatar kapitoshka438 commented on July 3, 2024

@christoschadjikyriakou have you tried to pass "" to bundleId in Target init?

from tuist.

kapitoshka438 avatar kapitoshka438 commented on July 3, 2024

@christoschadjikyriakou here is a working example of what, I believe, you are trying to reach. This is a simplified version of the project that I'm working on to migrate from "multiple targets" to "one target with multiple configurations" way (I also supply configurations with xcconfigs, pass different AppIcon's per config etc.)

Project.swift

import ProjectDescription

// Use Debug & Release instead of Debug-Prod & Release-Prod
let configurations: [Configuration] = [
    .debug(name: "Debug-Dev", settings: ["PRODUCT_BUNDLE_IDENTIFIER": "com.mycompany.myapp.dev"]),
    .debug(name: "Debug", settings: ["PRODUCT_BUNDLE_IDENTIFIER": "com.mycompany.myapp"]),
    .release(name: "Release-Dev", settings: ["PRODUCT_BUNDLE_IDENTIFIER": "com.mycompany.myapp.dev"]),
    .release(name: "Release", settings: ["PRODUCT_BUNDLE_IDENTIFIER": "com.mycompany.myapp"])
]

let project = Project(
    name: "MyApp",
    settings: .settings(configurations: configurations),    // configs array must go here
    targets: [
        .target(
            name: "MyApp",
            destinations: .iOS,
            product: .app,
            bundleId: "",
            infoPlist: "Info.plist",
            sources: ["MyApp/Sources/**"],
            resources: ["MyApp/Resources/**"],
            dependencies: [],
            settings: .settings(configurations: configurations)  // and here 
        )
    ],
    schemes: [
        .scheme(
            name: "Development",
            buildAction: .buildAction(targets: ["MyApp"]),
            testAction: .targets(["MyApp"]),
            runAction: .runAction(configuration: "Debug-Dev"),
            archiveAction: .archiveAction(configuration: "Release-Dev")
        ),
        .scheme(
            name: "Production",
            buildAction: .buildAction(targets: ["MyApp"]),
            testAction: .targets(["MyApp"]),
            runAction: .runAction(configuration: "Debug"),
            archiveAction: .archiveAction(configuration: "Release")
        )
    ]
)

Workspace.swift (to prevent Tuist from autogenerating extra schemes)

import ProjectDescription

let workspace = Workspace(
    name: "MyApp",
    projects: [
       "."
    ],
    generationOptions: .options(autogeneratedWorkspaceSchemes: .disabled)
)

Also, if you have SPM dependencies, you have to describe the same list of configurations in the package manifest.
Package.swift

#if TUIST
    import struct ProjectDescription.PackageSettings

let packageSettings = PackageSettings(baseSettings: .settings(configurations: [
        .debug(name: "Debug-dev"),
        .release(name: "Release-dev"),
        .debug(name: "Debug"),
        .release(name: "Release"),
    ]))
#endif

@fortmarek fyi

from tuist.

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.