Skip to content

error: Filename "R.generated.swift" used twice: in SPM library  #925

Open
@harshvishu

Description

@harshvishu

I am using R.swift in an internal library and while migrating from version 5.1.1 of R.swift from cocoapods (Podspec) to swift packge I am encountering the following error.

error: Filename "R.generated.swift" used twice: 
'/Users/xxx/Starship/DesignSystem/Sources/DesignSystem/R.generated.swift' and
'/Users/xxx/Library/Developer/Xcode/DerivedData/DesignSystem-
-------/SourcePackages/plugins/designsystem.output/DesignSystem
/RswiftGeneratePublicResources/DesignSystem/R.generated.swift' 
(in target 'DesignSystem' from project 'DesignSystem') 
note: Filenames are used to distinguish private declarations with the 
same name (in target 'DesignSystem' from project 'DesignSystem')

SPM config

// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "DesignSystem",
    platforms: [
        .iOS(.v14),
    ],
    products: [
        // Products define the executables and libraries a package produces, making them visible to other packages.
        .library(
            name: "DesignSystem",
            targets: ["DesignSystem"]),
    ],
    dependencies: [
        .package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.1.1")),
        .package(url: "https://github.com/mac-cain13/R.swift.git", .upToNextMajor(from: "7.0.0"))
    ],
    targets: [
        // Targets are the basic building blocks of a package, defining a module or a test suite.
        // Targets can depend on other targets in this package and products from dependencies.
        .target(
            name: "DesignSystem",
            dependencies: [
                "RxSwift", .product(name: "RxCocoa", package: "RxSwift"),
                .product(name: "RswiftLibrary", package: "R.swift")
            ],
            resources: [
                .process("Resources")
            ],
            plugins: [.plugin(name: "RswiftGeneratePublicResources", package: "R.swift")]
        ),
        .testTarget(
            name: "DesignSystemTests",
            dependencies: ["DesignSystem"]),
    ]
)

System Info

Xcode 15.4 (15F31d)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions