Skip to content

Commit 6f630e7

Browse files
authored
Don't overwrite Makefile on generate (#169)
* Don't overwrite Makefile on generate * Fix whitespace
1 parent 700550d commit 6f630e7

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

python/rpdk/go/codegen.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ def init(self, project):
7777
inter = project.root / "internal"
7878
inter.mkdir(parents=True, exist_ok=True)
7979

80+
# Makefile
81+
path = project.root / "Makefile"
82+
LOG.debug("Writing Makefile: %s", path)
83+
template = self.env.get_template("Makefile")
84+
contents = template.render()
85+
project.overwrite(path, contents)
86+
8087
# go.mod
8188
path = project.root / "go.mod"
8289
LOG.debug("Writing go.mod: %s", path)
@@ -167,10 +174,10 @@ def generate(self, project):
167174
project.overwrite(path, contents)
168175
format_paths.append(path)
169176

170-
# Makefile
171-
path = project.root / "Makefile"
172-
LOG.debug("Writing Makefile: %s", path)
173-
template = self.env.get_template("Makefile")
177+
# makebuild
178+
path = project.root / "makebuild"
179+
LOG.debug("Writing makebuild: %s", path)
180+
template = self.env.get_template("makebuild")
174181
contents = template.render()
175182
project.overwrite(path, contents)
176183

python/rpdk/go/templates/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
.PHONY: build test clean
22

33
build:
4-
cfn generate
5-
env GOOS=linux go build -ldflags="-s -w" -tags="logging" -o bin/handler cmd/main.go
4+
make -f makebuild # this runs build steps required by the cfn cli
65

76
test:
87
cfn generate

python/rpdk/go/templates/makebuild

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file is autogenerated, do not edit;
2+
# changes will be undone by the next 'generate' command.
3+
4+
.PHONY: build
5+
build:
6+
cfn generate
7+
env GOOS=linux go build -ldflags="-s -w" -tags="$(TAGS)" -o bin/handler cmd/main.go

python/rpdk/go/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* Replace `model.{field}.Value()` with `aws.{Type}Value(model.{field})`
2626
2727
Where {Type} is either String, Bool, Int, or Float64 and {field} is any field within your generated model.
28-
""",
28+
"""
2929
}
3030

3131

0 commit comments

Comments
 (0)