From 0cfe0a5b3983949e8cead3c8038223ecc00a8707 Mon Sep 17 00:00:00 2001 From: Steve Streza Date: Thu, 13 Jun 2024 01:38:09 -0700 Subject: [PATCH 1/4] First pass at vscode --- .devcontainer/Dockerfile | 4 +++ .devcontainer/devcontainer.json | 44 +++++++++++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 49 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..ef1904b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,4 @@ +FROM swift:5.10-noble + +RUN apt-get update && \ + apt-get install -y libadwaita-1.0 libadwaita-1-dev \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..42f32e1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" +} diff --git a/.gitignore b/.gitignore index d941c7a..aa6fb19 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store /.build +/.flatpak /.flatpak-builder /build-dir /run From e8f3c6185f910ff471d8f11642e273c471e72203 Mon Sep 17 00:00:00 2001 From: Steve Streza Date: Fri, 14 Jun 2024 00:06:01 -0700 Subject: [PATCH 2/4] Fix dockerfile --- .devcontainer/Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ef1904b..90fcfd8 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,7 @@ -FROM swift:5.10-noble +FROM swift:noble -RUN apt-get update && \ - apt-get install -y libadwaita-1.0 libadwaita-1-dev \ No newline at end of file +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 From 431b843e4a69301e9bbe12923940668e3e403a57 Mon Sep 17 00:00:00 2001 From: Steve Streza Date: Fri, 14 Jun 2024 00:21:19 -0700 Subject: [PATCH 3/4] Add readme notes --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e1b88e8..d1132ec 100644 --- a/README.md +++ b/README.md @@ -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) 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` From 5d8da6198b3db5b2d7a31071edd2837b26166b0f Mon Sep 17 00:00:00 2001 From: Steve Streza Date: Fri, 14 Jun 2024 00:32:43 -0700 Subject: [PATCH 4/4] More readme notes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1132ec..f11a333 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ For designing an app icon, [App Icon Preview](https://flathub.org/apps/org.gnome 1. Open this project in the GNOME Builder. It will start downloading the dependencies. - 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) and reopen the project window with the dev container. It may take a couple minutes to build. + - 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".