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
e93bbed8
Commit
e93bbed8
authored
Sep 29, 2016
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Verify generated files
parent
bef915da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
36 deletions
+97
-36
Makefile
Makefile
+10
-2
Makefile.generated_files
Makefile.generated_files
+87
-34
No files found.
Makefile
View file @
e93bbed8
...
...
@@ -95,7 +95,7 @@ ginkgo:
# make verify
# make verify BRANCH=branch_x
.PHONY
:
verify
verify
:
verify
:
verify_generated_files
KUBE_VERIFY_GIT_BRANCH
=
$(BRANCH)
hack/make-rules/verify.sh
-v
hack/make-rules/vet.sh
...
...
@@ -284,4 +284,12 @@ $(notdir $(abspath $(wildcard federation/cmd/*/))): generated_files
# make generated_files
.PHONY
:
generated_files
generated_files
:
$(MAKE)
-f
Makefile.
$@
$@
CALLED_FROM_MAIN_MAKEFILE
=
1
$(MAKE)
-f
Makefile.generated_files
$@
CALLED_FROM_MAIN_MAKEFILE
=
1
# Verify auto-generated files needed for the build.
#
# Example:
# make verify_generated_files
.PHONY
:
verify_generated_files
verify_generated_files
:
$(MAKE)
-f
Makefile.generated_files
$@
CALLED_FROM_MAIN_MAKEFILE
=
1
Makefile.generated_files
View file @
e93bbed8
...
...
@@ -37,6 +37,12 @@ SHELL := /bin/bash
.PHONY
:
generated_files
generated_files
:
gen_deepcopy gen_defaulter gen_conversion gen_openapi
.PHONY
:
verify_generated_files
verify_generated_files
:
verify_gen_deepcopy
\
verify_gen_defaulter
\
verify_gen_conversion
\
verify_gen_openapi
# Code-generation logic.
#
# This stuff can be pretty tricky, and there's probably some corner cases that
...
...
@@ -209,18 +215,30 @@ DEEPCOPY_DIRS := $(shell \
)
DEEPCOPY_FILES
:=
$
(
addsuffix /
$(DEEPCOPY_FILENAME)
,
$(DEEPCOPY_DIRS)
)
# Shell function for reuse in rules.
RUN_GEN_DEEPCOPY
=
\
function
run_gen_deepcopy
()
{
\
if
[[
-f
$(META_DIR)
/
$(DEEPCOPY_GEN)
.todo
]]
;
then
\
./hack/run-in-gopath.sh
$(DEEPCOPY_GEN)
\
--v
$(KUBE_VERBOSE)
\
--logtostderr
\
-i
$$
(
cat
$(META_DIR)
/
$(DEEPCOPY_GEN)
.todo |
paste
-sd
, -
)
\
--bounding-dirs
$(PRJ_SRC_PATH)
\
-O
$(DEEPCOPY_BASENAME)
\
"
$$
@"
;
\
fi
\
}
;
\
run_gen_deepcopy
# This rule aggregates the set of files to generate and then generates them all
# in a single run of the tool.
.PHONY
:
gen_deepcopy
gen_deepcopy
:
$(DEEPCOPY_FILES)
if
[[
-f
$(META_DIR)
/
$(DEEPCOPY_GEN)
.todo
]]
;
then
\
./hack/run-in-gopath.sh
$(DEEPCOPY_GEN)
\
--v
$(KUBE_VERBOSE)
\
--logtostderr
\
-i
$$
(
cat
$(META_DIR)
/
$(DEEPCOPY_GEN)
.todo |
paste
-sd
, -
)
\
--bounding-dirs
$(PRJ_SRC_PATH)
\
-O
$(DEEPCOPY_BASENAME)
;
\
fi
gen_deepcopy
:
$(DEEPCOPY_FILES) $(DEEPCOPY_GEN)
$(RUN_GEN_DEEPCOPY)
.PHONY
:
verify_gen_deepcopy
verify_gen_deepcopy
:
$(DEEPCOPY_GEN)
$(RUN_GEN_DEEPCOPY)
--verify-only
# For each dir in DEEPCOPY_DIRS, this establishes a dependency between the
# output file and the input files that should trigger a rebuild.
...
...
@@ -323,18 +341,29 @@ DEFAULTER_DIRS := $(shell \
DEFAULTER_FILES
:=
$
(
addsuffix /
$(DEFAULTER_FILENAME)
,
$(DEFAULTER_DIRS)
)
RUN_GEN_DEFAULTER
:=
\
function
run_gen_defaulter
()
{
\
if
[[
-f
$(META_DIR)
/
$(DEFAULTER_GEN)
.todo
]]
;
then
\
./hack/run-in-gopath.sh
$(DEFAULTER_GEN)
\
--v
$(KUBE_VERBOSE)
\
--logtostderr
\
-i
$$
(
cat
$(META_DIR)
/
$(DEFAULTER_GEN)
.todo |
paste
-sd
, -
)
\
--extra-peer-dirs
$$
(
echo
$
(
addprefix
$(PRJ_SRC_PATH)
/,
$(DEFAULTER_DIRS)
)
|
sed
's/ /,/g'
)
\
-O
$(DEFAULTER_BASENAME)
\
"
$$
@"
;
\
fi
\
}
;
\
run_gen_defaulter
# This rule aggregates the set of files to generate and then generates them all
# in a single run of the tool.
.PHONY
:
gen_defaulter
gen_defaulter
:
$(DEFAULTER_FILES)
if
[[
-f
$(META_DIR)
/
$(DEFAULTER_GEN)
.todo
]]
;
then
\
./hack/run-in-gopath.sh
$(DEFAULTER_GEN)
\
--v
$(KUBE_VERBOSE)
\
--logtostderr
\
-i
$$
(
cat
$(META_DIR)
/
$(DEFAULTER_GEN)
.todo |
paste
-sd
, -
)
\
--extra-peer-dirs
$$
(
echo
$
(
addprefix
$(PRJ_SRC_PATH)
/,
$(DEFAULTER_DIRS)
)
|
sed
's/ /,/g'
)
\
-O
$(DEFAULTER_BASENAME)
;
\
fi
gen_defaulter
:
$(DEFAULTER_FILES) $(DEFAULTER_GEN)
$(RUN_GEN_DEFAULTER)
.PHONY
:
verify_gen_deepcopy
verify_gen_defaulter
:
$(DEFAULTER_GEN)
$(RUN_GEN_DEFAULTER)
--verify-only
# For each dir in DEFAULTER_DIRS, this establishes a dependency between the
# output file and the input files that should trigger a rebuild.
...
...
@@ -453,9 +482,26 @@ OPENAPI_DIRS := $(shell \
OPENAPI_OUTFILE
:=
$(OPENAPI_OUTPUT_PKG)
/
$(OPENAPI_FILENAME)
# Shell function for reuse in rules.
RUN_GEN_OPENAPI
=
\
function
run_gen_openapi
()
{
\
./hack/run-in-gopath.sh
$(OPENAPI_GEN)
\
--v
$(KUBE_VERBOSE)
\
--logtostderr
\
-i
$$
(
echo
$
(
addprefix
$(PRJ_SRC_PATH)
/,
$(OPENAPI_DIRS)
)
|
sed
's/ /,/g'
)
\
-p
$(PRJ_SRC_PATH)
/
$(OPENAPI_OUTPUT_PKG)
\
-O
$(OPENAPI_BASENAME)
\
"
$$
@"
;
\
}
;
\
run_gen_openapi
# This rule is the user-friendly entrypoint for openapi generation.
.PHONY
:
gen_openapi
gen_openapi
:
$(OPENAPI_OUTFILE)
gen_openapi
:
$(OPENAPI_OUTFILE) $(OPENAPI_GEN)
.PHONY
:
verify_gen_openapi
verify_gen_openapi
:
$(OPENAPI_GEN)
$(RUN_GEN_OPENAPI)
--verify-only
# For each dir in OPENAPI_DIRS, this establishes a dependency between the
# output file and the input files that should trigger a rebuild.
...
...
@@ -475,13 +521,8 @@ $(foreach dir, $(OPENAPI_DIRS), $(eval \
))
# How to regenerate open-api code. This emits a single file for all results.
$(OPENAPI_OUTFILE)
:
$(OPENAPI_GEN)
./hack/run-in-gopath.sh
$(OPENAPI_GEN)
\
--v
$(KUBE_VERBOSE)
\
--logtostderr
\
-i
$$
(
echo
$
(
addprefix
$(PRJ_SRC_PATH)
/,
$(OPENAPI_DIRS)
)
|
sed
's/ /,/g'
)
\
-p
$(PRJ_SRC_PATH)
/
$(OPENAPI_OUTPUT_PKG)
\
-O
$(OPENAPI_BASENAME)
$(OPENAPI_OUTFILE)
:
$(OPENAPI_GEN) $(OPENAPI_GEN)
$(RUN_GEN_OPENAPI)
# 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
...
...
@@ -560,17 +601,29 @@ CONVERSION_DIRS := $(shell \
CONVERSION_FILES
:=
$
(
addsuffix /
$(CONVERSION_FILENAME)
,
$(CONVERSION_DIRS)
)
# Shell function for reuse in rules.
RUN_GEN_CONVERSION
=
\
function
run_gen_conversion
()
{
\
if
[[
-f
$(META_DIR)
/
$(CONVERSION_GEN)
.todo
]]
;
then
\
./hack/run-in-gopath.sh
$(CONVERSION_GEN)
\
--v
$(KUBE_VERBOSE)
\
--logtostderr
\
-i
$$
(
cat
$(META_DIR)
/
$(CONVERSION_GEN)
.todo |
paste
-sd
, -
)
\
-O
$(CONVERSION_BASENAME)
\
"
$$
@"
;
\
fi
\
}
;
\
run_gen_conversion
# This rule aggregates the set of files to generate and then generates them all
# in a single run of the tool.
.PHONY
:
gen_conversion
gen_conversion
:
$(CONVERSION_FILES)
if
[[
-f
$(META_DIR)
/
$(CONVERSION_GEN)
.todo
]]
;
then
\
./hack/run-in-gopath.sh
$(CONVERSION_GEN)
\
--v
$(KUBE_VERBOSE)
\
--logtostderr
\
-i
$$
(
cat
$(META_DIR)
/
$(CONVERSION_GEN)
.todo |
paste
-sd
, -
)
\
-O
$(CONVERSION_BASENAME)
;
\
fi
gen_conversion
:
$(CONVERSION_FILES) $(CONVERSION_GEN)
$(RUN_GEN_CONVERSION)
.PHONY
:
verify_gen_conversion
verify_gen_conversion
:
$(CONVERSION_GEN)
$(RUN_GEN_CONVERSION)
--verify-only
# Establish a dependency between the deps file and the dir. Whenever a dir
# changes (files added or removed) the deps file will be considered stale.
...
...
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