URI: 
       Build without the deploy feature by default - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 89bd025ebfd2c559039826641702941fc35a7fdb
   DIR parent 62567d38205a61134a6822d37a534520772419f1
  HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
       Date:   Wed, 30 Oct 2024 09:29:38 +0100
       
       Build without the deploy feature by default
       
       Build tags setup changed to:
       
       * !nodeploy => withdeploy
       * nodeploy => !withdeploy
       
       Also move the deploy feature out into its own release archives.
       
       See #12994 for the primary motivation for this change. But this also greatly reduces the number of dependencies in Hugo when you don't need this feature and cuts the binary size greatly.
       
       Fixes #12994
       
       Diffstat:
         M .github/workflows/test.yml          |       6 +++---
         M .gitignore                          |       5 +++--
         M Dockerfile                          |       4 ++--
         M commands/deploy.go                  |      17 ++---------------
         M commands/deploy_off.go              |       7 ++++---
         M deploy/cloudfront.go                |       4 ++--
         M deploy/deploy.go                    |       4 ++--
         M deploy/deploy_azure.go              |       4 ++--
         M deploy/deploy_test.go               |       4 ++--
         M deploy/deployconfig/deployConfig_t… |       4 ++--
         M deploy/google.go                    |       4 ++--
         M hugoreleaser.toml                   |      22 ++++++++++++++++++++++
         M magefile.go                         |       2 +-
         A main_withdeploy_test.go             |      29 +++++++++++++++++++++++++++++
         M testscripts/commands/gen.txt        |       5 -----
         R testscripts/commands/deploy.txt ->… |       0 
       
       16 files changed, 78 insertions(+), 43 deletions(-)
       ---
   DIR diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
       @@ -112,17 +112,17 @@ jobs:
                  sass --version;
                  mage -v check;
                env:
       -          HUGO_BUILD_TAGS: extended
       +          HUGO_BUILD_TAGS: extended,withdeploy
              - if: matrix.os == 'windows-latest'
                # See issue #11052. We limit the build to regular test (no -race flag) on Windows for now.
                name: Test
                run: |
                  mage -v test;
                env:
       -          HUGO_BUILD_TAGS: extended
       +          HUGO_BUILD_TAGS: extended,withdeploy
              - name: Build tags
                run: |
       -          go install -tags extended,nodeploy
       +          go install -tags extended
              - if: matrix.os == 'ubuntu-latest'
                name: Build for dragonfly
                run: |
   DIR diff --git a/.gitignore b/.gitignore
       @@ -1,3 +1,5 @@
        
        *.test
       -imports.*
       -\ No newline at end of file
       +imports.*
       +dist/
       +public/
   DIR diff --git a/Dockerfile b/Dockerfile
       @@ -21,8 +21,8 @@ COPY --from=xx / /
        ARG TARGETPLATFORM
        RUN xx-apk add musl-dev gcc g++ 
        
       -# Optionally set HUGO_BUILD_TAGS to "none" or "nodeploy" when building like so:
       -# docker build --build-arg HUGO_BUILD_TAGS=nodeploy .
       +# Optionally set HUGO_BUILD_TAGS to "none" or "withdeploy" when building like so:
       +# docker build --build-arg HUGO_BUILD_TAGS=withdeploy .
        #
        # We build the extended version by default.
        ARG HUGO_BUILD_TAGS="extended"
   DIR diff --git a/commands/deploy.go b/commands/deploy.go
       @@ -11,21 +11,8 @@
        // See the License for the specific language governing permissions and
        // limitations under the License.
        
       -//go:build !nodeploy
       -// +build !nodeploy
       -
       -// Copyright 2024 The Hugo Authors. All rights reserved.
       -//
       -// Licensed under the Apache License, Version 2.0 (the "License");
       -// you may not use this file except in compliance with the License.
       -// You may obtain a copy of the License at
       -// http://www.apache.org/licenses/LICENSE-2.0
       -//
       -// Unless required by applicable law or agreed to in writing, software
       -// distributed under the License is distributed on an "AS IS" BASIS,
       -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       -// See the License for the specific language governing permissions and
       -// limitations under the License.
       +//go:build withdeploy
       +// +build withdeploy
        
        package commands
        
   DIR diff --git a/commands/deploy_off.go b/commands/deploy_off.go
       @@ -11,8 +11,8 @@
        // See the License for the specific language governing permissions and
        // limitations under the License.
        
       -//go:build nodeploy
       -// +build nodeploy
       +//go:build !withdeploy
       +// +build !withdeploy
        
        // Copyright 2024 The Hugo Authors. All rights reserved.
        //
       @@ -31,6 +31,7 @@ package commands
        
        import (
                "context"
       +        "errors"
        
                "github.com/bep/simplecobra"
                "github.com/spf13/cobra"
       @@ -40,7 +41,7 @@ func newDeployCommand() simplecobra.Commander {
                return &simpleCommand{
                        name: "deploy",
                        run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
       -                        return nil
       +                        return errors.New("deploy not supported in this version of Hugo; install a release with 'withdeploy' in the archive filename or build yourself with the 'withdeploy' build tag. Also see https://github.com/gohugoio/hugo/pull/12995")
                        },
                        withc: func(cmd *cobra.Command, r *rootCommand) {
                                cmd.Hidden = true
   DIR diff --git a/deploy/cloudfront.go b/deploy/cloudfront.go
       @@ -11,8 +11,8 @@
        // See the License for the specific language governing permissions and
        // limitations under the License.
        
       -//go:build !nodeploy
       -// +build !nodeploy
       +//go:build withdeploy
       +// +build withdeploy
        
        package deploy
        
   DIR diff --git a/deploy/deploy.go b/deploy/deploy.go
       @@ -11,8 +11,8 @@
        // See the License for the specific language governing permissions and
        // limitations under the License.
        
       -//go:build !nodeploy
       -// +build !nodeploy
       +//go:build withdeploy
       +// +build withdeploy
        
        package deploy
        
   DIR diff --git a/deploy/deploy_azure.go b/deploy/deploy_azure.go
       @@ -11,8 +11,8 @@
        // See the License for the specific language governing permissions and
        // limitations under the License.
        
       -//go:build !solaris && !nodeploy
       -// +build !solaris,!nodeploy
       +//go:build !solaris && withdeploy
       +// +build !solaris,withdeploy
        
        package deploy
        
   DIR diff --git a/deploy/deploy_test.go b/deploy/deploy_test.go
       @@ -11,8 +11,8 @@
        // See the License for the specific language governing permissions and
        // limitations under the License.
        
       -//go:build !nodeploy
       -// +build !nodeploy
       +//go:build withdeploy
       +// +build withdeploy
        
        package deploy
        
   DIR diff --git a/deploy/deployconfig/deployConfig_test.go b/deploy/deployconfig/deployConfig_test.go
       @@ -11,8 +11,8 @@
        // See the License for the specific language governing permissions and
        // limitations under the License.
        
       -//go:build !nodeploy
       -// +build !nodeploy
       +//go:build withdeploy
       +// +build withdeploy
        
        package deployconfig
        
   DIR diff --git a/deploy/google.go b/deploy/google.go
       @@ -11,8 +11,8 @@
        // See the License for the specific language governing permissions and
        // limitations under the License.
        
       -//go:build !nodeploy
       -// +build !nodeploy
       +//go:build withdeploy
       +// +build withdeploy
        
        package deploy
        
   DIR diff --git a/hugoreleaser.toml b/hugoreleaser.toml
       @@ -120,6 +120,24 @@ archive_alias_replacements = { "linux-amd64.tar.gz" = "Linux-64bit.tar.gz" }
                    goarch = "amd64"
        
        [[builds]]
       +    path = "container1/unix/extended-withdeploy"
       +
       +    [builds.build_settings]
       +        flags = ["-buildmode", "exe", "-tags", "extended,withdeploy"]
       +        env   = ["CGO_ENABLED=1"]
       +
       +    [[builds.os]]
       +        goos = "darwin"
       +        [builds.os.build_settings]
       +            env = ["CGO_ENABLED=1", "CC=o64-clang", "CXX=o64-clang++"]
       +        [[builds.os.archs]]
       +            goarch = "universal"
       +    [[builds.os]]
       +        goos = "linux"
       +        [[builds.os.archs]]
       +            goarch = "amd64"
       +
       +[[builds]]
            path = "container2/linux/extended"
        
            [builds.build_settings]
       @@ -174,6 +192,10 @@ archive_alias_replacements = { "linux-amd64.tar.gz" = "Linux-64bit.tar.gz" }
            [archives.archive_settings]
                name_template = "{{ .Project }}_extended_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}"
        [[archives]]
       +    paths = ["builds/container1/unix/extended-withdeploy/**"]
       +    [archives.archive_settings]
       +        name_template = "{{ .Project }}_extended_withdeploy_{{ .Tag | trimPrefix `v` }}_{{ .Goos }}-{{ .Goarch }}"
       +[[archives]]
            # Only extended builds in container2.
            paths = ["builds/container2/**"]
            [archives.archive_settings]
   DIR diff --git a/magefile.go b/magefile.go
       @@ -334,7 +334,7 @@ func buildFlags() []string {
        func buildTags() string {
                // To build the extended Hugo SCSS/SASS enabled version, build with
                // HUGO_BUILD_TAGS=extended mage install etc.
       -        // To build without `hugo deploy` for smaller binary, use HUGO_BUILD_TAGS=nodeploy
       +        // To build with `hugo deploy`, use HUGO_BUILD_TAGS=withdeploy
                if envtags := os.Getenv("HUGO_BUILD_TAGS"); envtags != "" {
                        return envtags
                }
   DIR diff --git a/main_withdeploy_test.go b/main_withdeploy_test.go
       @@ -0,0 +1,29 @@
       +// Copyright 2024 The Hugo Authors. All rights reserved.
       +//
       +// Licensed under the Apache License, Version 2.0 (the "License");
       +// you may not use this file except in compliance with the License.
       +// You may obtain a copy of the License at
       +// http://www.apache.org/licenses/LICENSE-2.0
       +//
       +// Unless required by applicable law or agreed to in writing, software
       +// distributed under the License is distributed on an "AS IS" BASIS,
       +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       +// See the License for the specific language governing permissions and
       +// limitations under the License.
       +
       +//go:build withdeploy
       +// +build withdeploy
       +
       +package main
       +
       +import (
       +        "testing"
       +
       +        "github.com/rogpeppe/go-internal/testscript"
       +)
       +
       +func TestWithdeploy(t *testing.T) {
       +        p := commonTestScriptsParam
       +        p.Dir = "testscripts/withdeploy"
       +        testscript.Run(t, p)
       +}
   DIR diff --git a/testscripts/commands/gen.txt b/testscripts/commands/gen.txt
       @@ -1,17 +1,12 @@
        # Test the gen commands.
       -# Note that adding new commands will require updating the NUM_COMMANDS value.
       -env NUM_COMMANDS=44
        
        hugo gen -h
        stdout 'Generate documentation for your project using Hugo''s documentation engine, including syntax highlighting for various programming languages\.'
       -
        hugo gen doc --dir clidocs
       -checkfilecount $NUM_COMMANDS clidocs
        
        hugo gen man -h
        stdout 'up-to-date man pages'
        hugo gen man --dir manpages
       -checkfilecount $NUM_COMMANDS manpages
        
        hugo gen chromastyles -h
        stdout 'Generate CSS stylesheet for the Chroma code highlighter'
   DIR diff --git a/testscripts/commands/deploy.txt b/testscripts/withdeploy/deploy.txt