skiptools / skip

Skip transpiler for creating SwiftUI apps for iOS and Android
https://skip.tools
GNU Lesser General Public License v3.0
1.52k stars 41 forks source link

Getting Started Creating an App fails to build #253

Open wcwynn opened 1 week ago

wcwynn commented 1 week ago

Following the getting started guide and creating an app, the created app fails to build. There appears to be a missing Skip output folder (or the folder is located in the wrong location).

Skip Checkup

skip checkup                                                               
[✓] Skip version 1.1.8 (= 1.1.8)
[✓] macOS version 14.5 (> 13.5.0)
[!] Error running sysctl (Intel)
[✓] Swift version 5.10 (> 5.9.0)
[✓] Xcode version 15.4 (> 15.0.0)
[✓] Xcode tools SDKs: 9
[✓] Homebrew version 4.4.0 (> 4.1.0)
[✓] Gradle version 8.10.2 (> 8.6.0)
[✓] Java version 23 (> 21.0.0)
[✓] Android Debug Bridge version 1.0.41 (> 1.0.40)
[✓] Android Studio version: 2024.2
[✓] Android tools SDKs: 1
[✓] Resolve dependencies (20.8s)
[✓] Build hello-skip (25.55s)
[✓] Test Swift (13.49s)
[✓] Test Kotlin (83.9s)
[✓] Archive iOS ipa (40.84s)
[✓] Assemble HelloSkip-release.ipa 38 KB
[✓] Verify HelloSkip-release.ipa 38 KB
[✓] Assembling Android apk (276.1s)
[✓] Verify HelloSkip-release.apk 13.9 MB
[✓] Check Swift Package (1.2s)
[✓] Check Skip Updates: 1.1.8
[!] Skip 1.1.8 checkup with 1 warning

Creating an App

skip init --appid=so.monochrome.SkipToolsEval skip-tools-eval SkipToolsEval
open skip-tools-eval/Darwin/SkipToolsEval.xcodeproj

Build Failure (skip-gradle.log.txt output)

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/dev/tree/mc-personal-projects/skip-tools-eval/Android/settings.gradle.kts' line: 36

* What went wrong:
Missing expected Skip output folder: /Users/dev/Library/Developer/Xcode/DerivedData/SourcePackages/plugins/skip-unit.output/SkipUnit/destination/skipstone/buildSrc. Run `swift build` in the root folder to create, or specify Xcode environment BUILT_PRODUCTS_DIR.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s

Missing directory and files

It seems the Android/settings.gradle.kts is expecting a directory to be located in one location when it is actually present in a different location:

~  ls /Users/dev/Library/Developer/Xcode/DerivedData/SourcePackages/plugins/skip-unit.output/SkipUnit/destination/skipstone/buildSrc                
ls: /Users/dev/Library/Developer/Xcode/DerivedData/SourcePackages/plugins/skip-unit.output/SkipUnit/destination/skipstone/buildSrc: No such file or directory
~  ls /Users/dev/Library/Developer/Xcode/DerivedData/SourcePackages/plugins/skip-unit.output/SkipUnit/destination/skipstone         
ls: /Users/dev/Library/Developer/Xcode/DerivedData/SourcePackages/plugins/skip-unit.output/SkipUnit/destination/skipstone: No such file or directory
~  ls /Users/dev/Library/Developer/Xcode/DerivedData/SourcePackages/plugins/skip-unit.output/SkipUnit/destination          
ls: /Users/dev/Library/Developer/Xcode/DerivedData/SourcePackages/plugins/skip-unit.output/SkipUnit/destination: No such file or directory

~  ls -al /Users/dev/Library/Developer/Xcode/DerivedData/SkipToolsEval-drnuzvxgpyenkpccykndkmvzksld/SourcePackages/plugins/skip-unit.output/SkipUnit/skipstone 
total 48
drwxr-xr-x  10 dev  staff    320 Oct  7 15:52 .
drwxr-xr-x   3 dev  staff     96 Oct  7 14:16 ..
-rw-r--r--   1 dev  staff    324 Oct  7 15:52 .SkipUnit.sourcehash
drwxr-xr-x   5 dev  staff    160 Oct  7 14:16 SkipUnit
-rw-r--r--   1 dev  staff  10329 Oct  7 14:16 SkipUnit.skipcode.json
-rw-r--r--   1 dev  staff      0 Oct  7 14:16 SkipUnitSwiftBridge.swift
drwxr-xr-x   5 dev  staff    160 Oct  7 15:52 buildSrc
drwxr-xr-x   3 dev  staff     96 Oct  7 14:16 gradle
-rw-r--r--   1 dev  staff     78 Oct  7 14:16 gradle.properties
-rw-r--r--   1 dev  staff   2699 Oct  7 14:16 settings.gradle.kts
marcprux commented 1 week ago

