mirror of https://github.com/perkeep/perkeep.git
make.go: build camput, etc faster, ignoring embedded UI resources
Change-Id: I1f7f60f4d5de97f69ddaf8c370889320ca8d5efe
This commit is contained in:
parent
ee4550bff4
commit
13691c699f
3
TODO
3
TODO
|
@ -4,9 +4,6 @@ There are two TODO lists. This file (good for airplanes) and the online bug trac
|
||||||
|
|
||||||
Offline list:
|
Offline list:
|
||||||
|
|
||||||
-- make.go does too much work when just building camput. See:
|
|
||||||
$ go run make.go --targets=camlistore.org/cmd/camput -v
|
|
||||||
|
|
||||||
-- can't SIGINT (control-C) camput on at least Mac, at least under
|
-- can't SIGINT (control-C) camput on at least Mac, at least under
|
||||||
devcam? Why not?
|
devcam? Why not?
|
||||||
|
|
||||||
|
|
52
make.go
52
make.go
|
@ -146,7 +146,23 @@ func main() {
|
||||||
|
|
||||||
verifyGoVersion()
|
verifyGoVersion()
|
||||||
|
|
||||||
if *embedResources {
|
buildAll := true
|
||||||
|
targs := []string{
|
||||||
|
"camlistore.org/dev/devcam",
|
||||||
|
"camlistore.org/cmd/camget",
|
||||||
|
"camlistore.org/cmd/camput",
|
||||||
|
"camlistore.org/cmd/camtool",
|
||||||
|
"camlistore.org/server/camlistored",
|
||||||
|
}
|
||||||
|
if *targets != "" {
|
||||||
|
if t := strings.Split(*targets, ","); len(t) != 0 {
|
||||||
|
targs = t
|
||||||
|
buildAll = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
withCamlistored := stringListContains(targs, "camlistore.org/server/camlistored")
|
||||||
|
if *embedResources && withCamlistored {
|
||||||
if *verbose {
|
if *verbose {
|
||||||
log.Printf("Embedding resources...")
|
log.Printf("Embedding resources...")
|
||||||
}
|
}
|
||||||
|
@ -165,7 +181,7 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteUnwantedOldMirrorFiles(buildSrcDir)
|
deleteUnwantedOldMirrorFiles(buildSrcDir, withCamlistored)
|
||||||
|
|
||||||
tags := ""
|
tags := ""
|
||||||
if sql {
|
if sql {
|
||||||
|
@ -181,20 +197,6 @@ func main() {
|
||||||
|
|
||||||
// First install command: build just the final binaries, installed to a GOBIN
|
// First install command: build just the final binaries, installed to a GOBIN
|
||||||
// under <camlistore_root>/bin:
|
// under <camlistore_root>/bin:
|
||||||
buildAll := true
|
|
||||||
targs := []string{
|
|
||||||
"camlistore.org/dev/devcam",
|
|
||||||
"camlistore.org/cmd/camget",
|
|
||||||
"camlistore.org/cmd/camput",
|
|
||||||
"camlistore.org/cmd/camtool",
|
|
||||||
"camlistore.org/server/camlistored",
|
|
||||||
}
|
|
||||||
if *targets != "" {
|
|
||||||
if t := strings.Split(*targets, ","); len(t) != 0 {
|
|
||||||
targs = t
|
|
||||||
buildAll = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args := append(baseArgs, targs...)
|
args := append(baseArgs, targs...)
|
||||||
if buildAll {
|
if buildAll {
|
||||||
switch *buildOS {
|
switch *buildOS {
|
||||||
|
@ -304,6 +306,15 @@ func setEnv(env []string, key, value string) []string {
|
||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stringListContains(strs []string, str string) bool {
|
||||||
|
for _, s := range strs {
|
||||||
|
if s == str {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// buildSrcPath returns the full path concatenation
|
// buildSrcPath returns the full path concatenation
|
||||||
// of buildSrcDir with fromSrc.
|
// of buildSrcDir with fromSrc.
|
||||||
func buildSrcPath(fromSrc string) string {
|
func buildSrcPath(fromSrc string) string {
|
||||||
|
@ -527,7 +538,7 @@ func mirrorFile(src, dst string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteUnwantedOldMirrorFiles(dir string) {
|
func deleteUnwantedOldMirrorFiles(dir string, withCamlistored bool) {
|
||||||
filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
|
filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error stating while cleaning %s: %v", path, err)
|
log.Fatalf("Error stating while cleaning %s: %v", path, err)
|
||||||
|
@ -536,6 +547,13 @@ func deleteUnwantedOldMirrorFiles(dir string) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if !wantDestFile[path] {
|
if !wantDestFile[path] {
|
||||||
|
if !withCamlistored && (strings.Contains(path, "zembed_") || strings.Contains(path, "z_data.go")) {
|
||||||
|
// If we're not building the camlistored binary,
|
||||||
|
// no need to clean up the embedded Closure, JS,
|
||||||
|
// CSS, HTML, etc. Doing so would just mean we'd
|
||||||
|
// have to put it back into place later.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if !*quiet {
|
if !*quiet {
|
||||||
log.Printf("Deleting old file from temp build dir: %s", path)
|
log.Printf("Deleting old file from temp build dir: %s", path)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue