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

[SR-15611] swiftSettings flags aren't being sent to dependencies #4368

Open
swift-ci opened this issue Dec 16, 2021 · 7 comments
Open

[SR-15611] swiftSettings flags aren't being sent to dependencies #4368

swift-ci opened this issue Dec 16, 2021 · 7 comments
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-15611
Radar None
Original Reporter fjtrujy (JIRA User)
Type Bug

Attachment: Download

Environment
  • Local computer, MacOS 12.0.1 (M1 Max), Xcode 13.2, Swift 5.5.2

  • Github CI/CD using MacOS 11.6.1, Xcode 13.1, Swift 5.5.1

  • Github CI/CD using Ubuntu 20.04.3 LTS, Swift 5.5.2

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: ca1f61b8a35887ba879066bf7ef5821c

Issue Description:

Hello,

I have been a lot of hours straggling trying to send a specific flag to one of the dependencies that I have in my project.

I have tried the following documentation from here:

https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html#swiftsetting

I see how the flag that is defined in the Package file, it is being sent properly to the source files that belong to my Package.swift, however, it is not being sent to the local and remote dependencies.

Basically, in the next package, DUMMY_FLAG is not being passed to Goodbye dependency

let package = Package(
    name: "dummy-swiftSettings",
    platforms: [
        .macOS(.v10_12)
    ],
    products: [
        .executable(name: "dummy-swiftSettings", targets: ["dummy-swiftSettings"]),
    ],
    dependencies: [
        .package(path: "Goodbye"),
    ],
    targets: [
        .executableTarget(
            name: "dummy-swiftSettings",
            dependencies: ["Goodbye"],
            swiftSettings: [.define("DUMMY_FLAG")])
    ]
)

I have attached a dummy project with this specific example, I have also created a repo in GitHub where I have implemented as well the CI/CD, I have double-checked that it wasn't an issue in my local computer.

Here you have the link:
https://github.com/fjtrujy/dummy-swiftSettings

@swift-ci
Copy link
Contributor Author

Comment by Francisco Javier Trujillo Mata (JIRA)

It is about 3 months already,

Any update?

Thanks

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
@Overcot
Copy link
Contributor

Overcot commented May 16, 2022

I narrowed it down to incorrect description.json file inside .build folder.

{
  "builtTestProducts" : [

  ],
  "copyCommands" : {

  },
  "pluginDescriptions" : [

  ],
  "swiftCommands" : {
    "C.dummy-swiftSettings-debug.module" : {
      "executable" : "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc",
      "importPath" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug",
      "inputs" : [
        {
          "kind" : "file",
          "name" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/Sources/dummy-swiftSettings/main.swift"
        },
        {
          "kind" : "file",
          "name" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/Goodbye.swiftmodule"
        }
      ],
      "isLibrary" : false,
      "moduleName" : "dummy_swiftSettings",
      "moduleOutputPath" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/dummy_swiftSettings.swiftmodule",
      "objects" : [
        "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/dummy_swiftSettings.build/main.swift.o"
      ],
      "otherArguments" : [
        "-target",
        "arm64-apple-macosx10.12",
        "-swift-version",
        "5",
        "-enable-batch-mode",
        "-index-store-path",
        "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/index/store",
        "-Onone",
        "-enable-testing",
        "-g",
        "-j8",
        "-DSWIFT_PACKAGE",
        "-DDEBUG",
        "-module-cache-path",
        "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/ModuleCache",
        "-parseable-output",
        "-Xfrontend",
        "-entry-point-function-name",
        "-Xfrontend",
        "dummy_swiftSettings_main",
        "-color-diagnostics",
        "-DDUMMY_FLAG",
        "-sdk",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk",
        "-F",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks",
        "-I",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib",
        "-L",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib"
      ],
      "outputs" : [
        {
          "kind" : "file",
          "name" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/dummy_swiftSettings.build/main.swift.o"
        },
        {
          "kind" : "file",
          "name" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/dummy_swiftSettings.swiftmodule"
        }
      ],
      "sources" : [
        "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/Sources/dummy-swiftSettings/main.swift"
      ],
      "tempsPath" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/dummy_swiftSettings.build",
      "wholeModuleOptimization" : false
    },
    "C.Goodbye-debug.module" : {
      "executable" : "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc",
      "importPath" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug",
      "inputs" : [
        {
          "kind" : "file",
          "name" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/Goodbye/Sources/Goodbye/Goodbye.swift"
        }
      ],
      "isLibrary" : true,
      "moduleName" : "Goodbye",
      "moduleOutputPath" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/Goodbye.swiftmodule",
      "objects" : [
        "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/Goodbye.build/Goodbye.swift.o"
      ],
      "otherArguments" : [
        "-target",
        "arm64-apple-macosx10.10",
        "-swift-version",
        "5",
        "-enable-batch-mode",
        "-index-store-path",
        "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/index/store",
        "-Onone",
        "-enable-testing",
        "-g",
        "-j8",
        "-DSWIFT_PACKAGE",
        "-DDEBUG",
        "-module-cache-path",
        "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/ModuleCache",
        "-parseable-output",
        "-parse-as-library",
        "-emit-objc-header",
        "-emit-objc-header-path",
        "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/Goodbye.build/Goodbye-Swift.h",
        "-color-diagnostics",
        "-sdk",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk",
        "-F",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks",
        "-I",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib",
        "-L",
        "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib"
      ],
      "outputs" : [
        {
          "kind" : "file",
          "name" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/Goodbye.build/Goodbye.swift.o"
        },
        {
          "kind" : "file",
          "name" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/Goodbye.swiftmodule"
        }
      ],
      "sources" : [
        "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/Goodbye/Sources/Goodbye/Goodbye.swift"
      ],
      "tempsPath" : "/Users/overcot/Library/Developer/Xcode/DerivedData/swift-package-manager-aeuhvwvbzxtkuuawwbxtkcnohyxc/Build/Products/Debug/.build/arm64-apple-macosx/debug/Goodbye.build",
      "wholeModuleOptimization" : false
    }
  },
  "swiftFrontendCommands" : {

  },
  "testDiscoveryCommands" : {

  }
}

As you can see the flag for C.Goodbye-debug.module is missing. I don't really know if this behavior is expected or not, but i guess the point to start from is to find where this file is created

@tomerd
Copy link
Member

tomerd commented May 16, 2022

@abertelrud @neonichu could you confirm the expected behavior in this case?

@neonichu
Copy link
Member

neonichu commented May 16, 2022

There is no propagation of flags from the client to its dependencies, so I think this behaves correctly.

@Overcot
Copy link
Contributor

Overcot commented May 16, 2022

Is this something is not discussable and then issue should be closed or to be discussed and maybe go through proposal review?

@neonichu
Copy link
Member

I think the biggest issue with doing something like this is at all is what happens if a dependency has multiple clients?

@Overcot
Copy link
Contributor

Overcot commented May 16, 2022

Yeah, i now also see problems in something like conflicting flags on different clients. Maybe then mark it as not a bug?

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

No branches or pull requests

4 participants