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
68 stars 22 forks source link

Add support for `systemLibrary` targets #1112

Open luispadron opened 1 week ago

luispadron commented 1 week ago

When depending on the Tidal SDK for iOS: https://github.com/tidal-music/tidal-sdk-ios

And running a build:

bazel build @swiftpkg_tidal_sdk_ios//... 

I get the following error:

ERROR: /private/var/tmp/_bazel_lpadron/9ae9416857eb79bb978de35a53d54970/external/rules_swift_package_manager~0.33.0~swift_deps~swiftpkg_grdb.swift/BUILD.bazel:31:14: in deps attribute of swift_library rule @rules_swift_package_manager~0.33.0~swift_deps~swiftpkg_grdb.swift//:GRDB.rspm: target '@rules_swift_package_manager~0.33.0~swift_deps~swiftpkg_grdb.swift//:CSQLite.rspm' does not exist
ERROR: /private/var/tmp/_bazel_lpadron/9ae9416857eb79bb978de35a53d54970/external/rules_swift_package_manager~0.33.0~swift_deps~swiftpkg_grdb.swift/BUILD.bazel:31:14: Analysis of target '@rules_swift_package_manager~0.33.0~swift_deps~swiftpkg_grdb.swift//:GRDB.rspm' failed
luispadron commented 1 week ago

Actually it might be that GRDB depends on CSQlite which is a system library dependency. Do we have support for these?

luispadron commented 1 week ago

This is actually because systemLibrary support is missing: https://github.com/cgrindel/rules_swift_package_manager/blob/8399e0f533f80da35cbb865316f5502ec1ff6cd6/swiftpkg/internal/swiftpkg_build_files.bzl#L430-L432

luispadron commented 1 week ago

This is the pgk_info.json:

{
  "default_localization": "en",
  "dependencies": [],
  "name": "GRDB",
  "path": "/private/var/tmp/_bazel_lpadron/75717e133daf65cbecb0a82714a81097/external/rules_swift_package_manager~~swift_deps~swiftpkg_grdb.swift",
  "platforms": [
    {
      "name": "ios",
      "version": "11.0"
    },
    {
      "name": "macos",
      "version": "10.13"
    },
    {
      "name": "tvos",
      "version": "11.0"
    },
    {
      "name": "watchos",
      "version": "4.0"
    }
  ],
  "products": [
    {
      "name": "CSQLite",
      "targets": [
        "CSQLite"
      ],
      "type": {
        "executable": false,
        "is_executable": false,
        "is_library": true,
        "is_plugin": false,
        "library": {
          "kind": "automatic"
        }
      }
    },
    {
      "name": "GRDB",
      "targets": [
        "GRDB"
      ],
      "type": {
        "executable": false,
        "is_executable": false,
        "is_library": true,
        "is_plugin": false,
        "library": {
          "kind": "automatic"
        }
      }
    },
    {
      "name": "GRDB-dynamic",
      "targets": [
        "GRDB"
      ],
      "type": {
        "executable": false,
        "is_executable": false,
        "is_library": true,
        "is_plugin": false,
        "library": {
          "kind": "dynamic"
        }
      }
    }
  ],
  "targets": [
    {
      "artifact_download_info": null,
      "c99name": "CSQLite",
      "clang_settings": null,
      "clang_src_info": null,
      "cxx_settings": null,
      "dependencies": [],
      "exclude_paths": [],
      "label": {
        "name": "CSQLite.rspm",
        "package": "",
        "repository_name": "@swiftpkg_grdb.swift"
      },
      "linker_settings": null,
      "module_type": "SystemLibraryTarget",
      "name": "CSQLite",
      "objc_src_info": null,
      "path": "Sources/CSQLite",
      "product_memberships": [
        "CSQLite",
        "GRDB",
        "GRDB-dynamic"
      ],
      "public_hdrs_path": null,
      "resources": [],
      "source_paths": null,
      "sources": [],
      "swift_settings": null,
      "swift_src_info": null,
      "type": "system"
    },
    {
      "artifact_download_info": null,
      "c99name": "GRDB",
      "clang_settings": null,
      "clang_src_info": null,
      "cxx_settings": null,
      "dependencies": [
        {
          "by_name": {
            "condition": null,
            "name": "CSQLite"
          },
          "product": null,
          "target": null
        }
      ],
      "exclude_paths": [],
      "label": {
        "name": "GRDB.rspm",
        "package": "",
        "repository_name": "@swiftpkg_grdb.swift"
      },
      "linker_settings": null,
      "module_type": "SwiftTarget",
      "name": "GRDB",
      "objc_src_info": null,
      "path": "GRDB",
      "product_memberships": [
        "GRDB",
        "GRDB-dynamic"
      ],
      "public_hdrs_path": null,
      "resources": [
        {
          "path": "GRDB/PrivacyInfo.xcprivacy",
          "rule": {
            "copy": true,
            "embed_in_code": null,
            "process": null
          }
        }
      ],
      "source_paths": null,
      "sources": [
        "Core/Configuration.swift",
        "Core/Cursor.swift",
        "Core/Database+Schema.swift",
        "Core/Database+Statements.swift",
        "Core/Database.swift",
        "Core/DatabaseBackupProgress.swift",
        "Core/DatabaseCollation.swift",
        "Core/DatabaseError.swift",
        "Core/DatabaseFunction.swift",
        "Core/DatabasePool.swift",
        "Core/DatabasePublishers.swift",
        "Core/DatabaseQueue.swift",
        "Core/DatabaseReader.swift",
        "Core/DatabaseRegion.swift",
        "Core/DatabaseRegionObservation.swift",
        "Core/DatabaseSchemaCache.swift",
        "Core/DatabaseSnapshot.swift",
        "Core/DatabaseSnapshotPool.swift",
        "Core/DatabaseValue.swift",
        "Core/DatabaseValueConvertible.swift",
        "Core/DatabaseWriter.swift",
        "Core/FetchRequest.swift",
        "Core/Row.swift",
        "Core/RowAdapter.swift",
        "Core/RowDecodingError.swift",
        "Core/SQL.swift",
        "Core/SQLInterpolation.swift",
        "Core/SQLRequest.swift",
        "Core/SchedulingWatchdog.swift",
        "Core/SerializedDatabase.swift",
        "Core/Statement.swift",
        "Core/StatementAuthorizer.swift",
        "Core/StatementColumnConvertible.swift",
        "Core/Support/CoreGraphics/CGFloat.swift",
        "Core/Support/Foundation/Data.swift",
        "Core/Support/Foundation/DatabaseDateComponents.swift",
        "Core/Support/Foundation/DatabaseValueConvertible+ReferenceConvertible.swift",
        "Core/Support/Foundation/Date.swift",
        "Core/Support/Foundation/Decimal.swift",
        "Core/Support/Foundation/NSData.swift",
        "Core/Support/Foundation/NSNull.swift",
        "Core/Support/Foundation/NSNumber.swift",
        "Core/Support/Foundation/NSString.swift",
        "Core/Support/Foundation/SQLiteDateParser.swift",
        "Core/Support/Foundation/URL.swift",
        "Core/Support/Foundation/UUID.swift",
        "Core/Support/StandardLibrary/DatabaseValueConvertible+Decodable.swift",
        "Core/Support/StandardLibrary/DatabaseValueConvertible+Encodable.swift",
        "Core/Support/StandardLibrary/DatabaseValueConvertible+RawRepresentable.swift",
        "Core/Support/StandardLibrary/JSONRequiredEncoder.swift",
        "Core/Support/StandardLibrary/Optional.swift",
        "Core/Support/StandardLibrary/StandardLibrary.swift",
        "Core/TransactionClock.swift",
        "Core/TransactionObserver.swift",
        "Core/WALSnapshot.swift",
        "Core/WALSnapshotTransaction.swift",
        "Dump/Database+Dump.swift",
        "Dump/DatabaseReader+dump.swift",
        "Dump/DumpFormat.swift",
        "Dump/DumpFormats/DebugDumpFormat.swift",
        "Dump/DumpFormats/JSONDumpFormat.swift",
        "Dump/DumpFormats/LineDumpFormat.swift",
        "Dump/DumpFormats/ListDumpFormat.swift",
        "Dump/DumpFormats/QuoteDumpFormat.swift",
        "Export.swift",
        "FTS/FTS3.swift",
        "FTS/FTS3Pattern.swift",
        "FTS/FTS3TokenizerDescriptor.swift",
        "FTS/FTS4.swift",
        "FTS/FTS5.swift",
        "FTS/FTS5CustomTokenizer.swift",
        "FTS/FTS5Pattern.swift",
        "FTS/FTS5Tokenizer.swift",
        "FTS/FTS5TokenizerDescriptor.swift",
        "FTS/FTS5WrapperTokenizer.swift",
        "Fixits.swift",
        "JSON/JSONColumn.swift",
        "JSON/SQLJSONExpressible.swift",
        "JSON/SQLJSONFunctions.swift",
        "Migration/DatabaseMigrator.swift",
        "Migration/Migration.swift",
        "QueryInterface/FTS3+QueryInterface.swift",
        "QueryInterface/FTS5+QueryInterface.swift",
        "QueryInterface/ForeignKey.swift",
        "QueryInterface/Request/Association/Association.swift",
        "QueryInterface/Request/Association/AssociationAggregate.swift",
        "QueryInterface/Request/Association/BelongsToAssociation.swift",
        "QueryInterface/Request/Association/HasManyAssociation.swift",
        "QueryInterface/Request/Association/HasManyThroughAssociation.swift",
        "QueryInterface/Request/Association/HasOneAssociation.swift",
        "QueryInterface/Request/Association/HasOneThroughAssociation.swift",
        "QueryInterface/Request/Association/JoinAssociation.swift",
        "QueryInterface/Request/CommonTableExpression.swift",
        "QueryInterface/Request/QueryInterfaceRequest.swift",
        "QueryInterface/Request/RequestProtocols.swift",
        "QueryInterface/SQL/Column.swift",
        "QueryInterface/SQL/DatabasePromise.swift",
        "QueryInterface/SQL/SQLAssociation.swift",
        "QueryInterface/SQL/SQLCollection.swift",
        "QueryInterface/SQL/SQLExpression.swift",
        "QueryInterface/SQL/SQLForeignKeyRequest.swift",
        "QueryInterface/SQL/SQLFunctions.swift",
        "QueryInterface/SQL/SQLOperators.swift",
        "QueryInterface/SQL/SQLOrdering.swift",
        "QueryInterface/SQL/SQLRelation.swift",
        "QueryInterface/SQL/SQLSelection.swift",
        "QueryInterface/SQL/SQLSubquery.swift",
        "QueryInterface/SQL/Table.swift",
        "QueryInterface/SQLGeneration/SQLColumnGenerator.swift",
        "QueryInterface/SQLGeneration/SQLGenerationContext.swift",
        "QueryInterface/SQLGeneration/SQLIndexGenerator.swift",
        "QueryInterface/SQLGeneration/SQLQueryGenerator.swift",
        "QueryInterface/SQLGeneration/SQLTableAlterationGenerator.swift",
        "QueryInterface/SQLGeneration/SQLTableGenerator.swift",
        "QueryInterface/SQLInterpolation+QueryInterface.swift",
        "QueryInterface/Schema/ColumnDefinition.swift",
        "QueryInterface/Schema/Database+SchemaDefinition.swift",
        "QueryInterface/Schema/ForeignKeyDefinition.swift",
        "QueryInterface/Schema/IndexDefinition.swift",
        "QueryInterface/Schema/TableAlteration.swift",
        "QueryInterface/Schema/TableDefinition.swift",
        "QueryInterface/Schema/VirtualTableModule.swift",
        "QueryInterface/TableRecord+Association.swift",
        "QueryInterface/TableRecord+QueryInterfaceRequest.swift",
        "Record/EncodableRecord+Encodable.swift",
        "Record/EncodableRecord.swift",
        "Record/FetchableRecord+Decodable.swift",
        "Record/FetchableRecord+TableRecord.swift",
        "Record/FetchableRecord.swift",
        "Record/MutablePersistableRecord+DAO.swift",
        "Record/MutablePersistableRecord+Delete.swift",
        "Record/MutablePersistableRecord+Insert.swift",
        "Record/MutablePersistableRecord+Save.swift",
        "Record/MutablePersistableRecord+Update.swift",
        "Record/MutablePersistableRecord+Upsert.swift",
        "Record/MutablePersistableRecord.swift",
        "Record/PersistableRecord+Insert.swift",
        "Record/PersistableRecord+Save.swift",
        "Record/PersistableRecord+Upsert.swift",
        "Record/PersistableRecord.swift",
        "Record/Record.swift",
        "Record/TableRecord.swift",
        "Utils/CaseInsensitiveIdentifier.swift",
        "Utils/Inflections+English.swift",
        "Utils/Inflections.swift",
        "Utils/LockedBox.swift",
        "Utils/OnDemandFuture.swift",
        "Utils/OrderedDictionary.swift",
        "Utils/Pool.swift",
        "Utils/ReadWriteBox.swift",
        "Utils/ReceiveValuesOn.swift",
        "Utils/Refinable.swift",
        "Utils/Utils.swift",
        "ValueObservation/DatabaseCancellable.swift",
        "ValueObservation/Observers/ValueConcurrentObserver.swift",
        "ValueObservation/Observers/ValueWriteOnlyObserver.swift",
        "ValueObservation/Reducers/Fetch.swift",
        "ValueObservation/Reducers/Map.swift",
        "ValueObservation/Reducers/RemoveDuplicates.swift",
        "ValueObservation/Reducers/Trace.swift",
        "ValueObservation/Reducers/ValueReducer.swift",
        "ValueObservation/SharedValueObservation.swift",
        "ValueObservation/ValueObservation.swift",
        "ValueObservation/ValueObservationScheduler.swift"
      ],
      "swift_settings": {
        "defines": [
          {
            "condition": null,
            "kind": "define",
            "values": [
              "SQLITE_ENABLE_FTS5"
            ]
          }
        ],
        "experimental_features": [],
        "unsafe_flags": []
      },
      "swift_src_info": {
        "discovered_res_files": [],
        "has_objc_directive": true
      },
      "type": "regular"
    }
  ],
  "tools_version": "5.7.0"
}