Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
59ef5e23
Commit
59ef5e23
authored
Apr 03, 2018
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate bindata through make
parent
87377f87
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
47 deletions
+66
-47
Makefile.generated_files
build/root/Makefile.generated_files
+62
-1
generate-bindata.sh
hack/generate-bindata.sh
+3
-5
golang.sh
hack/lib/golang.sh
+0
-36
verify-typecheck.sh
hack/verify-typecheck.sh
+1
-3
gobindata_util.go
test/e2e/generated/gobindata_util.go
+0
-2
No files found.
build/root/Makefile.generated_files
View file @
59ef5e23
...
@@ -35,7 +35,7 @@ SHELL := /bin/bash
...
@@ -35,7 +35,7 @@ SHELL := /bin/bash
# This rule collects all the generated file sets into a single rule. Other
# This rule collects all the generated file sets into a single rule. Other
# rules should depend on this to ensure generated files are rebuilt.
# rules should depend on this to ensure generated files are rebuilt.
.PHONY
:
generated_files
.PHONY
:
generated_files
generated_files
:
gen_deepcopy gen_defaulter gen_conversion gen_openapi
generated_files
:
gen_deepcopy gen_defaulter gen_conversion gen_openapi
gen_bindata
.PHONY
:
verify_generated_files
.PHONY
:
verify_generated_files
verify_generated_files
:
verify_gen_deepcopy
\
verify_generated_files
:
verify_gen_deepcopy
\
...
@@ -805,3 +805,64 @@ sinclude $(META_DIR)/$(OPENAPI_GEN).mk
...
@@ -805,3 +805,64 @@ sinclude $(META_DIR)/$(OPENAPI_GEN).mk
$(OPENAPI_GEN)
:
$(OPENAPI_GEN)
:
hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/openapi-gen
hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/openapi-gen
touch
$@
touch
$@
#
# bindata generation
#
# The tool used to generate bindata files.
BINDATA_GEN
:=
$(BIN_DIR)
/go-bindata
# A wrapper script that generates all bindata files. It is fast enough that we
# don't care.
BINDATA_SCRIPT
:=
hack/generate-bindata.sh
# This rule is the user-friendly entrypoint for bindata generation.
.PHONY
:
gen_bindata
gen_bindata
:
$(BINDATA_GEN) FORCE
./hack/run-in-gopath.sh
$(BINDATA_SCRIPT)
FORCE
:
# This calculates the dependencies for the generator tool, so we only rebuild
# it when needed. It is PHONY so that it always runs, but it only updates the
# file if the contents have actually changed. We 'sinclude' this later.
.PHONY
:
$(META_DIR)/$(BINDATA_GEN).mk
$(META_DIR)/$(BINDATA_GEN).mk
:
mkdir
-p
$
(
@D
)
;
\
(
echo
-n
"
$(BINDATA_GEN)
: "
;
\
./hack/run-in-gopath.sh go list
\
-f
'{{.ImportPath}}{{"\n"}}{{range .Deps}}{{.}}{{"\n"}}{{end}}'
\
./vendor/github.com/jteeuwen/go-bindata/go-bindata
\
|
grep
--color
=
never
"^
$(PRJ_SRC_PATH)
/"
\
| xargs ./hack/run-in-gopath.sh go list
\
-f
'{{$$d := .Dir}}{{$$d}}{{"\n"}}{{range .GoFiles}}{{$$d}}/{{.}}{{"\n"}}{{end}}'
\
|
paste
-sd
' '
-
\
|
sed
's/ / \\=,/g'
\
|
tr
'=,'
'\n\t'
\
|
sed
"s|
$$
(pwd -P)/||"
;
\
)
>
$@
.tmp
;
\
if
!
cmp
-s
$@
.tmp
$@
;
then
\
if
[[
"
$(DBG_CODEGEN)
"
==
1
]]
;
then
\
echo
"DBG:
$(BINDATA_GEN)
.mk changed"
;
\
fi
;
\
cat
$@
.tmp
>
$@
;
\
rm
-f
$@
.tmp
;
\
fi
# Include dependency info for the generator tool. This will cause the rule of
# the same name to be considered and if it is updated, make will restart.
sinclude
$(META_DIR)/$(BINDATA_GEN).mk
# How to build the generator tool. The deps for this are defined in
# the $(BINDATA_GEN).mk, above.
#
# A word on the need to touch: This rule might trigger if, for example, a
# non-Go file was added or deleted from a directory on which this depends.
# This target needs to be reconsidered, but Go realizes it doesn't actually
# have to be rebuilt. In that case, make will forever see the dependency as
# newer than the binary, and try to rebuild it over and over. So we touch it,
# and make is happy.
$(BINDATA_GEN)
:
hack/make-rules/build.sh ./vendor/github.com/jteeuwen/go-bindata/go-bindata
touch
$@
hack/generate-bindata.sh
View file @
59ef5e23
...
@@ -18,10 +18,8 @@ set -o errexit
...
@@ -18,10 +18,8 @@ set -o errexit
set
-o
pipefail
set
-o
pipefail
set
-o
nounset
set
-o
nounset
if
[[
-z
"
${
KUBE_ROOT
:-}
"
]]
;
then
export
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
KUBE_ROOT
=
$(
dirname
"
${
BASH_SOURCE
}
"
)
/..
source
"
${
KUBE_ROOT
}
/hack/lib/init.sh"
fi
source
"
${
KUBE_ROOT
}
/hack/lib/logging.sh"
source
"
${
KUBE_ROOT
}
/hack/lib/logging.sh"
if
[[
!
-d
"
${
KUBE_ROOT
}
/examples"
]]
;
then
if
[[
!
-d
"
${
KUBE_ROOT
}
/examples"
]]
;
then
...
@@ -31,7 +29,7 @@ fi
...
@@ -31,7 +29,7 @@ fi
# kube::golang::build_kube_toolchain installs the vendored go-bindata in
# kube::golang::build_kube_toolchain installs the vendored go-bindata in
# $GOPATH/bin, so make sure that's explicitly part of our $PATH.
# $GOPATH/bin, so make sure that's explicitly part of our $PATH.
export
PATH
=
"
${
GOPATH
}
/bin
:
${
PATH
}
"
export
PATH
=
"
${
KUBE_OUTPUT_BINPATH
}
:
${
PATH
}
"
if
!
which go-bindata &>/dev/null
;
then
if
!
which go-bindata &>/dev/null
;
then
echo
"Cannot find go-bindata."
echo
"Cannot find go-bindata."
...
...
hack/lib/golang.sh
View file @
59ef5e23
...
@@ -213,11 +213,6 @@ readonly KUBE_STATIC_LIBRARIES=(
...
@@ -213,11 +213,6 @@ readonly KUBE_STATIC_LIBRARIES=(
kubectl
kubectl
)
)
# Add any files with those //generate annotations in the array below.
readonly
KUBE_BINDATAS
=(
test
/e2e/generated/gobindata_util.go
)
kube::golang::is_statically_linked_library
()
{
kube::golang::is_statically_linked_library
()
{
local
e
local
e
for
e
in
"
${
KUBE_STATIC_LIBRARIES
[@]
}
"
;
do
[[
"
$1
"
==
*
"/
$e
"
]]
&&
return
0
;
done
;
for
e
in
"
${
KUBE_STATIC_LIBRARIES
[@]
}
"
;
do
[[
"
$1
"
==
*
"/
$e
"
]]
&&
return
0
;
done
;
...
@@ -417,25 +412,6 @@ kube::golang::place_bins() {
...
@@ -417,25 +412,6 @@ kube::golang::place_bins() {
done
done
}
}
# Builds the toolchain necessary for building kube. This needs to be
# built only on the host platform.
# TODO: Find this a proper home.
# Ideally, not a shell script because testing shell scripts is painful.
kube::golang::build_kube_toolchain
()
{
local
targets
=(
vendor/github.com/jteeuwen/go-bindata/go-bindata
)
local
binaries
binaries
=(
$(
kube::golang::binaries_from_targets
"
${
targets
[@]
}
"
)
)
kube::log::status
"Building the toolchain targets:"
"
${
binaries
[@]
}
"
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-gcflags
"
${
gogcflags
}
"
\
-ldflags
"
${
goldflags
}
"
\
"
${
binaries
[@]
:+
${
binaries
[@]
}}
"
}
# Try and replicate the native binary placement of go install without
# Try and replicate the native binary placement of go install without
# calling go install.
# calling go install.
kube::golang::outfile_for_binary
()
{
kube::golang::outfile_for_binary
()
{
...
@@ -590,18 +566,6 @@ kube::golang::build_binaries() {
...
@@ -590,18 +566,6 @@ kube::golang::build_binaries() {
fi
fi
fi
fi
# First build the toolchain before building any other targets
kube::golang::build_kube_toolchain
kube::log::status
"Generating bindata:"
"
${
KUBE_BINDATAS
[@]
}
"
for
bindata
in
"
${
KUBE_BINDATAS
[@]
}
"
;
do
# Only try to generate bindata if the file exists, since in some cases
# one-off builds of individual directories may exclude some files.
if
[[
-f
"
${
KUBE_ROOT
}
/
${
bindata
}
"
]]
;
then
go generate
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
"
${
KUBE_ROOT
}
/
${
bindata
}
"
fi
done
if
[[
"
${
parallel
}
"
==
"true"
]]
;
then
if
[[
"
${
parallel
}
"
==
"true"
]]
;
then
kube::log::status
"Building go targets for {
${
platforms
[*]
}
} in parallel (output will appear in a burst when complete):"
"
${
targets
[@]
}
"
kube::log::status
"Building go targets for {
${
platforms
[*]
}
} in parallel (output will appear in a burst when complete):"
"
${
targets
[@]
}
"
local
platform
local
platform
...
...
hack/verify-typecheck.sh
View file @
59ef5e23
...
@@ -25,9 +25,7 @@ kube::golang::verify_go_version
...
@@ -25,9 +25,7 @@ kube::golang::verify_go_version
cd
"
${
KUBE_ROOT
}
"
cd
"
${
KUBE_ROOT
}
"
if
[[
!
-f
test
/e2e/generated/bindata.go
]]
;
then
make
--no-print-directory
-C
"
${
KUBE_ROOT
}
"
generated_files
make
--no-print-directory
-C
"
${
KUBE_ROOT
}
"
verify_generated_files
fi
ret
=
0
ret
=
0
go run
test
/typecheck/main.go
"
$@
"
||
ret
=
$?
go run
test
/typecheck/main.go
"
$@
"
||
ret
=
$?
...
...
test/e2e/generated/gobindata_util.go
View file @
59ef5e23
...
@@ -16,8 +16,6 @@ limitations under the License.
...
@@ -16,8 +16,6 @@ limitations under the License.
package
generated
package
generated
//go:generate ../../../hack/generate-bindata.sh
import
"github.com/golang/glog"
import
"github.com/golang/glog"
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment