Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
harshvishu opened this issue Nov 21, 2024 · 0 comments
Open

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

harshvishu opened this issue Nov 21, 2024 · 0 comments

Comments

@harshvishu
Copy link

harshvishu commented Nov 21, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant