Commit Graph

179 Commits

Author SHA1 Message Date
Qi Xiao
ff169505be Format Markdown files with elvmdfmt. 2022-11-06 12:39:10 +00:00
Qi Xiao
d7c5e35d39 README: Update and expand build instructions.
- Document the more standard way of building Elvish with "go install".

- Document how to build a variant.

- Remove reference to Make targets in the README.

  CONTRIBUTING.md still high-level reference to the Makefile. Users who need to
  build Elvish are never required to use make, and contributors should be able
  to read the Makefile.
2022-09-19 14:51:22 +01:00
Qi Xiao
f16c17bc69 Makefile: Support changing the package "get" builds with ELVISH_MAKE_PKG. 2022-09-19 11:30:47 +01:00
Qi Xiao
cfcef9ec51 pkg/buildinfo: Use Go's buildinfo to derive version of development builds.
This allows the build commands in Makefile and tools/buildall.sh to be
simplified.

Official reproducible builds are now handled as a build variant, and the command
in Makefile no longer tries to produce reproducible builds.

Instructions in PACKAGING.md have been completely rewritten.
2022-04-02 18:18:24 +01:00
Qi Xiao
dc700611cf Fix "make get" on Windows.
- Avoid problems with backslashes by replacing them with slashes.

- Add the .exe extension with go env GOEXE.

Also respect $GOBIN if set.
2022-03-05 13:09:10 +00:00
Qi Xiao
9185e04b69 Add a tool to check "forbidden" content.
Also add a Makefile target and CI task for it.
2022-02-20 23:22:33 +00:00
Qi Xiao
1d36d299b8 Put flags for prettier in .prettierrc.
Also reformat tools/checkstyle-md.sh.
2021-12-28 12:54:30 +00:00
Qi Xiao
37af835556 Makefile: Add a codespell target that uses "--skip .git". 2021-08-22 23:40:19 +01:00
Qi Xiao
c849d83164 Fix test of website/cmd/elvdoc, and add it to CI and the test target.
The website directory is a separate Go module, so it's not included by ./... and
tests there have to be run explicitly.
2021-08-21 16:51:19 +01:00
Qi Xiao
671c76be00 Add a lint Makefile target and CI task.
Both run staticcheck and go vet (but not golint).

Also make some small changes necessary to make the codebase lint-free under
staticcheck.
2021-07-08 00:13:38 +01:00
Qi Xiao
4052789230 Add a vet target to Makefile, and a vet job to GitHub CI. 2021-07-03 20:38:49 +01:00
Qi Xiao
464bdf58d1 Fixup for #1338. 2021-06-20 22:05:18 +01:00
Kolby Crouch
917b6eeefc Add plugin support 2021-06-20 21:11:32 +01:00
Qi Xiao
a8626bce1b Fixup for #1339
- Use explict ./ for consistency when invoking the script

- Rename script to "prune-cover.sh"

- Build ignore pattern in temporary file, and use grep -f to read it

- Use grep -F for correctness (path can contain dots)

- Add comment in .codecov.yml
2021-06-20 16:39:36 +01:00
Kurtis Rader
c64e2ebfa9 make cover now ignores same files as Codecov
Running `make cover` includes code in its report that is explicitly
excluded from the https://codecov.io/gh/elves/elvish/ report. This change
causes both reports to include/exclude the same source files.
2021-06-20 16:18:28 +01:00
Qi Xiao
78ac59cbfc Update some comments in Makefile. 2021-06-09 01:11:09 +01:00
Qi Xiao
7d2130141b Make gofmt -s part of checkstyle-go.sh and the style target in Makefile.
Also fix the comment in checkstyle-go.sh, it got the behavior of go{imports fmt}
-d the other way around.
2021-06-09 01:06:00 +01:00
Qi Xiao
201fcc009a Makefile: Change the "get" target to use "go build".
The target defauls to $GOPATH/bin/elvish to emulate the behavior of "go get",
but can be overriden by the ELVISH_MAKE_BIN environment variable.
2021-06-06 22:29:30 +01:00
Qi Xiao
b235dc10ff Use a dedicated script to determine whether to use race detector.
This makes the output of "make test" cleaner, and only show the command that
was actually run (instead of a shell if statement).

Also use the race detector on more supported platforms.
2021-05-05 22:43:38 +01:00
Qi Xiao
5f9f55edc6 Makefile: diff against HEAD to decide if the repo is dirty. 2021-02-11 01:52:10 +00:00
Qi Xiao
fab4e82ed1 Makefile: Remove -buildmode=pie from the go command. 2021-01-31 02:52:27 +00:00
Qi Xiao
a407366060 Further restrict PIE to platforms that support it without requiring CGo. 2021-01-31 01:09:05 +00:00
Qi Xiao
be158bc0d3 Only build with -buildmode=pie on Linux on Windows.
Other platforms either don't support -buildmode=pie or require CGo.
2021-01-31 00:54:30 +00:00
Qi Xiao
f52285eea2
Makefile: Avoid unportable "echo -n" 2021-01-30 21:53:22 +00:00
Qi Xiao
050863fbba Makefile: Pass CGO_ENABLED=0 in the "get" target. 2021-01-30 18:29:31 +00:00
Qi Xiao
ec68d73668 Require development builds to include the full commit hash. 2021-01-30 18:13:10 +00:00
Qi Xiao
061af54b0f Makefile: Only run go test with -race if cgo is enabled. 2021-01-30 12:13:02 +00:00
Qi Xiao
29e949832c Add -buildinfo=pie to flags for reproducible builds. 2021-01-28 19:59:29 +00:00
Qi Xiao
91bdaaf629 Change how version information is overriden.
The mechanism is now documented in PACKAGING.md.

