File tree Expand file tree Collapse file tree 3 files changed +32
-5
lines changed
cmd/pluginator/internal/builtinplugin Expand file tree Collapse file tree 3 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,9 @@ verify-kustomize-repo: \
108
108
.PHONY : prow-presubmit-check
109
109
prow-presubmit-check : \
110
110
install-tools \
111
+ workspace-sync \
112
+ generate-kustomize-builtin-plugins \
113
+ builtin-plugins-diff \
111
114
test-unit-kustomize-plugins \
112
115
test-go-mod \
113
116
build-non-plugin-all \
@@ -181,7 +184,12 @@ test-examples-kustomize-against-HEAD: $(MYGOBIN)/kustomize $(MYGOBIN)/mdrip
181
184
test-examples-kustomize-against-latest-release : $(MYGOBIN ) /mdrip
182
185
./hack/testExamplesAgainstKustomize.sh v5@$(LATEST_RELEASE )
183
186
184
-
187
+ # Pushes dependencies in the go.work file back to go.mod files of each workspace module.
188
+ .PHONY : workspace-sync
189
+ workspace-sync :
190
+ go work sync
191
+ ./hack/doGoMod.sh tidy
192
+
185
193
# --- Cleanup targets ---
186
194
.PHONY : clean
187
195
clean : clean-kustomize-external-go-plugin uninstall-tools
Original file line number Diff line number Diff line change @@ -89,9 +89,27 @@ $(pGen)/%.go: $(MYGOBIN)/pluginator $(MYGOBIN)/goimports
89
89
$(MYGOBIN ) /goimports -w $* .go \
90
90
)
91
91
92
- # Target is for debugging.
92
+ # Generate builtin plugins
93
93
.PHONY : generate-kustomize-builtin-plugins
94
- generate-kustomize-builtin-plugins : $(builtinplugins )
94
+ generate-kustomize-builtin-plugins : $(builtplugins )
95
+ for plugin in $( abspath $( wildcard $( pSrc) /* ) ) ; do \
96
+ echo " generating $$ {plugin} ..." ; \
97
+ set -e; \
98
+ cd $$ {plugin}; \
99
+ go generate pluginator . ; \
100
+ done
101
+
102
+ # Check for diff by comparing current revision of generated plugins on HEAD and newly generated plugins on local branch,
103
+ # If diff is found, throw error code 1
104
+ .PHONY : builtin-plugins-diff
105
+ builtin-plugins-diff : $(builtplugins )
106
+ for file in $( abspath $( builtinplugins) ) ; do \
107
+ echo " Checking for diff... $$ {file}" ; \
108
+ set -e ; \
109
+ if [ " ` git diff $$ {file} | wc -c` " -gt 0 ]; then\
110
+ echo " Error(1): diff found on $$ {file}" ; exit 1; \
111
+ fi \
112
+ done
95
113
96
114
.PHONY : build-kustomize-external-go-plugin
97
115
build-kustomize-external-go-plugin :
Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ func ConvertToBuiltInPlugin() (retErr error) {
62
62
w .write (
63
63
fmt .Sprintf (
64
64
"// pluginator %s\n " , provenance .GetProvenance ().Short ()))
65
- w .write ("\n " )
66
65
w .write ("package " + packageForGeneratedCode )
67
66
68
67
pType := unknown
@@ -73,6 +72,8 @@ func ConvertToBuiltInPlugin() (retErr error) {
73
72
continue
74
73
}
75
74
if strings .HasPrefix (l , "var " + konfig .PluginSymbol + " plugin" ) {
75
+ // Hack to skip leading new line
76
+ scanner .Scan ()
76
77
continue
77
78
}
78
79
if strings .Contains (l , " Transform(" ) {
@@ -93,7 +94,7 @@ func ConvertToBuiltInPlugin() (retErr error) {
93
94
}
94
95
w .write ("" )
95
96
w .write ("func New" + root + "Plugin() resmap." + pType .String () + "Plugin {" )
96
- w .write (" return &" + root + "Plugin{}" )
97
+ w .write (" return &" + root + "Plugin{}" )
97
98
w .write ("}" )
98
99
99
100
return nil
You can’t perform that action at this time.
0 commit comments