mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Fix openapi Make rules to emit 1 file
This commit is contained in:
parent
bd9c04cf5d
commit
2b937f6d6e
@ -311,20 +311,11 @@ OPENAPI_DIRS := $(shell \
|
|||||||
| sort -u \
|
| sort -u \
|
||||||
)
|
)
|
||||||
|
|
||||||
OPENAPI_FILES := $(addsuffix /$(OPENAPI_FILENAME), $(OPENAPI_DIRS))
|
OPENAPI_OUTFILE := $(OPENAPI_OUTPUT_PKG)/$(OPENAPI_FILENAME)
|
||||||
|
|
||||||
# This rule aggregates the set of files to generate and then generates them all
|
# This rule is the user-friendly entrypoint for openapi generation.
|
||||||
# in a single run of the tool.
|
|
||||||
.PHONY: gen_openapi
|
.PHONY: gen_openapi
|
||||||
gen_openapi: $(OPENAPI_FILES)
|
gen_openapi: $(OPENAPI_OUTFILE)
|
||||||
if [[ -f $(META_DIR)/$(OPENAPI_GEN).todo ]]; then \
|
|
||||||
./hack/run-in-gopath.sh $(OPENAPI_GEN) \
|
|
||||||
--v $(KUBE_VERBOSE) \
|
|
||||||
--logtostderr \
|
|
||||||
-i $$(cat $(META_DIR)/$(OPENAPI_GEN).todo | paste -sd, -) \
|
|
||||||
-p $(PRJ_SRC_PATH)/$(OPENAPI_OUTPUT_PKG) \
|
|
||||||
-O $(OPENAPI_BASENAME); \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For each dir in OPENAPI_DIRS, this establishes a dependency between the
|
# For each dir in OPENAPI_DIRS, this establishes a dependency between the
|
||||||
# output file and the input files that should trigger a rebuild.
|
# output file and the input files that should trigger a rebuild.
|
||||||
@ -339,18 +330,18 @@ gen_openapi: $(OPENAPI_FILES)
|
|||||||
# We depend on the $(GOFILES_META).stamp to detect when the set of input files
|
# We depend on the $(GOFILES_META).stamp to detect when the set of input files
|
||||||
# has changed. This allows us to detect deleted input files.
|
# has changed. This allows us to detect deleted input files.
|
||||||
$(foreach dir, $(OPENAPI_DIRS), $(eval \
|
$(foreach dir, $(OPENAPI_DIRS), $(eval \
|
||||||
$(dir)/$(OPENAPI_FILENAME): $(META_DIR)/$(dir)/$(GOFILES_META).stamp \
|
$(OPENAPI_OUTFILE): $(META_DIR)/$(dir)/$(GOFILES_META).stamp \
|
||||||
$(gofiles__$(dir)) \
|
$(gofiles__$(dir)) \
|
||||||
))
|
))
|
||||||
|
|
||||||
# Unilaterally remove any leftovers from previous runs.
|
# How to regenerate open-api code. This emits a single file for all results.
|
||||||
$(shell rm -f $(META_DIR)/$(OPENAPI_GEN)*.todo)
|
$(OPENAPI_OUTFILE): $(OPENAPI_GEN)
|
||||||
|
./hack/run-in-gopath.sh $(OPENAPI_GEN) \
|
||||||
# How to regenerate open-api code. We need to collect these up and trigger one
|
--v $(KUBE_VERBOSE) \
|
||||||
# single run to generate definition for all types.
|
--logtostderr \
|
||||||
$(OPENAPI_FILES): $(OPENAPI_GEN)
|
-i $$(echo $(addprefix $(PRJ_SRC_PATH)/, $(OPENAPI_DIRS)) | sed 's/ /,/g') \
|
||||||
mkdir -p $$(dirname $(META_DIR)/$(OPENAPI_GEN))
|
-p $(PRJ_SRC_PATH)/$(OPENAPI_OUTPUT_PKG) \
|
||||||
echo $(PRJ_SRC_PATH)/$(@D) >> $(META_DIR)/$(OPENAPI_GEN).todo
|
-O $(OPENAPI_BASENAME)
|
||||||
|
|
||||||
# This calculates the dependencies for the generator tool, so we only rebuild
|
# 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
|
# it when needed. It is PHONY so that it always runs, but it only updates the
|
||||||
|
@ -112,7 +112,6 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return generator.Packages{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Loading…
Reference in New Issue
Block a user