Also refactor tools/buildall.sh to make it easy to make reproducible builds, and
fix tools/cirrus-deploy.sh.
2021-01-28 14:41:34 +00:00
Qi Xiao
22e4315eb1 Move the main package to cmd/elvish.
Now that the module path is "src.elv.sh", doing a "go get" will install the
Elvish binary as "src.elv.sh"; this is not what we want, so move the main
package into a package called "elvish".

Also update "go get" and "go build" commands accordingly.
2021-01-27 01:35:01 +00:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Kurtis Rader
ad558b1e0d Include cross-package invocations in test coverage
The default behavior of `go test -cover` ignores coverage by integration
tests. That is, it ignores coverage by tests in a different package. This
penalizes Elvish since Elvish has a lot of integration tests that are
meant to indirectly, but explicitly, exercise code in other packages that
do not have explicit unit tests.

This change makes the test coverage more accurate for the purposes of
this project.

Resolves #1062
Resolves #1187
2021-01-03 02:05:44 +00:00
Kurtis Rader
0c30310167 Produce actual diffs when running make checkstyle
Resolves #1117
2020-10-22 15:26:51 +01:00
Qi Xiao
ce19bca599 Makefile: Don't run go test with -race on Windows.
Running "go test -race" on Windows requires GCC, and it appears not all GCC
builds are compatible. Since we can't reliably determine whether the environment
has a good GCC for running the race detector, just don't enable it.

This resolves #1108.
2020-08-18 21:35:30 +01:00
Qi Xiao
37e36f61be Rename coverage file to "cover". 2020-08-16 17:04:02 +01:00
Kurtis Rader
79973a4aa1 Add make cover target
While working on issue #1062 I found myself wanting to generate coverage
reports on my local system. I wrote a trivial shell script to do that.
This simply converts that script into a `make` target.
2020-08-16 17:02:47 +01:00
Kurtis Rader
1b5ce7f265 Fix the handling of go test -race
The `test-race-works && go test -race || go test` formulation causes
tests to be run twice on platforms that support the `-race` option if
any test fails.

Fixes #1085
2020-08-01 23:05:59 +01:00
Qi Xiao
d2e7201163
Makefile: Simplify the "test" target.
* Call "go env" just once.

* Use grep -x to match whole line.
2020-07-27 12:24:28 +01:00
Qi Xiao
a77261e4ea Makefile: Run tests with -race only on platforms that support it.
This fixes #1075.
2020-07-25 17:03:49 +01:00
Qi Xiao
32328bb48b Simplify Makefile. 2020-07-06 22:28:49 +01:00
Qi Xiao
e2d590e48c Makefile: Split checkstyle into checkstyle-{go md}.
This will make it easy to run those steps in separate containers in Cirrus.
2020-06-24 23:08:12 +01:00
Qi Xiao
5e0ea92b3f Makefile: Add "checkstyle" target. 2020-06-24 23:00:23 +01:00
Qi Xiao
f5a32cd33b Makefile: Resurrect "buildall" as it's used by elves/up. 2020-06-14 14:03:44 +01:00
Qi Xiao
cc9d03588c Deploy to bintray from Cirrus CI, and remove Travis config. 2020-04-03 23:23:23 +01:00
Qi Xiao
08e95e107f Makefile: Update the list of PHONY targets. 2020-04-03 01:32:01 +01:00
Qi Xiao
e14fb18987 Makefile: Add a "style" rule to format Go and Markdown files.
Also document that in CONTRIBUTING.md, and run that to format existing files.
2020-04-03 01:30:49 +01:00
Qi Xiao
c1ad34dea1 Makefile: Only force CGO_ENABLED=1 if testing with -race. 2020-03-29 00:37:20 +00:00
Qi Xiao
5e1b8e9ade Makefile: Improve the test rule.
* Force CGO_ENABLED=1 required by -race.

* Disable the -race flag on Windows; AppVeyor does not like it.
2020-03-29 00:35:25 +00:00
Qi Xiao
100671b511 Makefile: Run tests with -race.
This addresses #73.
2020-03-29 00:22:20 +00:00
Qi Xiao
fccdcb2ff5 Makefile: Use -trimpath in the "get" rule now that we require Go >= 1.13. 2020-01-14 09:19:57 -05:00