Merge pull request #5 from stevestreza/vscode

Add support for Visual Studio Code with a dev container
This commit is contained in:
david-swift 2024-06-14 09:42:07 +02:00 committed by GitHub
commit d199204a53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 58 additions and 1 deletions

7
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM swift:noble
RUN touch /var/mail/ubuntu && \
chown ubuntu /var/mail/ubuntu && \
userdel -r ubuntu && \
apt-get update && \
apt-get install -y libadwaita-1.0 libadwaita-1-dev

View File

@ -0,0 +1,44 @@
{
"name": "Swift",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "false",
"username": "vscode",
"userUid": "1000",
"userGid": "1000",
"upgradePackages": "false"
},
"ghcr.io/devcontainers/features/git:1": {
"version": "os-provided",
"ppa": "false"
},
"ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"lldb.library": "/usr/lib/liblldb.so"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"sswg.swift-lang"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
.DS_Store
/.build
/.flatpak
/.flatpak-builder
/build-dir
/run

View File

@ -21,11 +21,16 @@ For designing an app icon, [App Icon Preview](https://flathub.org/apps/org.gnome
> You do not have to install any dependencies of Adwaita for Swift, including Swift, on your system.
> The Adwaita template runs in a [Flatpak](https://flatpak.org/).
> The GNOME Builder will automatically download dependencies from [Flathub](https://flathub.org).
> You can also use [Visual Studio Code](https://code.visualstudio.com/) with a Docker [dev container](https://code.visualstudio.com/docs/devcontainers/containers) hosting the Swift toolchain and Adwaita libraries.
## Usage
1. Open this project in the GNOME Builder. It will start downloading the dependencies.
2. Build and run the application using the "run" icon in the toolbar.
- GNOME Builder will start downloading dependencies when opened.
- For Visual Studio Code, enable the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), the [Swift extension](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang) and the [CodeLLDB extension](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) and reopen the project window with the dev container. It may take a couple minutes to build.
2. Build and run the application.
- For GNOME Builder, use the "run" icon in the toolbar.
- For Visual Studio Code, select the "run and debug" tab in the leftmost sidebar, and then tap the run icon next to "Debug AdwaitaTemplate".
3. Change the app's name and other information about the application in the following files (and file names):
- `README.md`
- `Package.swift`