File 3089-otp-Add-configuration-for-gitpod-and-DevContainer.patch of Package erlang

From cf17282453126d7efbd2f99b019fb453ade02d5e Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Tue, 21 Dec 2021 11:10:12 +0100
Subject: [PATCH 09/11] otp: Add configuration for gitpod and DevContainer

---
 .devcontainer/devcontainer.json | 32 ++++++++++++++++++++++++++++++++
 .gitpod.yml                     |  7 +++++++
 HOWTO/DEVELOPMENT.md            | 22 ++++++++++++++++++++++
 erlang_ls.config                | 10 ++++++++++
 4 files changed, 71 insertions(+)
 create mode 100644 .devcontainer/devcontainer.json
 create mode 100644 .gitpod.yml
 create mode 100644 erlang_ls.config

diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000000..0e990b715a
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,32 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
+// https://github.com/microsoft/vscode-dev-containers/tree/v0.194.0/containers/cpp
+{
+	"name": "Erlang/OTP",
+	"build": {
+	    "dockerfile": "../.github/dockerfiles/Dockerfile.ubuntu-base",
+            "context": "../.github",
+            "args": {
+                "BASE": "mcr.microsoft.com/vscode/devcontainers/base:focal",
+                "USER": "vscode",
+                "GROUP": "vscode"
+            }
+	},
+	"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],
+
+	// Set *default* container specific settings.json values on container create.
+	"settings": {},
+
+	// Add the IDs of extensions you want installed when the container is created.
+	"extensions": [
+		"ms-vscode.cpptools",
+		"erlang-ls.erlang-ls"	],
+
+	// Use 'forwardPorts' to make a list of ports inside the container available locally.
+	// "forwardPorts": [],
+
+	// Use 'postCreateCommand' to run commands after the container is created.
+	// "postCreateCommand": "gcc -v",
+
+	// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
+	"remoteUser": "vscode"
+}
diff --git a/.gitpod.yml b/.gitpod.yml
new file mode 100644
index 0000000000..74a5155ec3
--- /dev/null
+++ b/.gitpod.yml
@@ -0,0 +1,7 @@
+image:
+  file: .github/dockerfiles/Dockerfile.ubuntu-base
+  context: .github
+vscode:
+  extensions:
+    - ms-vscode.cpptools
+    - erlang-ls.erlang-ls
diff --git a/HOWTO/DEVELOPMENT.md b/HOWTO/DEVELOPMENT.md
index 0124a17f5d..7c691d7e26 100644
--- a/HOWTO/DEVELOPMENT.md
+++ b/HOWTO/DEVELOPMENT.md
@@ -41,6 +41,7 @@ with.
 7. [Github Actions](#github-actions)
     1. [Debugging github actions failures](#debugging-github-actions-failures)
 8. [Using Docker](#using-docker)
+    1. [Gidpod.io or VSCode dev container](#gitpod-io-or-vscode-dev-container)
 
 ## Short version
 
@@ -520,3 +521,24 @@ docker run --init -v $PWD/make_test_dir:/buildroot/otp/lib/stdlib/make_test_dir
 
 The Common Test logs will be placed in `make_test_dir/ct_logs`.
 
+### Gidpod.io or VSCode dev container
+
+This git repository is also prepared to run using [Gitpod](https://gitpod.io/) or
+[VSCode Devcontainer](https://code.visualstudio.com/docs/remote/containers).
+
+The support for these environments is very early so it will be a bit unstable.
+
+To access the gitpod for Erlang/OTP you just navigate to
+[https://gitpod.io/#https://github.com/erlang/otp](https://gitpod.io/#https://github.com/erlang/otp).
+
+When using a VSCode dev container, you only need to open [VSCode](https://code.visualstudio.com/)
+in the Erlang/OTP repository and you should get a popup that asks if you want to
+run in a dev container.
+
+The gitpod and dev container both use the base ubuntu image built in [Using Docker](#using-docker).
+So it should be possible to run all tests inside the containers with all test
+dependencies available.
+
+*WARNING*: Using VSCode dev container on macOS can be very slow because of limitations
+in the filesystem. So I would recommend either using gitpod or just work locally without
+the dev container on macOS.
diff --git a/erlang_ls.config b/erlang_ls.config
new file mode 100644
index 0000000000..a695bbc92a
--- /dev/null
+++ b/erlang_ls.config
@@ -0,0 +1,10 @@
+apps_dirs:
+  - "lib/*"
+  - "erts/preloaded"
+include_dirs:
+  - "lib/*/src"
+  - "lib/*/include"
+  - "erts/preloaded/src"
+diagnostics:
+  enabled:
+    - bound_var_in_pattern
-- 
2.31.1

openSUSE Build Service is sponsored by