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

Properties are missing input or output annotations #3

Open
luca992 opened this issue May 27, 2022 · 6 comments
Open

Properties are missing input or output annotations #3

luca992 opened this issue May 27, 2022 · 6 comments

Comments

@luca992
Copy link

luca992 commented May 27, 2022

I can't get gradle to build after adding a spm dependency:

    spm {
        macos("11") {
            dependencies {
                `package`(
                    url = "https://github.com/AFNetworking/AFNetworking.git",
                    version = "4.0.0",
                    name = "AFNetworking"
                )
            }
        }
    }

I'm using kotlin 1.6.21

> Task :shared:initializeSwiftPackageProjectOSX FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings
1 actionable task: 1 executed

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':shared:initializeSwiftPackageProjectOSX' (type 'InitializeSwiftPackageProjectTask').
  - In plugin 'com.github.pagr0m.kotlin.native.spm.plugin.KotlinSpmPlugin$Inject' type 'com.github.pagr0m.kotlin.native.spm.tasks.InitializeSwiftPackageProjectTask' property 'platformFamily.appleFamily' is missing an input or output annotation.
    
    Reason: A property without annotation isn't considered during up-to-date checking.
    
    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.
    
    Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
  - In plugin 'com.github.pagr0m.kotlin.native.spm.plugin.KotlinSpmPlugin$Inject' type 'com.github.pagr0m.kotlin.native.spm.tasks.InitializeSwiftPackageProjectTask' property 'platformFamily.dynamicPrefix' is missing an input or output annotation.
    
    Reason: A property without annotation isn't considered during up-to-date checking.
    
    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.
    
    Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
  - In plugin 'com.github.pagr0m.kotlin.native.spm.plugin.KotlinSpmPlugin$Inject' type 'com.github.pagr0m.kotlin.native.spm.tasks.InitializeSwiftPackageProjectTask' property 'platformFamily.dynamicSuffix' is missing an input or output annotation.
    
    Reason: A property without annotation isn't considered during up-to-date checking.
    
    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.
    
    Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
  - In plugin 'com.github.pagr0m.kotlin.native.spm.plugin.KotlinSpmPlugin$Inject' type 'com.github.pagr0m.kotlin.native.spm.tasks.InitializeSwiftPackageProjectTask' property 'platformFamily.exeSuffix' is missing an input or output annotation.
    
    Reason: A property without annotation isn't considered during up-to-date checking.
    
    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.
    
    Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
  - In plugin 'com.github.pagr0m.kotlin.native.spm.plugin.KotlinSpmPlugin$Inject' type 'com.github.pagr0m.kotlin.native.spm.tasks.InitializeSwiftPackageProjectTask' property 'platformFamily.staticPrefix' is missing an input or output annotation.
    
    Reason: A property without annotation isn't considered during up-to-date checking.
    
    Possible solutions:
      1. Add an input or output annotation.
      2. Mark it as @Internal.
    
    Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
@twyatt
Copy link

twyatt commented Aug 3, 2023

Unfortunately it doesn't appear that this project is maintained anymore.

I tried the https://github.com/doublesymmetry/kotlin-spm-plugin fork, which fixes the annotation issues, but then fails during temporary Xcode project creation:

https://github.com/doublesymmetry/kotlin-spm-plugin/blob/b0fe2867568d182daff17a72cec757c236ffacf0/plugin-build/plugin/src/main/java/com/doublesymmetry/kotlin/native/spm/tasks/GenerateXcodeTask.kt#L37-L38

The generate-xcodeproj option for the swift tool has long been deprecated and removed.

I attempted to switch to using xcodegen to produce a temporary project (for building a temporary framework for the cinterop) but could not get headers from the output framework.

I imagine it would take quite a bit of work to get this project in working order again. 😢

@markst
Copy link

markst commented Jun 21, 2024

@twyatt I'd be interested to try and take this on. I think it may be achievable using swift build.

However may be blocked when building libraries which depend on Obj-C.
For instance if I try to import AVFoundation:

swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios14.0-simulator"

#import <AVFoundation/AVDisplayCriteria.h>
        ^
<unknown>:0: error: could not build Objective-C module 'AVFoundation'
error: fatalError

https://forums.swift.org/t/swiftpm-swift-build-for-ios/42517/4

Building without import works fine:

swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios14.0-simulator"

Building for debugging...
<unknown>:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
<unknown>:0: warning: using sysroot for 'MacOSX' but targeting 'iPhone'
[6/6] Archiving libRadioPlayerLocal.a
Build complete! (0.43s)

@markst
Copy link

markst commented Jun 21, 2024

@markst
Copy link

markst commented Jun 21, 2024

mmm perhaps not possible with Gradle plugin, seems iOS not available:

image

@markst
Copy link

markst commented Jun 21, 2024

Using the following command I can build my Package.swift directly which produces output binary.

xcodebuild build -scheme RadioPlayerLocal -sdk "`xcrun --sdk iphonesimulator --show-sdk-path`" -destination "OS=17.1,name=iPhone 13 Pro"  

https://github.com/openbakery/gradle-xcodePlugin

https://stackoverflow.com/questions/60245159/how-can-i-build-a-swift-package-for-ios-over-command-line

@markst
Copy link

markst commented Jun 24, 2024

xcodebuild build produces a Mach-O object .o file rather than a framework/static library.

possibly need to take steps like this in order to produce a packaged XCFramework:
https://mustafa-ysf.medium.com/creating-xcframework-from-swift-package-e8af6f44501f

Also a helper here I've yet to try: https://github.com/mstfy/spm-to-xcframework

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

3 participants