Giter Site home page Giter Site logo

Comments (7)

achew22 avatar achew22 commented on September 22, 2024 1

Huh, I get very similar errors.

 swift build
Building for debugging...
In file included from /Users/achew/Projects/stripe-ios/Stripe3DS2/Stripe3DS2/UIViewController+Stripe3DS2.m:9:
/Users/achew/Projects/stripe-ios/Stripe3DS2/Stripe3DS2/UIViewController+Stripe3DS2.h:9:9: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
In file included from /Users/achew/Projects/stripe-ios/Stripe3DS2/Stripe3DS2/UIFont+DefaultFonts.m:9:
/Users/achew/Projects/stripe-ios/Stripe3DS2/Stripe3DS2/UIFont+DefaultFonts.h:9:9: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
1 error generated.
[460/539] Compiling Stripe3DS2 UIViewController+Stripe3DS2.m

I wonder in what way I'm hodling it wrong... Let's ask stripe/stripe-ios#1983

from rules_spm.

cgrindel avatar cgrindel commented on September 22, 2024

Sorry for the delay in my response.

I think that you are running into the issue where the repository name does not match the package name. The Stripe Package.swift specifies the name of the package as Stripe. The spm_repositories rule needs to know the name of the package to set up the Bazel packages. By default, it uses the basename of the git repository. When the basename of the git repository does not match the name specified in the Package.swift, rules_spm can't find what it expects to find.

If you add the name attribute to the spm_pkg and update your BUILD file to point to @swift_pkgs//Stripe:Stripe, rules_spm should be able to fetch and start compiling the project.

spm_repositories(
    name = "swift_pkgs",
    dependencies = [
        spm_pkg(
            "https://github.com/stripe/stripe-ios.git",
            name = "Stripe",
            exact_version = "22.6.0",
            products = ["Stripe"],  # https://github.com/stripe/stripe-ios/blob/f5b0b5973aaa7ce6a2865e56f5942637cfef53f7/Package.swift#L11-L14
        ),
    ],
)

That seems to address the fetch issue. Unfortunately, I am seeing a compilation issue with the Stripe package. I'll poke at it for a minute to glean some information.

from rules_spm.

cgrindel avatar cgrindel commented on September 22, 2024

I cloned stripe/strip-ios and ran swift build. I am getting the following output:

❯ swift build
Building for debugging...
In file included from /Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/UIColor+ThirteenSupport.m:9:
/Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/UIColor+ThirteenSupport.h:9:9: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
In file included from /Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/STDSTextFieldCustomization.m:9:
'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
In file included from /Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/UIViewController+Stripe3DS2.m:9:
: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
In file included from /Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/STDSTransaction.m:9:
/Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/include/STDSTransaction.h:10:9: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
In file included from /Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/UIColor+DefaultColors.m:9:
/Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/UIColor+DefaultColors.h:9:9: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
In file included from /Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/STDSThreeDS2Service.m:18:
In file included from /Users/chuck/code/stripe/stripe-ios/Stripe3DS2/Stripe3DS2/STDSDirectoryServerCertificate.h:13:
9: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
1 error generated.
1 error generated.
[461/539] Compiling Stripe3DS2 UIColor+ThirteenSupport.m

Does building the Stripe package work for you?

from rules_spm.

achew22 avatar achew22 commented on September 22, 2024

Looking at the response from the stripe team, I think the issue is in rules_spm. I modified my import following your instructions but now I get the following output:

spm_repositories(
    name = "swift_pkgs",
    dependencies = [
        spm_pkg(
            url = "https://github.com/pointfreeco/swift-composable-architecture.git",
            exact_version = "0.38.3",
            products = ["ComposableArchitecture"],
        ),
        spm_pkg(
            "https://github.com/stripe/stripe-ios-spm.git",
            name = "Stripe",
            exact_version = "22.6.0",
            products = ["Stripe"],
        ),
        spm_pkg(
            "https://github.com/pointfreeco/combine-schedulers.git",
            exact_version = "0.6.0",
            products = ["CombineSchedulers"],
        ),
        spm_pkg(
            "https://github.com/square/Valet",
            exact_version = "4.1.2",
            products = ["Valet"],
        ),
        spm_pkg(
            "https://github.com/grpc/grpc-swift",
            exact_version = "1.7.3",
            products = ["GRPC"],
        ),
        spm_pkg(
            "https://github.com/apple/swift-nio-ssl.git",
            exact_version = "2.19.0",
            products = ["NIOSSL"],
        ),
    ],
    platforms = [
        ".iOS(.v14)",
        ".macOS(.v10_15)",
    ],
)

Note that I include the platform .iOS(.v14) which I would expect to bring in UIKit.

