diff --git a/Makefile b/Makefile index 108f6912d6..8584274dec 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ docs: SUBDIRS= doc install-docs: SUBDIRS= doc maintainer-conf: SUBDIRS= webapp maintainer-install: SUBDIRS= webapp -inplace-install: SUBDIRS= doc misc-tools webapp +inplace-install: SUBDIRS= doc misc-tools inplace-uninstall: SUBDIRS= doc misc-tools dist: SUBDIRS= lib sql misc-tools clean: SUBDIRS=etc doc lib sql judge misc-tools webapp @@ -227,6 +227,8 @@ inplace-install-l: # because judgehost-create-dirs sets wrong permissions: $(MKDIR_P) $(domserver_tmpdir) chmod a+rwx $(domserver_tmpdir) +# Make sure we're running from a clean state: + (cd webapp && composer auto-scripts) @echo "" @echo "========== Maintainer Install Completed ==========" @echo "" diff --git a/webapp/.gitignore b/webapp/.gitignore index a3afa9e59b..70a4c6b3b2 100644 --- a/webapp/.gitignore +++ b/webapp/.gitignore @@ -8,7 +8,6 @@ /var/log/* !var/log/.gitkeep /vendor/ -!vendor/Makefile ###> phpunit/phpunit ### /phpunit.xml diff --git a/webapp/Makefile b/webapp/Makefile index 0c4cbefe36..35db26d9f0 100644 --- a/webapp/Makefile +++ b/webapp/Makefile @@ -7,9 +7,34 @@ REC_TARGETS = domserver include $(TOPDIR)/Makefile.global # Subdirectories to recurse into for REC_TARGETS -SUBDIRS = config vendor +SUBDIRS = config -maintainer-conf: .env.local +domserver: composer-dump-autoload + +# Install PHP dependencies +composer-dependencies: +ifeq (, $(shell command -v composer 2> /dev/null)) + $(error "'composer' command not found in $(PATH), install it via your package manager or https://getcomposer.org/download/") +endif +# We use --no-scripts here because at this point the autoload.php file is +# not generated yet, which is needed to run the post-install scripts. + composer $(subst 1,-q,$(QUIET)) install --prefer-dist -o -a --no-scripts --no-plugins + +composer-dependencies-dev: + composer $(subst 1,-q,$(QUIET)) install --prefer-dist --no-scripts --no-plugins + +# Dump autoload dependencies (including plugins) +# This is needed since symfony/runtime is a Composer plugin that runs while dumping +# the autoload file. +# We skip it if autoload_runtime.php already exists, to avoid running composer +# as root during `sudo make install-domserver`. +composer-dump-autoload: vendor/autoload_runtime.php + +vendor/autoload_runtime.php: + composer $(subst 1,-q,$(QUIET)) dump-autoload -o -a + +composer-dump-autoload-dev: + composer $(subst 1,-q,$(QUIET)) dump-autoload # Run Symfony in dev mode (for maintainer-mode): .env.local: @@ -18,9 +43,6 @@ maintainer-conf: .env.local @echo "# the DOMjudge Symfony application in developer mode. Adjust as needed." >> $@ @echo "APP_ENV=dev" >> $@ -composer-dump-autoload-dev: - composer $(subst 1,-q,$(QUIET)) dump-autoload - copy-bundle-assets: # We can not use bin/console here, as when using a fakeroot, # the include paths are broken. We just copy in the data we need @@ -30,6 +52,7 @@ copy-bundle-assets: clean-l: -rm -rf public/bundles/nelmioapidoc + -rm -f vendor/autoload_runtime.php install-domserver: # This must be done first to install with the rest. @@ -52,24 +75,9 @@ install-domserver: done $(INSTALL_DATA) -t $(DESTDIR)$(domserver_webappdir) phpunit.xml.dist .env -inplace-install: composer-autoclean -maintainer-install: composer-dump-autoload-dev - -# Install PHP dependencies -composer-dependencies: -ifeq (, $(shell command -v composer 2> /dev/null)) - $(error "'composer' command not found in $(PATH), install it via your package manager or https://getcomposer.org/download/") -endif -# We use --no-scripts here because at this point the autoload.php file is -# not generated yet, which is needed to run the post-install scripts. - composer $(subst 1,-q,$(QUIET)) install --prefer-dist -o -a --no-scripts --no-plugins - -composer-dependencies-dev: - composer $(subst 1,-q,$(QUIET)) install --prefer-dist --no-scripts --no-plugins +maintainer-conf: .env.local -composer-autoclean: -# Make sure we're running from a clean state: - composer auto-scripts +maintainer-install: composer-dump-autoload-dev maintainer-clean-l: -for d in cache log ; do \ @@ -78,4 +86,5 @@ maintainer-clean-l: done ; \ done -.PHONY: copy-bundle-assets +.PHONY: composer-dump-autoload composer-dump-autoload-dev \ + copy-bundle-assets diff --git a/webapp/vendor/Makefile b/webapp/vendor/Makefile deleted file mode 100644 index 210d2e6c57..0000000000 --- a/webapp/vendor/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -ifndef TOPDIR -TOPDIR=../.. -endif -include $(TOPDIR)/Makefile.global - -clean-l: - rm -f autoload_runtime.php - -autoload_runtime.php: - composer $(subst 1,-q,$(QUIET)) dump-autoload -o -a -d .. - -domserver: autoload_runtime.php