Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: logdog/appengine/cmd/coordinator/Makefile

Issue 2988083002: [logdog] Begin migrating to Makefile. (Closed)
Patch Set: asdf Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: logdog/appengine/cmd/coordinator/Makefile
diff --git a/logdog/appengine/cmd/coordinator/Makefile b/logdog/appengine/cmd/coordinator/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a1209c3a4c2f855c2af1acaa3355c839af33b0d0
--- /dev/null
+++ b/logdog/appengine/cmd/coordinator/Makefile
@@ -0,0 +1,119 @@
+# Copyright 2017 The LUCI Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This Makefile (GNU) controls the construction and deployment of the
+# "luci-logdog" application. This is a common Makefile, and is expected to be
+# imported by an implementation-specific Makefile. The implementation-specific
+# Makefile must supply the following variables:
+#
+# - CLOUD_PROJECT
+#
+# The Makefile may supply the following optional variables:
+# - TAG: The AppEngine tag. If not specified, let "gae.py" choose a
+# tag (default, important for production).
+
+.PHONY: default
+default: help
+
+# Assert that all required variables are provided.
+ifndef CLOUD_PROJECT
+$(error Missing required variable: CLOUD_PROJECT)
+endif
+
+# Determine "luci-go" repository paths.
+mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
+APP_DIR := $(dir $(mkfile_path))
+LUCI_GO_DIR := $(abspath $(APP_DIR)/../../../..)
+
+# VPATH determines the relative paths of Makefile targets. We need to set it
+# here, since we're expecting to be invoked from a Makefile in a different
+# directory. This allows our relative paths to be resolved by `make`.
+VPATH := $(APP_DIR)
+
+# If a tag was provided, add it to the "GAE_PY" args.
+export LUCI_PY_USE_GCLOUD=1
+GAE_PY_EXTRA_ARGS =
+ifdef TAG
+GAE_PY_EXTRA_ARGS := $(GAE_PY_EXTRA_ARGS) -t $(TAG)
+endif
+
+ALL_SERVICES = default services backend static
+
+help:
+ echo "Manage LogDog distributions."
+ echo "$(CURDIR) $(PWD)."
Ryan Tseng 2017/08/01 17:25:50 Whats this for?
dnj 2017/08/01 17:37:58 Debugging, made help a lot better.
+
+.PHONY: yamls
+yamls: vmuser/app.yaml vmuser/dispatch.yaml vmuser/index.yaml
Ryan Tseng 2017/08/01 17:25:50 What's this for? (I don't see the deps)
dnj 2017/08/01 17:37:58 This says that the "yamls" target depends on these
Ryan Tseng 2017/08/01 17:42:12 They always exist? (by virtue of being in the repo
+
+.PHONY: web
+web:
+ -rm -rf $(APP_DIR)static/dist
+ $(LUCI_GO_DIR)/web/web.py build \
+ --build-dir $(APP_DIR)static \
+ logdog-app \
+ logdog-view \
+ rpcexplorer
+
+# Default resources definition.
+.PHONY: $(addsuffix -resources,$(ALL_SERVICES))
+$(addsuffix -resources,$(ALL_SERVICES))::
+
+# The "static" module requires additional resources.
+static-resources:: web
+
+##
+# Per-module Build Rules
+#
+# upload-<module>: Uploads the module, but doesn't set it to be default.
+# deploy-<module>: Uploads the module and sets it to be default.
+##
+
+.PHONY: $(addprefix upload-,$(ALL_SERVICES))
+$(addprefix upload-,$(ALL_SERVICES)): upload-%: %-resources yamls
+ cd $(APP_DIR) && \
+ gae.py upload \
+ -A $(CLOUD_PROJECT) \
+ $(GAE_PY_EXTRA_ARGS) \
+ --force \
+ $*
+
+.PHONY: upload
+upload: $(addsuffix -resources,$(ALL_SERVICES))
+ cd $(APP_DIR) && \
+ gae.py upload \
+ -A $(CLOUD_PROJECT) \
+ $(GAE_PY_EXTRA_ARGS) \
+ --force \
+ $(ALL_SERVICES)
+
+.PHONY: $(addprefix deploy-,$(ALL_SERVICES))
+$(addprefix deploy-,$(ALL_SERVICES)): deploy-%: %-resources yamls
+ cd $(APP_DIR) && \
+ gae.py upload \
+ -A $(CLOUD_PROJECT) \
+ $(GAE_PY_EXTRA_ARGS) \
+ --force \
+ --switch \
+ $*
+
+.PHONY: deploy
+deploy: $(addsuffix -resources,$(ALL_SERVICES))
+ cd $(APP_DIR) && \
+ gae.py upload \
+ -A $(CLOUD_PROJECT) \
+ $(GAE_PY_EXTRA_ARGS) \
+ --force \
+ --switch \
+ $(ALL_SERVICES)

Powered by Google App Engine
This is Rietveld 408576698