Skip to content

Commit

Permalink
Merge pull request #167 from buildpack/lifecycle-descriptor
Browse files Browse the repository at this point in the history
Adds lifecycle.toml to package
  • Loading branch information
ekcasey authored Aug 19, 2019
2 parents 357067a + d7feff9 commit 5e629f9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ GOENV=GOOS=linux GOARCH=amd64 CGO_ENABLED=0
GOBUILD=$(GOCMD) build -mod=vendor -ldflags "-X 'github.com/buildpack/lifecycle.Version=$(LIFECYCLE_VERSION)' -X 'github.com/buildpack/lifecycle.SCMRepository=$(SCM_REPO)' -X 'github.com/buildpack/lifecycle.SCMCommit=$(SCM_COMMIT)'"
GOTEST=$(GOCMD) test -mod=vendor
LIFECYCLE_VERSION?=0.0.0
PLATFORM_API=0.1
BUILDPACK_API=0.2
SCM_REPO?=
SCM_COMMIT=$$(git rev-parse --short HEAD)
ARCHIVE_NAME=lifecycle-v$(LIFECYCLE_VERSION)+linux.x86-64

define LIFECYCLE_DESCRIPTOR
[api]
platform = "$(PLATFORM_API)"
buildpack = "$(BUILDPACK_API)"

[lifecycle]
version = "$(LIFECYCLE_VERSION)"
endef

all: test build package

build:
@echo "> Building lifecycle..."
mkdir -p ./out/$(ARCHIVE_NAME)
Expand All @@ -21,6 +33,13 @@ build:
$(GOENV) $(GOBUILD) -o ./out/$(ARCHIVE_NAME)/cacher -a ./cmd/cacher
$(GOENV) $(GOBUILD) -o ./out/$(ARCHIVE_NAME)/launcher -a ./cmd/launcher

descriptor: export LIFECYCLE_DESCRIPTOR:=$(LIFECYCLE_DESCRIPTOR)
descriptor:
@echo "> Writing descriptor file..."
mkdir -p ./out
echo "$${LIFECYCLE_DESCRIPTOR}" > ./out/lifecycle.toml


install-goimports:
@echo "> Installing goimports..."
$(GOCMD) install -mod=vendor golang.org/x/tools/cmd/goimports
Expand Down Expand Up @@ -59,6 +78,6 @@ clean:
@echo "> Cleaning workspace..."
rm -rf ./out

package:
package: descriptor
@echo "> Packaging lifecycle..."
tar czf ./out/$(ARCHIVE_NAME).tgz -C out $(ARCHIVE_NAME)
tar czf ./out/$(ARCHIVE_NAME).tgz -C out $(ARCHIVE_NAME) lifecycle.toml

0 comments on commit 5e629f9

Please sign in to comment.