mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
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>
This commit is contained in:
parent
d087f4fb73
commit
48abe41ea8
11 changed files with 113 additions and 76 deletions
|
@ -1,23 +0,0 @@
|
|||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/shurcooL/vfsgen"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var fsTemplates http.FileSystem = http.Dir("../../options")
|
||||
err := vfsgen.Generate(fsTemplates, vfsgen.Options{
|
||||
PackageName: "options",
|
||||
BuildTags: "bindata",
|
||||
VariableName: "Assets",
|
||||
Filename: "bindata.go",
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal("%v", err)
|
||||
}
|
||||
}
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
package options
|
||||
|
||||
//go:generate go run -mod=vendor main.go
|
||||
|
||||
type directorySet map[string][]string
|
||||
|
||||
func (s directorySet) Add(key string, value []string) {
|
||||
|
|
9
modules/options/options_bindata.go
Normal file
9
modules/options/options_bindata.go
Normal file
|
@ -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 options
|
||||
|
||||
//go:generate go run -mod=vendor ../../scripts/generate-bindata.go ../../options options bindata.go
|
Loading…
Add table
Add a link
Reference in a new issue