Thanks for the detailed report. If you perform a clean rebuild, can you let us know if you get the same error? This has been an intermittent issue with Xcode 15 where the plugins are sometimes executed in the wrong order, and it usually goes away with a clean rebuild.

(For the record, the incorrect directory reference skip-unit.output/SkipUnit/destination/skipstone versus skip-unit.output/SkipUnit/skipstone is likely not the issue; the plugin output folders changed in Xcode 16, which means we have to check both – the error message is just referencing the final location checked, but it would have checked both locations and succeeded if either were found)

wcwynn commented 1 week ago

I tried a clean rebuild a few times but received the same error. I also completely removed the skip-tools-eval directory and tried again from scratch but unfortunately received the same error.

marcprux commented 1 week ago

How about running Xcode's File/Packages/Reset Package Caches and then doing a clean re-build?

Also, did the skip init command pass? That also tried to build the project, so if it passed and Xcode is failing, then something is amiss. If you open the Terminal and cd to the package folder and run skip export, does it pass? If not, can you post the failure log?

wcwynn commented 6 days ago

How about running Xcode's File/Packages/Reset Package Caches and then doing a clean re-build?

Unfortunately, this did not resolve the problem.

Also, did the skip init command pass?

Yes, it seemed to pass.

If you open the Terminal and cd to the package folder and run skip export, does it pass?

Yes, it seemed to pass.

Here is the output:

~/tree/mc-personal-projects/skip-tools-eval  skip export       
[✓] Check Swift Package (1.29s)
[✓] Build project skip-tools-eval (12.01s)
[✓] Archive iOS ipa (28.65s)
[✓] Assemble SkipToolsEval-debug.ipa 841 KB
[✓] Archive SkipToolsEval-debug.xcarchive.zip 1.7 MB
[✓] Archive iOS ipa (26.56s)
[✓] Assemble SkipToolsEval-release.ipa 310 KB
[✓] Archive SkipToolsEval-release.xcarchive.zip 2.9 MB
[✓] Assemble Android app SkipToolsEval (283.46s)
[✓] Export SkipToolsEval-debug.apk: 70.3 MB
[✓] Export SkipToolsEval-release.apk: 13.9 MB
[✓] Bundle Android app SkipToolsEval (16.69s)
[✓] Export SkipToolsEval-debug.aab: 19 MB
[✓] Export SkipToolsEval-release.aab: 9 MB
[✓] Export project for SkipToolsEval
[✓] Archive project source SkipToolsEval-project.zip 593 KB
[✓] Skip export skip-tools-eval to ./.build/skip-export (372.37s)
[✓] Skip 1.1.8 export succeeded in 372.37s
~/tree/mc-personal-projects/skip-tools-eval 
marcprux commented 6 days ago

Hmm. Very odd.

Can you try checking out the default "Hello" sample app from https://github.com/skiptools/skipapp-hello and opening that in Xcode and seeing if that builds? If not, can you post the complete gradle error log?

wcwynn commented 6 days ago

I received the same build error for the "Hello" sample app.

skip-gradle.log.txt


FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/dev/tree/mc-personal-projects/skipapp-hello/Android/settings.gradle.kts' line: 36

* What went wrong:
Missing expected Skip output folder: /Users/dev/Library/Developer/Xcode/DerivedData/SourcePackages/plugins/skip-unit.output/SkipUnit/destination/skipstone/buildSrc. Run `swift build` in the root folder to create, or specify Xcode environment BUILT_PRODUCTS_DIR.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s

I noticed in both projects the plugins is showing in red (see image).

Screenshot 2024-10-08 at 11 32 13 AM
marcprux commented 6 days ago

Can you post the complete skip-gradle.log.txt file from when it fails (either your own project or the Hello sample)? There might be other warnings or errors in there that indicate what went wrong…

wcwynn commented 6 days ago

Please see the details of my previous message and original issue description for the skip-gradle.log.txt files. I think they are complete but if there is another file you're expecting just let me know.

marcprux commented 6 days ago

I see the excerpt of the skip-gradle.log.txt file that you posted, but I'd like to see the entire file in order to see if it contains any earlier errors or warnings. Can you attach it to this issue? You should be able to command-click on it and open it in the Finder to get the file reference.

wcwynn commented 5 days ago

Here are the files using the file reference from Finder (following your instructions). skip-gradle.log.txt skip-gradle.log.txt