In file included from /private/var/tmp/_bazel_achew/86cdfd37d379cf1772409fa48c6ef35e/sandbox/darwin-sandbox/4139/execroot/__main__/bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-fastbuild-ST-4e6c2a19403f/bin/external/swift_pkgs/spm_build/checkouts/stripe-ios-spm/Stripe3DS2/Stripe3DS2/UIViewController+Stripe3DS2.m:9:
/private/var/tmp/_bazel_achew/86cdfd37d379cf1772409fa48c6ef35e/sandbox/darwin-sandbox/4139/execroot/__main__/bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-fastbuild-ST-4e6c2a19403f/bin/external/swift_pkgs/spm_build/checkouts/stripe-ios-spm/Stripe3DS2/Stripe3DS2/UIViewController+Stripe3DS2.h:9:9: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^~~~~~~~~~~~~~~
[323/851] Compiling Stripe3DS2 resource_bundle_accessor.m
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
1 error generated.
[323/851] Compiling Stripe3DS2 UIViewController+Stripe3DS2.m
[323/851] Compiling Stripe3DS2 UIView+LayoutSupport.m
[324/851] Compiling cipher.c
[325/851] Compiling aes_nohw.c
[326/851] Compiling aes128gcmsiv-x86_64.mac.x86_64.S
[327/851] Compiling printf.c
[328/851] Compiling socket.c
[329/851] Compiling pair.c
[330/851] Compiling hexdump.c
/private/var/tmp/_bazel_achew/86cdfd37d379cf1772409fa48c6ef35e/sandbox/darwin-sandbox/4139/execroot/__main__/bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-fastbuild-ST-4e6c2a19403f/bin/external/swift_pkgs/spm_build/checkouts/Valet/Sources/Valet/SecureEnclave.swift:69:26: warning: 'kSecUseOperationPrompt' was deprecated in iOS 14.0: Use kSecUseAuthenticationContext and set LAContext.localizedReason property
            secItemQuery[kSecUseOperationPrompt as String] = userPrompt
                         ^
/private/var/tmp/_bazel_achew/86cdfd37d379cf1772409fa48c6ef35e/sandbox/darwin-sandbox/4139/execroot/__main__/bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-fastbuild-ST-4e6c2a19403f/bin/external/swift_pkgs/spm_build/checkouts/Valet/Sources/Valet/SecureEnclave.swift:82:59: warning: 'kSecUseAuthenticationUIFail' was deprecated in iOS 14.0: Instead of kSecUseAuthenticationUI, use kSecUseAuthenticationContext and set LAContext.interactionNotAllowed property
        secItemQuery[kSecUseAuthenticationUI as String] = kSecUseAuthenticationUIFail
                                                          ^
/private/var/tmp/_bazel_achew/86cdfd37d379cf1772409fa48c6ef35e/sandbox/darwin-sandbox/4139/execroot/__main__/bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-fastbuild-ST-4e6c2a19403f/bin/external/swift_pkgs/spm_build/checkouts/Valet/Sources/Valet/SecureEnclave.swift:118:26: warning: 'kSecUseOperationPrompt' was deprecated in iOS 14.0: Use kSecUseAuthenticationContext and set LAContext.localizedReason property
            secItemQuery[kSecUseOperationPrompt as String] = userPrompt
                         ^
/private/var/tmp/_bazel_achew/86cdfd37d379cf1772409fa48c6ef35e/sandbox/darwin-sandbox/4139/execroot/__main__/bazel-out/ios-sim_arm64-min15.0-applebin_ios-ios_sim_arm64-fastbuild-ST-4e6c2a19403f/bin/external/swift_pkgs/spm_build/checkouts/Valet/Sources/Valet/SinglePromptSecureEnclaveValet.swift:197:30: warning: 'kSecUseOperationPrompt' was deprecated in iOS 14.0: Use kSecUseAuthenticationContext and set LAContext.localizedReason property
                secItemQuery[kSecUseOperationPrompt as String] = userPrompt
                             ^

Do you have any theories @cgrindel ?

from rules_spm.

cgrindel avatar cgrindel commented on September 22, 2024

Were you able to clone their repo and run swift build? If so, did you have to specify some additional flags (e.g. --arch)? This is a limitation of the current rules_spm implementation. It does not handle compilation for other platforms very well. Alas, this is one of the issues that spurred me to gather feedback (#157).

from rules_spm.

johndpope avatar johndpope commented on September 22, 2024

not sure it helps @achew22 - but uikit is specifically used on ios. appkit is for macos.
if you have scripts that are importing - need to determine os
#import <UIKit/UIKit.h>

https://stackoverflow.com/questions/68676690/macos-uikit-uikit-h-not-found

from rules_spm.

johndpope avatar johndpope commented on September 22, 2024

UPDATE - I see someone is using bazel + stripe here

https://github.com/fakeNetflix/pinterest-repo-xchammer/blob/1475425b7ef0992984f74e348abbe5dc1c7ce850/sample/UrlGet/Vendor/Stripe/BUILD

from rules_spm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.