fireplusteam / ios-swift-for-vs-code

VSCode extension to Develop iOS applications
https://marketplace.visualstudio.com/items?itemName=FirePlusTeam.vscode-ios
MIT License
27 stars 0 forks source link

Add ability to select debug configuration #2

Closed lelonco closed 5 months ago

lelonco commented 7 months ago

It would be nice to have the ability to select a configuration or modify a build command. To build my project I use this command

rm -r .bundle*; xcodebuild -workspace *.xcworkspace -sdk ${command:ios-debug.targetSdk} -destination 'generic/platform=iOS Simulator' -scheme 'Test Debug' -resultBundlePath .bundle build | tee build.log | xcbeautify; xcode-build-server parse -a build.log >/dev/null 2>&1

Inside my project for this scheme default configuration is also "Test Debug". When this extension build it uses this command

xcodebuild -scheme "Test Debug" -configuration Debug -destination "id=007528CE-B4B5-4460-B5B6-3620DB73B541" -sdk iphonesimulator -resultBundlePath .vscode/.bundle "-workspace" "Test.xcworkspace"

In this case, the configuration isn't correct. And I'm getting errors.

Also would be nice to save output to file. In my opinion, it works faster. Lower output delay

fireplusteam commented 7 months ago

@lelonco , yeah it was missed as I use only Debug. Switch to feature/select_debug_config please and check if it works for you. I draft implemented this feature and pushed the changes to there

Also would be nice to save output to file

What do you mean ? build.log ? It saves logs to a file but xcode-server points xcode so you can edit/build in xcode and autocomplete would automatically update no matter which editor you use.

fireplusteam commented 7 months ago

merged to main, looks like working, let me know if you have any issue

lelonco commented 7 months ago

Still have the errors. Now it relates to -destination. Looks like the UUID that you use as a parameter for -destination relates to arm simulator, but my project needs to be built for rosetta simulator. Is it hard to add the ability to customize build command? I think many corner cases are hard to cover. You can generate default build params in the env file, as you do now. If any error with xcbuild and default parameters isn't suited user can fix it by yourself

fireplusteam commented 7 months ago

@lelonco , I run x86_64 and arm64 projects with no errors. Please try the latest changes I committed to the main branch, it was an issue with determining the identifier of the product. and also remove any cache in .vscode folder

fireplusteam commented 7 months ago

you .env file should be something like this (also device id can be changed by hand):

PROJECT_FILE="proj.xcworkspace"
PROJECT_CONFIGURATION="Debug"
PROJECT_SCHEME="project_scheme"
BUNDLE_APP_NAME="com.app.stg"
DEVICE_ID="F2A846F1-67D1-407E-87F0-7E08451C4F62"
fireplusteam commented 5 months ago

That feature was added. If you're experiencing that's it's not working, feel free to open a new one Thanks