cgrindel / rules_swift_package_manager

Collection of utilities and Bazel rules to aid in the development and maintenance of Swift repositories using Bazel.
Apache License 2.0
70 stars 24 forks source link

Can't import AppMetrica 5.0.0+: Error in fail: in attribute 'name': this attribute has unsupported character '/' #1026

Open krypt-lx opened 3 months ago

krypt-lx commented 3 months ago

Apparently, for target AppMetricaCrashes of AppMetrica rspm generates invalid names for rules:

ERROR: /private/var/tmp/_bazel_krypt/de9844abaa047ea4e0868fa95089f211/external/rules_swift_package_manager~0.29.2~swift_deps~swiftpkg_kscrash/BUILD.bazel:238:13: in objc_library rule @rules_swift_package_manager~0.29.2~swift_deps~swiftpkg_kscrash//:KSCrash/Installations.rspm: 
Traceback (most recent call last):
    File "/virtual_builtins_bzl/common/objc/objc_library.bzl", line 39, column 25, in _objc_library_impl
    File "/virtual_builtins_bzl/common/objc/objc_library.bzl", line 34, column 25, in _validate_attributes
    File "/virtual_builtins_bzl/common/objc/objc_library.bzl", line 30, column 9, in _attribute_error
Error in fail: in attribute 'name': this attribute has unsupported character '/'
ERROR: /private/var/tmp/_bazel_krypt/de9844abaa047ea4e0868fa95089f211/external/rules_swift_package_manager~0.29.2~swift_deps~swiftpkg_kscrash/BUILD.bazel:238:13: Analysis of target '@rules_swift_package_manager~0.29.2~swift_deps~swiftpkg_kscrash//:KSCrash/Installations.rspm' failed

The BUILD.bazel, indeed, contains a name with "/" in it:

objc_library(
    name = "KSCrash/Installations.rspm",
    copts = [

There are more such names in this file, so, attaching it: BUILD.bazel.txt

The line I'm using to import the package:

        .package(url: "https://github.com/appmetrica/appmetrica-sdk-ios", from: "5.2.0"),

it has multiple public targets inside, including AppMetricaCrashes

cgrindel commented 3 months ago

@krypt-lx Can you provide a repro with the failure? Perhaps, add it to an existing example and create a draft PR?

krypt-lx commented 3 months ago

Will create an example project, once I have the time