From 52260536e65f4469684b1eeb82e5a0079dba6b4e Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 8 Aug 2024 18:02:05 -0500 Subject: [PATCH] contrib: Move scripts to devtools subdir. --- contrib/README.md | 32 ++------------- contrib/devtools/README.md | 41 +++++++++++++++++++ .../{ => devtools}/dcr_setup_go_workspace.sh | 6 +-- .../{ => devtools}/dcr_tmux_simnet_setup.sh | 0 docs/simnet_environment.mediawiki | 2 +- 5 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 contrib/devtools/README.md rename contrib/{ => devtools}/dcr_setup_go_workspace.sh (95%) rename contrib/{ => devtools}/dcr_tmux_simnet_setup.sh (100%) diff --git a/contrib/README.md b/contrib/README.md index 701117b165..36a358ac36 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -24,21 +24,6 @@ and related software. Provides an example service file for configuring dcrd as a background service on operating systems that use systemd for service management. -### Simulation Network (--simnet) Preconfigured Environment Setup Script - -The [dcr_tmux_simnet_setup.sh](./dcr_tmux_simnet_setup.sh) script provides a -preconfigured `simnet` environment which facilitates testing with a private test -network where the developer has full control since the difficulty levels are low -enough to generate blocks on demand and the developer owns all of the tickets -and votes on the private network. - -The environment will be housed in the `$HOME/dcrdsimnetnodes` directory by -default. This can be overridden with the `DCR_SIMNET_ROOT` environment variable -if desired. - -See the full [Simulation Network Reference](../docs/simnet_environment.mediawiki) -for more details. - ### Building and Running OCI Containers (aka Docker/Podman) The project does not officially provide container images. However, all of the @@ -46,19 +31,8 @@ necessary files to build your own lightweight non-root container image based on `scratch` from the latest source code are available in the docker directory. See [docker/README.md](./docker/README.md) for more details. -### Go Multi-Module Workspace Setup Script - -The [dcr_setup_go_workspace.sh](./dcr_setup_go_workspace.sh) script initializes -a Go multi-module workspace (via `go work init`) and adds all of the modules -provided by the dcrd repository to it (via `go work use`) on an as needed basis. -Note that workspaces require Go 1.18+. +### Developer Tools -This is useful when developing across multiple modules in the repository and -allows development environments that make use of the Go language server (aka -`gopls`), such as VSCode, to provide full support without also needing to -temporarily create replacements in the various `go.mod` files or individually -add every module. +Several developer tools are available in the [devtools](./devtools) directory. See +[devtools/README.md](./devtools/README.md) for more details. -Do note, however, that workspaces are local, so final submissions to the -repository will still require the appropriate changes to the relevant `go.mod` -files to ensure resolution outside of the workspace. diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md new file mode 100644 index 0000000000..207dc0e013 --- /dev/null +++ b/contrib/devtools/README.md @@ -0,0 +1,41 @@ +devtools +======== + +## Overview + +This consists of developer tools which may be useful when working with dcrd and +related software. + +## Contents + +### Simulation Network (--simnet) Preconfigured Environment Setup Script + +The [dcr_tmux_simnet_setup.sh](./dcr_tmux_simnet_setup.sh) +script provides a preconfigured `simnet` environment which facilitates testing +with a private test network where the developer has full control since the +difficulty levels are low enough to generate blocks on demand and the developer +owns all of the tickets and votes on the private network. + +The environment will be housed in the `$HOME/dcrdsimnetnodes` directory by +default. This can be overridden with the `DCR_SIMNET_ROOT` environment variable +if desired. + +See the full [Simulation Network Reference](../../docs/simnet_environment.mediawiki) +for more details. + +### Go Multi-Module Workspace Setup Script + +The [dcr_setup_go_workspace.sh](./dcr_setup_go_workspace.sh) +script initializes a Go multi-module workspace (via `go work init`) and adds all +of the modules provided by the dcrd repository to it (via `go work use`) on an +as needed basis. Note that workspaces require Go 1.18+. + +This is useful when developing across multiple modules in the repository and +allows development environments, such as VSCode, that make use of the Go +language server (aka `gopls`) to provide full support without also needing to +temporarily create replacements in the various `go.mod` files or individually +add every module. + +Do note, however, that workspaces are local, so final submissions to the +repository will still require the appropriate changes to the relevant `go.mod` +files to ensure resolution outside of the workspace. diff --git a/contrib/dcr_setup_go_workspace.sh b/contrib/devtools/dcr_setup_go_workspace.sh similarity index 95% rename from contrib/dcr_setup_go_workspace.sh rename to contrib/devtools/dcr_setup_go_workspace.sh index 6bf2ac9520..13fd9e0ff9 100755 --- a/contrib/dcr_setup_go_workspace.sh +++ b/contrib/devtools/dcr_setup_go_workspace.sh @@ -9,11 +9,11 @@ set -e -# Ensure the script is run from either the root of the repo or the contrib dir +# Ensure the script is run from either the root of the repo or the devtools dir SCRIPT=$(basename $0) MAIN_CODE_FILE="dcrd.go" -if [ -f "../${MAIN_CODE_FILE}" ]; then - cd .. +if [ -f "../../${MAIN_CODE_FILE}" ]; then + cd ../.. fi if [ ! -f "${MAIN_CODE_FILE}" ]; then echo "$SCRIPT: error: ${MAIN_CODE_FILE} not found in the current directory" diff --git a/contrib/dcr_tmux_simnet_setup.sh b/contrib/devtools/dcr_tmux_simnet_setup.sh similarity index 100% rename from contrib/dcr_tmux_simnet_setup.sh rename to contrib/devtools/dcr_tmux_simnet_setup.sh diff --git a/docs/simnet_environment.mediawiki b/docs/simnet_environment.mediawiki index d6eeb428ca..f9016874d3 100644 --- a/docs/simnet_environment.mediawiki +++ b/docs/simnet_environment.mediawiki @@ -41,7 +41,7 @@ it from the main network: The easiest way to get started using the simulation network is to make use of the preconfigured simnet environment setup shell script that is -[[../contrib/dcr_tmux_simnet_setup.sh|provided in the repository at contrib/dcr_tmux_simnet_setup.sh]]. +[[../contrib/devtools/dcr_tmux_simnet_setup.sh|provided in the repository at contrib/devtools/dcr_tmux_simnet_setup.sh]]. This script makes use of [https://github.com/tmux/tmux tmux], which is typically readily available on Unix and Linux platforms, to setup a