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

Adding the (skip'ified) Cows SPM package makes the build fail #198

Open
helje5 opened this issue Aug 17, 2024 · 15 comments
Open

Adding the (skip'ified) Cows SPM package makes the build fail #198

helje5 opened this issue Aug 17, 2024 · 15 comments

Comments

@helje5
Copy link

helje5 commented Aug 17, 2024

As per the discussion in Slack.

I create the app in Xcode (tried both 15.4 and 16b3):

helge@M2ni projects % skip init --open-xcode \
  --appid=de.zeezide.skip.tests.SkipCows \
  skip-cows \
  SkipCows
Initializing Skip application skip-cows
[✓] Resolve dependencies (41.24s)
[✓] Build skip-cows (11.77s)
[✓] Check Swift Package (0.2s)
[✓] Created module SkipCows in /Users/helge/projects/skip-cows
[✓] Opening Xcode project (0.09s)
[✓] Skip 1.0.4 init succeeded in 53.34s

I can build an run the thing in Xcode and it also shows up in the simulator. I then go to SkipCows/SkipCows/Package.swift in Xcode and add the cows dependency. This alone makes the build fail w/ 300+ errors.

Package.swift:

// swift-tools-version: 5.9
// This is a Skip (https://skip.tools) package,
// containing a Swift Package Manager project
// that will use the Skip build plugin to transpile the
// Swift Package, Sources, and Tests into an
// Android Gradle Project with Kotlin sources and JUnit tests.
import PackageDescription

let package = Package(
    name: "skip-cows",
    defaultLocalization: "en",
    platforms: [.iOS(.v16), .macOS(.v13), .tvOS(.v16), .watchOS(.v9), .macCatalyst(.v16)],
    products: [
        .library(name: "SkipCowsApp", type: .dynamic, targets: ["SkipCows"]),
    ],
    dependencies: [
        .package(url: "https://source.skip.tools/skip.git", from: "1.0.4"),
        .package(url: "https://source.skip.tools/skip-ui.git", from: "1.0.0"),
        .package(url: "https://github.com/AlwaysRightInstitute/cows.git", branch: "skip") // <===
    ],
    targets: [
        .target(name: "SkipCows", dependencies: [.product(name: "SkipUI", package: "skip-ui")], resources: [.process("Resources")], plugins: [.plugin(name: "skipstone", package: "skip")]),
        .testTarget(name: "SkipCowsTests", dependencies: ["SkipCows", .product(name: "SkipTest", package: "skip")], resources: [.process("Resources")], plugins: [.plugin(name: "skipstone", package: "skip")]),
    ]
)
@helje5
Copy link
Author

helje5 commented Aug 17, 2024

The device I configured is a "Pixel 6 API 35" in "Android Studio Koala | 2024.1.1 Patch 2", in case that might be problematic.

@helje5
Copy link
Author

helje5 commented Aug 17, 2024

Screenshot 2024-08-17 at 16 37 42
GRADLE> > Task :skipstone:SkipUI:mergeDebugNativeLibs NO-SOURCE
GRADLE> > Task :skipstone:SkipUI:copyDebugJniLibsProjectOnly UP-TO-DATE
GRADLE> > Task :skipstone:SkipCows:mergeDebugJniLibFolders UP-TO-DATE
GRADLE> > Task :skipstone:SkipCows:mergeDebugNativeLibs NO-SOURCE
GRADLE> > Task :skipstone:SkipCows:copyDebugJniLibsProjectOnly UP-TO-DATE
GRADLE> > Task :app:mergeDebugNativeLibs NO-SOURCE
GRADLE> > Task :app:stripDebugDebugSymbols NO-SOURCE
GRADLE> 
GRADLE> > Task :skipstone:SkipCows:compileDebugKotlin FAILED
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:10:13 Unresolved reference 'lib'.
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:12:13 Unresolved reference 'ui'.
/private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:10:13: error: Unresolved reference 'lib'.
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:13:13 Unresolved reference 'foundation'.
/Users/helge/projects/skip-cows/Sources/SkipCows/ContentView.swift:1:1: error: Unresolved reference 'ui'.
/private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:12:13: error: Unresolved reference 'ui'.
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:14:13 Unresolved reference 'model'.
/private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:13:13: error: Unresolved reference 'foundation'.
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:16:20 Unresolved reference 'View'.
/private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:14:13: error: Unresolved reference 'model'.
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:18:22 Unresolved reference 'wrappedValue'.
/Users/helge/projects/skip-cows/Sources/SkipCows/ContentView.swift:3:1: error: Unresolved reference 'View'.
/private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:16:20: error: Unresolved reference 'View'.
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:20:18 Unresolved reference 'wrappedValue'.
/Users/helge/projects/skip-cows/Sources/SkipCows/ContentView.swift:4:28: error: Unresolved reference 'wrappedValue'.

@marcprux
Copy link
Contributor

Very curious. That works for me – and since you aren't yet using the dependency in your target, it shouldn't be affecting the plugin in any way. Nothing in ContentView.swift is changed from the default template?

Does the same error occur if you do File/Packages/Reset Package Caches and then do a clean rebuild? Xcode 15.4 sometimes gets snarled up when packages with plugins are changed (although 16b5+ was supposed to have fixed this).

@helje5
Copy link
Author

helje5 commented Aug 17, 2024

Reset Package Caches seems to have fixed it!

@helje5
Copy link
Author

helje5 commented Aug 17, 2024

Now when I actually add the dependencies, it still doesn't work though:

GRADLE> > Task :skipstone:SkipCows:mergeDebugNativeLibs NO-SOURCE
GRADLE> > Task :skipstone:SkipCows:copyDebugJniLibsProjectOnly UP-TO-DATE
GRADLE> > Task :app:mergeDebugNativeLibs NO-SOURCE
GRADLE> > Task :app:stripDebugDebugSymbols NO-SOURCE
GRADLE> 
GRADLE> > Task :skipstone:SkipCows:compileDebugKotlin FAILED
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:10:13 Unresolved reference 'lib'.
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:12:13 Unresolved reference 'ui'.
/private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:10:13: error: Unresolved reference 'lib'.
GRADLE> e: file:///private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:13:13 Unresolved reference 'foundation'.
/Users/helge/projects/skip-cows/Sources/SkipCows/ContentView.swift:1:1: error: Unresolved reference 'ui'.
/private/tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/SourcePackages/plugins/skip-cows.output/SkipCows/skipstone/SkipCows/src/main/kotlin/skip/cows/ContentView.kt:12:13: error: Unresolved reference 'ui'.

@helje5
Copy link
Author

helje5 commented Aug 17, 2024

Did another pkg-reset and rebuild, but still doesn't go through:

GRADLE> > Task :skipstone:cows:copyDebugJniLibsProjectOnly UP-TO-DATE
GRADLE> > Task :skipstone:SkipFoundation:mergeDebugJniLibFolders UP-TO-DATE
GRADLE> > Task :skipstone:SkipFoundation:mergeDebugNativeLibs NO-SOURCE
GRADLE> > Task :skipstone:SkipFoundation:copyDebugJniLibsProjectOnly UP-TO-DATE
GRADLE> > TError: /tmp/DerivedData/SkipCows-bwcsyckojaojqggpnyxjyblxlksz/Build/Intermediates.noindex/SkipCows.build/Debug-iphonesimulator/SkipCows.build/skip-gradle.log.txt:260:0: error: The gradle command failed. Review the log for details and consult https://skip.tools/docs/faq for common solutions. Command: gradle -p ../Android launchDebug
ask :skipstone:SkipModel:mergeDebugJniLibFolders UP-TO-DATE
...
GRADLE> > Task :app:writeDebugSigningConfigVersions UP-TO-DATE
GRADLE> > Task :app:mergeLibDexDebug
GRADLE> 
GRADLE> > Task :app:compileDebugKotlin FAILED
GRADLE> e: file:///Users/helge/projects/skip-cows/Android/app/src/main/kotlin/skip/cows/Main.kt:3:13 Unresolved reference 'lib'.
GRADLE> e: file:///Users/helge/projects/skip-cows/Android/app/src/main/kotlin/skip/cows/Main.kt:4:13 Unresolved reference 'model'.
/Users/helge/projects/skip-cows/Android/app/src/main/kotlin/skip/cows/Main.kt:3:13: error: Unresolved reference 'lib'.
GRADLE> e: file:///Users/helge/projects/skip-cows/Android/app/src/main/kotlin/skip/cows/Main.kt:5:13 Unresolved reference 'foundation'.
/Users/helge/projects/skip-cows/Android/app/src/main/kotlin/skip/cows/Main.kt:4:13: error: Unresolved reference 'model'.
GRADLE> e: file:///Users/helge/projects/skip-cows/Android/app/src/main/kotlin/skip/cows/Main.kt:6:13 Unresolved reference 'ui'.
/Users/helge/projects/skip-cows/Android/app/src/main/kotlin/skip/cows/Main.kt:5:13: error: Unresolved reference 'foundation'.

@helje5
Copy link
Author

helje5 commented Aug 17, 2024

I have my DerivedData in /tmp could that have sth to do with it?

@marcprux
Copy link
Contributor

It shouldn't matter where DerivedData is, and since it worked for you in the past, it shouldn't be making any difference now.

But to be on the safe side, can you try deleting your DerivedData and re-starting Xcode?

@helje5
Copy link
Author

helje5 commented Aug 17, 2024

Just tried the whole thing at my home machine (Xcode 16b5, installing all the stuff for the first time), template projects builds and runs, but as soon as I do

        .package(url: "https://github.com/AlwaysRightInstitute/cows.git",
                 branch: "skip")

Things error out. Reset Package Caches fixes that, and it builds. But when I then actually add the dep to the app:

        .target(name: "SkipCows", dependencies: [.product(name: "SkipUI", package: "skip-ui"),.product(name: "cows", package: "cows")], resources: [.process("Resources")], plugins: [.plugin(name: "skipstone", package: "skip")]),

It still fails.

Doesn't seem machine specific but a general issue.

@marcprux
Copy link
Contributor

Hmm. Very odd. I am able to add that dependency and run a project that uses it.

If you try rebuilding a few times, is the (initial) error the same each time?

@helje5
Copy link
Author

helje5 commented Aug 17, 2024

Not sure, but it essentially doesn't work for me. I deleted Derived Data and restarted Xcode sufficient times, I think it is an actual issue with the Skip build process.

Screenshot 2024-08-17 at 23 16 45

@aabewhite
Copy link
Contributor

FWIW, adding the dependency works fine on my machine as well

@helje5
Copy link
Author

helje5 commented Aug 18, 2024

Yup, I think the question is why your setup is different to mine, making things fail. I just followed the getting started instructions, both w/ the same result 🤷‍♀️ (both Mac Mini's, M1 and M2, w/ 14.6.1 (23G93)

@aabewhite
Copy link
Contributor

Can you send us a failed build log and maybe a zipped version of your project?

All of our own libraries use SwiftPM of course, and there's nothing special about them compared to your cows library. And of course our own libraries are working for all our users, and your cow library is also working for us... so it's very odd that this isn't working for you. We'd love to get to the bottom of it.

@marcprux
Copy link
Contributor

Pinging once more about this, @helje5. We'd love to get you up and running. Or, at the very least, figure out what is causing the difference between your experience and ours with adding the external dependency…

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