Finishes imlpementing the various debug and release output

modes. For debug we always read assets from disk and ignore
the compression and memcopy options. For release mode, the
assets are all embedded and the compression/memcopy options
are taken into account.
This commit is contained in:
Jim Teeuwen 2013-10-30 02:16:14 +01:00
förälder 17f2782db6
incheckning ae16b2b3c6
3 ändrade filer med 53 tillägg och 15 borttagningar

Visa fil

@ -9,7 +9,7 @@ import (
"io"
)
// writeDebugHeader writes output file headers with the given build tags.
// writeDebugHeader writes output file headers.
// This targets debug builds.
func writeDebugHeader(w io.Writer, c *Config) {
// Write build tags, if applicable.

Visa fil

@ -11,7 +11,7 @@ import (
"os"
)
// writeReleaseHeader writes output file headers with the given build tags.
// writeReleaseHeader writes output file headers.
// This targets release builds.
func writeReleaseHeader(w io.Writer, c *Config) {
// Write build tags, if applicable.
@ -138,7 +138,6 @@ func bindata_read(data []byte, name string) []byte {
func header_uncompressed_nomemcopy(w io.Writer) {
fmt.Fprintf(w, `
import (
"log"
"reflect"
"unsafe"
)
@ -198,7 +197,22 @@ func compressed_memcopy(w io.Writer, asset *Asset, r io.Reader) {
}
func uncompressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) {
fmt.Fprintf(w, `var _%s = "`, asset.Func)
gz := gzip.NewWriter(&StringWriter{Writer: w})
io.Copy(gz, r)
gz.Close()
fmt.Fprintf(w, `"
func %s() []byte {
return bindata_read(
_%s,
%q,
)
}
`, asset.Func, asset.Func, asset.Name)
}
func uncompressed_memcopy(w io.Writer, asset *Asset, r io.Reader) {

Visa fil

@ -2,23 +2,47 @@
package main
func testdata_in_b_test_asset() []byte {
return []byte{
0x2f,0x2f,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x20,0x66,0x69,
0x6c,0x65,0x0a,
}
import (
"reflect"
"unsafe"
)
func bindata_read(data, name string) []byte {
var empty [0]byte
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
b := empty[:]
bx := (*reflect.SliceHeader)(unsafe.Pointer(&b))
bx.Data = sx.Data
bx.Len = len(data)
bx.Cap = bx.Len
return b
}
var _testdata_in_b_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
func testdata_in_b_test_asset() []byte {
return bindata_read(
_testdata_in_b_test_asset,
"../testdata/in/b/test.asset",
)
}
var _testdata_in_a_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x2a\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\xda\x3d\x49\xdd\x0c\x00\x00\x00"
func testdata_in_a_test_asset() []byte {
return []byte{
0x73,0x61,0x6d,0x70,0x6c,0x65,0x20,0x66,0x69,0x6c,0x65,0x0a,
}
return bindata_read(
_testdata_in_a_test_asset,
"../testdata/in/a/test.asset",
)
}
var _testdata_in_c_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
func testdata_in_c_test_asset() []byte {
return []byte{
0x2f,0x2f,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x20,0x66,0x69,
0x6c,0x65,0x0a,
}
return bindata_read(
_testdata_in_c_test_asset,
"../testdata/in/c/test.asset",
)
}