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

swift build command line issue #162

Open
nex5turbo opened this issue Jun 29, 2024 · 5 comments
Open

swift build command line issue #162

nex5turbo opened this issue Jun 29, 2024 · 5 comments

Comments

@nex5turbo
Copy link

nex5turbo commented Jun 29, 2024

First of all, Thanks for your hard working!

I found an error that occurs when I try to export gradle project.
I tried this one below

$ skip init --appid=com.xyz.HelloSkip hello-skip HelloSkip

Initializing Skip library hello-skip
[✓] Create project hello-skip (0.73s)
[✓] Resolve dependencies (5.89s)
[✓] Build hello-skip (15.2s)
[✓] Created module HelloSkip in ~/Desktop/hello-skip/HelloSkip.xcodeproj

$ cd hello-skip 

$ swift build --build-tests

Fetched https://source.skip.tools/skip.git (0.92s)
…
[294/294] Linking libHelloSkip.dylib
Build complete! (23.13s)

$ skip gradle -p .build/plugins/outputs/hello-skip/HelloSkip/skipstone/HelloSkip test

GRADLE> > Task :HelloSkip:preBuild UP-TO-DATE
…
GRADLE> > Task :HelloSkip:testDebugUnitTest
GRADLE> > Task :HelloSkip:test
GRADLE> 
GRADLE> BUILD SUCCESSFUL in 20s
GRADLE> 204 actionable tasks: 204 executed
note: Gradle SUCCESSFUL

$ skip gradle -p Android/ assemble

GRADLE> > Task :app:preBuild UP-TO-DATE
GRADLE> > Task :app:preDebugBuild UP-TO-DATE
GRADLE> > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
GRADLE> > Task :app:generateDebugBuildConfig
GRADLE> > Task :HelloSkip:preBuild UP-TO-DATE
…
GRADLE> > Task :SkipUI:bundleReleaseAar
GRADLE> > Task :HelloSkip:compileDebugJavaWithJavac NO-SOURCE
…
GRADLE> > Task :app:processReleaseJavaRes
GRADLE> > Task :HelloSkip:extractDebugAnnotations
GRADLE> > Task :HelloSkip:mergeDebugGeneratedProguardFiles
GRADLE> > Task :HelloSkip:mergeDebugConsumerProguardFiles
GRADLE> > Task :SkipUI:assembleRelease
GRADLE> > Task :SkipUI:assemble
GRADLE> > Task :HelloSkip:mergeDebugJavaResource
GRADLE> > Task :app:compileDebugKotlin
GRADLE> > Task :HelloSkip:syncDebugLibJars
GRADLE> > Task :app:compileDebugJavaWithJavac
GRADLE> > Task :app:mergeReleaseJavaResource
GRADLE> > Task :app:dexBuilderDebug
GRADLE> > Task :app:processDebugJavaRes
GRADLE> > Task :app:mergeDebugGlobalSynthetics
GRADLE> > Task :app:mergeProjectDexDebug
GRADLE> > Task :app:mergeLibDexDebug
GRADLE> > Task :HelloSkip:bundleDebugAar
GRADLE> > Task :HelloSkip:assembleDebug
GRADLE> > Task :HelloSkip:assemble
GRADLE> > Task :app:mergeDebugJavaResource
GRADLE> > Task :app:minifyReleaseWithR8
GRADLE> > Task :app:shrinkReleaseRes
GRADLE> > Task :app:packageRelease
GRADLE> > Task :app:createReleaseApkListingFileRedirect
GRADLE> > Task :app:assembleRelease
GRADLE> > Task :app:assemble
GRADLE> 
GRADLE> BUILD SUCCESSFUL in 53s
GRADLE> 403 actionable tasks: 403 executed

this is the instruction in DOCS -> Gradle Projects -> Building Locally

but when I tried swift build --build-tests it shows me many error messages like below

Desktop/myMac/Apps/hello-global/Sources/HelloGlobal/ContentView.swift:68:87: error: Skip is unable to determine the owning type for member 'light'. This often occurs when other issues prevent Skip from matching the surrounding API call, and it may resolve when those issues are fixed. Or add the owning type explicitly (e.g. MyType.light)
        .preferredColorScheme(appearance == "dark" ? .dark : appearance == "light" ? .light : nil)
                                                                                      ^~~~~

In Xcode, it doesn't any matter but when I try to build with CLI, this kind of error message appears.
I tried this with `skip test' again and then saw log.

[51/64] Skip ProjectRun
[52/64] Compiling SkipDrive Version.swift
[53/64] Emitting module SkipDrive
[54/64] Compiling SkipDrive GradleHarness.swift
error: fatalError

Even error log doesn't tell me what is wrong.

I'm trying to follow your instructions in DOCS but keep failing.
Is there any doc that I can follow to make an .apk file manually?

I can manage about iOS Side with Xcode but have no idea what should I do if I want to extract .apk to test with my phone and manually upload .aab file

Thanks again and have a great day!!

@nex5turbo
Copy link
Author

Self answer....

I found the error came from ToolBarItemPlacement.
I used .topBarTrailing for all of my tool bar components, and error was also from it.

After I have removed that, build is successful.
It works in swift, but doesn't work with swift build executable.

@aabewhite
Copy link
Contributor

Are you saying that .topBarTrailing worked in full Skip Xcode builds but caused problems for Skip command-line builds? That would be very strange.

@nex5turbo
Copy link
Author

Yes build with Xcode, it doesnt matter but with
such like $swift build, $skip test, $skip export nothing works

@aabewhite
Copy link
Contributor

When you have a chance, you might want to run "brew upgrade skip" and also in Xcode use File->Packages->Update to Latest. That way you'll definitely have all the latest in both environments. Then try again.

A warning, though: we recently updated some of our build configurations, so after upgrading you might have to update your application's build.gradle.kts:

buildgradlekts

@nex5turbo
Copy link
Author

Thanks for advise aabewhite!

It works for some cases, but still doesn't work for other cases.
Unfortunately, even though I marked #if !SKIP, UIApplication is unresolved when I try to build it with command line.
And some features also, like ToolBarItemPlacement as I mentioned it at my previous comment.

I'll leave a comment if I find something!

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

2 participants