summaryrefslogtreecommitdiffstats
path: root/modules/public
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-01-27 01:05:38 +0000
committerGitHub <noreply@github.com>2020-01-27 01:05:38 +0000
commit48abe41ea82f88235bd6a6a66f6a2d1701215b84 (patch)
treec4b42644f047f3f09314acd034f283f3804d2f68 /modules/public
parentd087f4fb735d860a394baf709f4cac5b945f9287 (diff)
downloadgitea-48abe41ea82f88235bd6a6a66f6a2d1701215b84.tar.gz
gitea-48abe41ea82f88235bd6a6a66f6a2d1701215b84.zip
Generate Bindata iff TAGS="bindata" and not up-to-date (#10004)
* Only generate bindata if necessary * Only generate bindata if they are not up-to-date * generate a hash of the fileinfo and use that to keep up-to-date * Newer test is redundant * handle missing bindata and clean * Only update hash after successful write * switch to sha1 hash * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'modules/public')
-rw-r--r--modules/public/main.go23
-rw-r--r--modules/public/public.go2
-rw-r--r--modules/public/public_bindata.go9
3 files changed, 9 insertions, 25 deletions
diff --git a/modules/public/main.go b/modules/public/main.go
deleted file mode 100644
index 707dbe2b22..0000000000
--- a/modules/public/main.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build ignore
-
-package main
-
-import (
- "log"
- "net/http"
-
- "github.com/shurcooL/vfsgen"
-)
-
-func main() {
- var fsPublic http.FileSystem = http.Dir("../../public")
- err := vfsgen.Generate(fsPublic, vfsgen.Options{
- PackageName: "public",
- BuildTags: "bindata",
- VariableName: "Assets",
- Filename: "bindata.go",
- })
- if err != nil {
- log.Fatal("%v", err)
- }
-}
diff --git a/modules/public/public.go b/modules/public/public.go
index c16c8e0009..2617d31aea 100644
--- a/modules/public/public.go
+++ b/modules/public/public.go
@@ -18,8 +18,6 @@ import (
"gitea.com/macaron/macaron"
)
-//go:generate go run -mod=vendor main.go
-
// Options represents the available options to configure the macaron handler.
type Options struct {
Directory string
diff --git a/modules/public/public_bindata.go b/modules/public/public_bindata.go
new file mode 100644
index 0000000000..68a786c767
--- /dev/null
+++ b/modules/public/public_bindata.go
@@ -0,0 +1,9 @@
+// Copyright 2020 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+//+build bindata
+
+package public
+
+//go:generate go run -mod=vendor ../../scripts/generate-bindata.go ../../public public bindata.go