Skip to content

Commit

Permalink
contrib: Move scripts to devtools subdir.
Browse files Browse the repository at this point in the history
  • Loading branch information
davecgh committed Aug 12, 2024
1 parent fc61238 commit 5226053
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 33 deletions.
32 changes: 3 additions & 29 deletions contrib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,15 @@ 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
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.
41 changes: 41 additions & 0 deletions contrib/devtools/README.md
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/simnet_environment.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5226053

Please sign in to comment.