Merge branch 'main' into avm99963-monorail

Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266

GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/Makefile b/Makefile
index cdf9f53..899d34c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
 
 # Makefile to simplify some common AppEngine actions.
 # Use 'make help' for a list of commands.
@@ -10,8 +9,8 @@
 STAGEID= monorail-staging
 PRODID= avm99963-bugs
 
-GAE_PY?= python gae.py
-DEV_APPSERVER_FLAGS?= --watcher_ignore_re="(.*/lib|.*/node_modules|.*/venv)"
+GAE_PY?= vpython3 gae.py
+DEV_APPSERVER_FLAGS?= --python_virtualenv_path venv --watcher_ignore_re="(.*/lib|.*/node_modules|.*/venv)"
 
 WEBPACK_PATH := ./node_modules/webpack-cli/bin/cli.js
 
@@ -22,7 +21,7 @@
 
 BRANCH_NAME := $(shell git rev-parse --abbrev-ref HEAD)
 
-PY_DIRS = api,businesslogic,features,framework,project,proto,search,services,sitewide,testing,tracker
+PY_DIRS = api,businesslogic,features,framework,project,mrproto,search,services,sitewide,testing,tracker
 
 _VERSION ?= $(shell ../../../infra/luci/appengine/components/tools/calculate_version.py)
 
@@ -41,27 +40,18 @@
 
 default: help
 
-check:
-ifndef NPM_VERSION
-	$(error npm not found. Install from nodejs.org or see README)
-endif
-
 help:
 	@echo "Available commands:"
 	@sed -n '/^[a-zA-Z0-9_.]*:/s/:.*//p' <Makefile
 
 # Run "eval `../../go/env.py`" before running the following prpc_proto commands
 prpc_proto_v0:
-	touch ../../ENV/lib/python2.7/site-packages/google/__init__.py
-	PYTHONPATH=../../ENV/lib/python2.7/site-packages \
 	PATH=../../luci/appengine/components/tools:$(PATH) \
 	../../cipd/bin/protoc \
 	--python_out=. --prpc-python_out=. api/api_proto/*.proto
 	cd ../../go/src/infra/monorailv2 && \
 	cproto -proto-path ../../../../appengine/monorail/ ../../../../appengine/monorail/api/api_proto/
 prpc_proto_v3:
-	touch ../../ENV/lib/python2.7/site-packages/google/__init__.py
-	PYTHONPATH=../../ENV/lib/python2.7/site-packages \
 	PATH=../../luci/appengine/components/tools:$(PATH) \
 	../../cipd/bin/protoc \
 	--python_out=. --prpc-python_out=. api/v3/api_proto/*.proto
@@ -69,30 +59,9 @@
 	cproto -proto-path ../../../../appengine/monorail/ ../../../../appengine/monorail/api/v3/api_proto/
 
 business_proto:
-	touch ../../ENV/lib/python2.7/site-packages/google/__init__.py
-	PYTHONPATH=../../ENV/lib/python2.7/site-packages \
 	PATH=../../luci/appengine/components/tools:$(PATH) \
 	../../cipd/protoc \
-	--python_out=. --prpc-python_out=. proto/*.proto
-
-pytest:
-	GAE_RUNTIME=python3 GAE_APPLICATION=testbed-test SERVER_SOFTWARE=test pytest
-
-test:
-	../../test.py test appengine/monorail
-
-test_no_coverage:
-	../../test.py test appengine/monorail --no-coverage
-
-coverage:
-	@echo "Running tests + HTML coverage report in ~/monorail-coverage:"
-	../../test.py test appengine/monorail --html-report ~/monorail-coverage --coveragerc appengine/monorail/.coveragerc
-
-# Shows coverage on the tests themselves, helps illuminate when we have test
-# methods that aren't used.
-test_coverage:
-	@echo "Running tests + HTML coverage report (for tests) in ~/monorail-test-coverage:"
-	../../test.py test appengine/monorail --html-report ~/monorail-test-coverage --coveragerc appengine/monorail/.testcoveragerc
+	--python_out=. --prpc-python_out=. mrproto/*.proto
 
 # Commands for running locally using dev_appserver.
 # devserver requires an application ID (-A) to be specified.
@@ -124,57 +93,38 @@
 	& $(WEBPACK_PATH) --watch\
 	& $(RUN_CLOUD_TASKS)
 
-run: serve
-
-pydeps:
-	pip install -r requirements.txt
-
-jsdeps: deps
-
-deps: node_deps
-	rm -f static/dist/*
-
-build_js:
-	$(WEBPACK_PATH) --mode=production
-
-clean_deps:
+jsdeps:
 	rm -rf node_modules
-
-node_deps:
 	npm ci --no-save
 
-dev_deps:
-	python -m pip install --no-deps -r requirements.dev.txt
+jsbuild:
+	rm -f static/dist/*
+	rm -f templates/webpack-out/*
+	$(WEBPACK_PATH) --mode=production
+
+jstest:
+	npx karma start --debug
+
+jstest_coverage:
+	npx karma start --debug --coverage
+
+pytest:
+	vpython3 test.py
+
+pylint:
+	pylint --py3k *py {$(PY_DIRS)}{/,/test/}*py
 
 generate_requirements_txt:
 	vpython3 -m pip freeze > requirements.txt
 	printf "# This file is generated from the .vpython3 spec file.\n# Use \`make generate_requirements_txt\` to update.\n$$(cat requirements.txt)" > requirements.txt
 
-karma:
-	npx karma start --debug --coverage
-
-karma_debug:
-	npx karma start --debug
-
-pylint:
-	pylint -f parseable *py {$(PY_DIRS)}{/,/test/}*py
-
-py3lint:
-	pylint --py3k *py {$(PY_DIRS)}{/,/test/}*py
-
 deploy_dev: build_frontend
 	$(eval BRANCH_NAME := $(shell git rev-parse --abbrev-ref HEAD))
 	@echo "---[Dev $(DEVID)]---"
 	$(GAE_PY) upload --tag $(BRANCH_NAME) -A $(DEVID) $(FRONTEND_MODULES)
 
 # Build target used by LUCI CD and manual process to build frontend.
-build_frontend: clean_deps deps build_js
-
-package_release:
-	rsync -aLK . $(TARDIR)/package
-
-lsbuilds:
-	gcloud builds list --filter="tags='monorail'"
+build_frontend: jsdeps jsbuild
 
 # AppEngine apps can be tested locally and in non-default versions upload to
 # the main app-id, but it is still sometimes useful to have a completely