From 03afcf87a2b353142e75bc6668b49318216d1aed Mon Sep 17 00:00:00 2001 From: msclock Date: Tue, 6 Feb 2024 10:09:59 +0800 Subject: [PATCH] chore: optimize project configuration (#58) * chore: fix and simlify devcontainer Signed-off-by: msclock * chore: simplify .editorconfig Signed-off-by: msclock * chore: optimize dependencies declaration Signed-off-by: msclock --------- Signed-off-by: msclock --- .devcontainer/devcontainer.json | 5 +-- .editorconfig | 5 +-- template/.editorconfig | 5 +-- .../devcontainer.json.jinja | 5 +-- template/vcpkg.json.jinja | 42 +++++++++++++------ vcpkg.json | 22 ++++++---- 6 files changed, 49 insertions(+), 35 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b2b979f9..6d7cd064 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,8 +1,8 @@ // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp +// https://github.com/devcontainers/images/tree/main/src/base-ubuntu { "name": "ss-cpp", - "image": "mcr.microsoft.com/devcontainers/base:jammy", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "capAdd": [ // Enable ptrace-based debugging for C++ "SYS_PTRACE" @@ -18,7 +18,6 @@ "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {}, "ghcr.io/devcontainers/features/python:1": {}, - "ghcr.io/dhoeric/features/act:1": {}, "ghcr.io/msclock/features/vcpkg:1": {}, "ghcr.io/devcontainers/features/common-utils:2": { "username": "vscode" diff --git a/.editorconfig b/.editorconfig index 718ddc7b..4f6c70c7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,14 +10,11 @@ indent_style = space insert_final_newline = true trim_trailing_whitespace = true -[*.{yml,yaml,json,toml,jinja,css,js}] +[*.{yml,yaml,json,toml,jinja,css,js,cmake}] indent_size = 2 [CMakeLists.txt] indent_size = 2 -[*.cmake] -indent_size = 2 - [Makefile] indent_style = tab diff --git a/template/.editorconfig b/template/.editorconfig index 718ddc7b..4f6c70c7 100644 --- a/template/.editorconfig +++ b/template/.editorconfig @@ -10,14 +10,11 @@ indent_style = space insert_final_newline = true trim_trailing_whitespace = true -[*.{yml,yaml,json,toml,jinja,css,js}] +[*.{yml,yaml,json,toml,jinja,css,js,cmake}] indent_size = 2 [CMakeLists.txt] indent_size = 2 -[*.cmake] -indent_size = 2 - [Makefile] indent_style = tab diff --git a/template/[% if create_devcontainer == true %].devcontainer[% endif %]/devcontainer.json.jinja b/template/[% if create_devcontainer == true %].devcontainer[% endif %]/devcontainer.json.jinja index 9c56aded..a7f5681d 100644 --- a/template/[% if create_devcontainer == true %].devcontainer[% endif %]/devcontainer.json.jinja +++ b/template/[% if create_devcontainer == true %].devcontainer[% endif %]/devcontainer.json.jinja @@ -1,8 +1,8 @@ // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/cpp +// https://github.com/devcontainers/images/tree/main/src/base-ubuntu { "name": "{{ repo_name }}", - "image": "mcr.microsoft.com/devcontainers/base:jammy", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "capAdd": [ // Enable ptrace-based debugging for C++ "SYS_PTRACE" @@ -18,7 +18,6 @@ "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {}, "ghcr.io/devcontainers/features/python:1": {}, - "ghcr.io/dhoeric/features/act:1": {}, "ghcr.io/msclock/features/vcpkg:1": {}, "ghcr.io/devcontainers/features/common-utils:2": { "username": "vscode" diff --git a/template/vcpkg.json.jinja b/template/vcpkg.json.jinja index 817a340f..d2b6e359 100644 --- a/template/vcpkg.json.jinja +++ b/template/vcpkg.json.jinja @@ -2,46 +2,62 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "{{ repo_name }}", "description": "{{ project_description }}", - "builtin-baseline": "fe1e9f508ee13ed3d0a7d318beac7efe1ec4f9d7", + "builtin-baseline": "80403036a665cb8fcc1a1b3e17593d20b03b2489", "dependencies": [ +[%- if add_compile_target == true or add_executable_target == true or add_header_only_target == true %] + "abseil", +[%- endif %] +[%- if add_compile_target == true %] + "proxy", +[%- endif %] +[%- if use_conan == true %] + "cmake-conan", +[%- endif %] +[%- if use_cpm == true %] + "cmake-cpm", +[%- endif %] + "cmake-modules", + "robotology-cmake-ycm" + ], + "overrides": [ [%- if add_compile_target == true or add_executable_target == true or add_header_only_target == true %] { "name": "abseil", - "version>=": "20230802.1" + "version": "20230802.1" + }, +[%- endif %] +[%- if add_compile_target == true %] + { + "name": "proxy", + "version": "1.1.1" }, [%- endif %] [%- if use_conan == true %] { "name": "cmake-conan", - "version>=": "0.18.1" + "version": "0.18.1" }, [%- endif %] [%- if use_cpm == true %] { "name": "cmake-cpm", - "version>=": "0.38.6#2" + "version": "0.38.6#2" }, [%- endif %] { "name": "cmake-modules", - "version>=": "1.3.0" + "version": "1.3.0" }, -[%- if add_compile_target == true %] - { - "name": "proxy", - "version>=": "1.1.1" - }, -[%- endif %] { "name": "robotology-cmake-ycm", - "version>=": "0.15.3" + "version": "0.15.3" } ], "vcpkg-configuration": { "registries": [ { "kind": "git", - "baseline": "fd59f49af83f752d715a1c3d75fa06c658c40eb7", + "baseline": "b58077c46126bee7c5cd54c26a4b974055c21d2b", "repository": "https://github.com/msclock/cmake-registry", "packages": [ [%- if use_conan == true %] diff --git a/vcpkg.json b/vcpkg.json index 3f4c2e81..16f72ec2 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,30 +2,36 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "ss-cpp", "description": "A development-focused Cpp project template.", - "builtin-baseline": "fe1e9f508ee13ed3d0a7d318beac7efe1ec4f9d7", + "builtin-baseline": "80403036a665cb8fcc1a1b3e17593d20b03b2489", "dependencies": [ + "abseil", + "proxy", + "cmake-modules", + "robotology-cmake-ycm" + ], + "overrides": [ { "name": "abseil", - "version>=": "20230802.1" + "version": "20230802.1" }, { - "name": "cmake-modules", - "version>=": "1.3.0" + "name": "proxy", + "version": "1.1.1" }, { - "name": "proxy", - "version>=": "1.1.1" + "name": "cmake-modules", + "version": "1.3.0" }, { "name": "robotology-cmake-ycm", - "version>=": "0.15.3" + "version": "0.15.3" } ], "vcpkg-configuration": { "registries": [ { "kind": "git", - "baseline": "fd59f49af83f752d715a1c3d75fa06c658c40eb7", + "baseline": "b58077c46126bee7c5cd54c26a4b974055c21d2b", "repository": "https://github.com/msclock/cmake-registry", "packages": [ "cmake-modules",