Skip to content

Commit

Permalink
Let make track the autoload_runtime
Browse files Browse the repository at this point in the history
In the commit before this was mentioned as better solution and it
required less work than expected. We now track the file and create it as
the normal user and because it exists we don't recreate it in the
install-domserver step as root (assuming it runs with `sudo`). It will
still create it if it doesn't exist as domserver is a dependency for
install-domserver (and in that case `composer` would run as root again,
so prompting the user to accept this risk).

I did not check if we can do the same for the development dependencies
or what this means for the `inplace` targets.
  • Loading branch information
vmcj committed Jun 16, 2024
1 parent d4805bf commit fce63fe
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dist: distdocs
endif

# MAIN TARGETS
domserver: domserver-configure paths.mk config composer-dump-autoload
domserver: domserver-configure paths.mk config
judgehost: judgehost-configure paths.mk config
docs: paths.mk config
install-domserver: domserver domserver-create-dirs
Expand Down Expand Up @@ -76,14 +76,6 @@ endif
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
composer-dump-autoload:
ifeq (,$(wildcard ./lib/vendor/autoload_runtime.php))
composer $(subst 1,-q,$(QUIET)) dump-autoload -o -a
endif

composer-dump-autoload-dev:
composer $(subst 1,-q,$(QUIET)) dump-autoload

Expand All @@ -103,7 +95,7 @@ build-scripts:

# List of SUBDIRS for recursive targets:
build: SUBDIRS= lib misc-tools
domserver: SUBDIRS=etc sql misc-tools webapp
domserver: SUBDIRS=etc lib sql misc-tools webapp
install-domserver: SUBDIRS=etc lib sql misc-tools webapp example_problems
judgehost: SUBDIRS=etc judge misc-tools
install-judgehost: SUBDIRS=etc lib judge misc-tools
Expand Down
5 changes: 5 additions & 0 deletions lib/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
ifndef TOPDIR
TOPDIR=..
endif

REC_TARGETS = domserver

include $(TOPDIR)/Makefile.global

OBJECTS = $(addsuffix $(OBJEXT),lib.error lib.misc)
Expand Down Expand Up @@ -31,3 +34,5 @@ install-domserver:
install-judgehost:
$(INSTALL_DATA) -t $(DESTDIR)$(judgehost_libdir) *.php *.sh
$(INSTALL_PROG) -t $(DESTDIR)$(judgehost_libdir) alert

domserver: SUBDIRS=vendor
12 changes: 12 additions & 0 deletions lib/vendor/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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 $(TOPDIR)

domserver: autoload_runtime.php

0 comments on commit fce63fe

Please sign in to comment.