Skip to content

Commit cf455d5

Browse files
vmcjMichael Vasseur
authored andcommitted
Remove option to configure libvendor dir
Default it would be put in the root (see also the commit message about those lines in composer.json) and it makes the most sense to have those relative to the source. @nickygerritsen suggested another place which would also be fine, we should discuss this before merging. Also create a new cache as the old one should be quite out of date and as we now move the vendor somewhere else this is the right time to update the naming. Added script for when we want to change this to another directory Move composer files into webapp to simplify all overrides Try to fix the install Work from the correct directory Fxup Get composer.json from webapp location in unit tests Ignore the contrast of the filter button Run the composer install from the right targets I wonder if inplace-conf is the right place to do this or if this is part of the install but there is argumentation for both. Next step is to do the same for the dev dependencies. Install the dev dependecies in webapp We already traverse so keep this close in the directory Fixup Show what is the determined dir
1 parent ca0f40b commit cf455d5

File tree

18 files changed

+80
-78
lines changed

18 files changed

+80
-78
lines changed

.github/workflows/phpstan.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
configuration: phpstan.dist.neon
2222
path: webapp/src webapp/tests
2323
php_extensions: gd intl mysqli pcntl zip
24+
autoload_file: webapp/vendor/autoload.php
2425
- uses: actions/upload-artifact@v4
2526
if: always()
2627
with:

Makefile

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
export TOPDIR = $(shell pwd)
66

77
REC_TARGETS=build domserver install-domserver judgehost install-judgehost \
8-
docs install-docs inplace-install inplace-uninstall maintainer-conf
8+
docs install-docs inplace-install inplace-uninstall maintainer-conf \
9+
composer-dump-autoload composer-dump-autoload-dev
910

1011
# Global Makefile definitions
1112
include $(TOPDIR)/Makefile.global
@@ -50,7 +51,7 @@ docs: paths.mk config
5051
install-domserver: domserver composer-dump-autoload domserver-create-dirs
5152
install-judgehost: judgehost judgehost-create-dirs
5253
install-docs: docs-create-dirs
53-
dist: configure composer-dependencies
54+
dist: configure
5455

5556
domserver-configure:
5657
ifneq "$(DOMSERVER_BUILD_ENABLED)" "yes"
@@ -64,27 +65,6 @@ ifneq "$(JUDGEHOST_BUILD_ENABLED)" "yes"
6465
@exit 1
6566
endif
6667

67-
# Install PHP dependencies
68-
composer-dependencies:
69-
ifeq (, $(shell command -v composer 2> /dev/null))
70-
$(error "'composer' command not found in $(PATH), install it via your package manager or https://getcomposer.org/download/")
71-
endif
72-
# We use --no-scripts here because at this point the autoload.php file is
73-
# not generated yet, which is needed to run the post-install scripts.
74-
composer $(subst 1,-q,$(QUIET)) install --prefer-dist -o -a --no-scripts --no-plugins
75-
76-
composer-dependencies-dev:
77-
composer $(subst 1,-q,$(QUIET)) install --prefer-dist --no-scripts --no-plugins
78-
79-
# Dump autoload dependencies (including plugins)
80-
# This is needed since symfony/runtime is a Composer plugin that runs while dumping
81-
# the autoload file
82-
composer-dump-autoload:
83-
composer $(subst 1,-q,$(QUIET)) dump-autoload -o -a
84-
85-
composer-dump-autoload-dev:
86-
composer $(subst 1,-q,$(QUIET)) dump-autoload
87-
8868
# Generate documentation for distribution. Remove this dependency from
8969
# dist above for quicker building from git sources.
9070
distdocs:
@@ -108,12 +88,16 @@ install-judgehost: SUBDIRS=etc lib judge misc-tools
10888
docs: SUBDIRS= doc
10989
install-docs: SUBDIRS= doc
11090
maintainer-conf: SUBDIRS= webapp
91+
inplace-conf: SUBDIRS= webapp
11192
inplace-install: SUBDIRS= doc misc-tools
11293
inplace-uninstall: SUBDIRS= doc misc-tools
113-
dist: SUBDIRS= lib sql misc-tools
94+
dist: SUBDIRS= lib sql misc-tools webapp
11495
clean: SUBDIRS=etc doc lib sql judge misc-tools webapp
11596
distclean: SUBDIRS=etc doc lib sql judge misc-tools webapp
11697
maintainer-clean: SUBDIRS=etc doc lib sql judge misc-tools webapp
98+
composer-clean: SUBDIRS= webapp
99+
composer-dump-autoload: SUBDIRS= webapp
100+
composer-dump-autoload-dev: SUBDIRS= webapp
117101

118102
domserver-create-dirs:
119103
$(INSTALL_DIR) $(addprefix $(DESTDIR),$(domserver_dirs))
@@ -194,8 +178,8 @@ paths.mk:
194178
@exit 1
195179

196180
# Configure for running in source tree, not meant for normal use:
197-
maintainer-conf: inplace-conf-common composer-dependencies-dev
198-
inplace-conf: inplace-conf-common composer-dependencies
181+
maintainer-conf: inplace-conf-common
182+
inplace-conf: inplace-conf-common
199183
inplace-conf-common: dist
200184
./configure $(subst 1,-q,$(QUIET)) --prefix=$(CURDIR) \
201185
--with-domserver_root=$(CURDIR) \
@@ -216,7 +200,7 @@ inplace-conf-common: dist
216200
# symlinks where necessary to let it work from the source tree.
217201
# This stuff is a hack!
218202
maintainer-install: inplace-install composer-dump-autoload-dev
219-
inplace-install: build composer-dump-autoload domserver-create-dirs judgehost-create-dirs
203+
inplace-install: build composer-dump-autoload domserver-create-dirs judgehost-create-dirs composer-clean
220204
inplace-install-l:
221205
# Replace libjudgedir with symlink to prevent lots of symlinks:
222206
-rmdir $(judgehost_libjudgedir)
@@ -234,7 +218,6 @@ inplace-install-l:
234218
$(MKDIR_P) $(domserver_tmpdir)
235219
chmod a+rwx $(domserver_tmpdir)
236220
# Make sure we're running from a clean state:
237-
composer auto-scripts
238221
@echo ""
239222
@echo "========== Maintainer Install Completed =========="
240223
@echo ""
@@ -334,6 +317,5 @@ clean-autoconf:
334317
.PHONY: $(addsuffix -create-dirs,domserver judgehost docs) check-root \
335318
$(addprefix inplace-,conf conf-common install uninstall) \
336319
$(addprefix maintainer-,conf install) clean-autoconf config distdocs \
337-
composer-dependencies composer-dependencies-dev \
338320
composer-dump-autoload composer-dump-autoload-dev \
339-
coverity-conf coverity-build
321+
coverity-conf coverity-build composer-clean

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ The M4 autoconf macros are licensed under all-permissive and GPL3+
7272
licences; see the respective files under m4/ for details.
7373

7474
The DOMjudge tarball ships external library dependencies in the
75-
lib/vendor directory. These are covered by their individual licenses
75+
webapp/vendor directory. These are covered by their individual licenses
7676
as specified in the file composer.lock.
7777

7878
Contact

configure.ac

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ if test "x$FHS_ENABLED" = xyes ; then
170170
AC_SUBST(domserver_webappdir, $datadir/${PACKAGE_TARNAME}/webapp)
171171
AC_SUBST(domserver_sqldir, $datadir/${PACKAGE_TARNAME}/sql)
172172
AC_SUBST(domserver_libdir, $libdir/${PACKAGE_TARNAME})
173-
AC_SUBST(domserver_libvendordir, $libdir/${PACKAGE_TARNAME}/vendor)
174173
AC_SUBST(domserver_logdir, $localstatedir/log/${PACKAGE_TARNAME})
175174
AC_SUBST(domserver_rundir, $localstatedir/run/${PACKAGE_TARNAME})
176175
AC_SUBST(domserver_tmpdir, /tmp)
@@ -222,7 +221,6 @@ AX_PATH(domserver_etcdir, [$domserver_root/etc])
222221
AX_PATH(domserver_webappdir, [$domserver_root/webapp])
223222
AX_PATH(domserver_sqldir, [$domserver_root/sql])
224223
AX_PATH(domserver_libdir, [$domserver_root/lib])
225-
AX_PATH(domserver_libvendordir, [$domserver_root/lib/vendor])
226224
AX_PATH(domserver_logdir, [$domserver_root/log])
227225
AX_PATH(domserver_rundir, [$domserver_root/run])
228226
AX_PATH(domserver_tmpdir, [$domserver_root/tmp])
@@ -382,7 +380,6 @@ echo " * domserver...........: AX_VAR_EXPAND($domserver_root)"
382380
echo " - bin..............: AX_VAR_EXPAND($domserver_bindir)"
383381
echo " - etc..............: AX_VAR_EXPAND($domserver_etcdir)"
384382
echo " - lib..............: AX_VAR_EXPAND($domserver_libdir)"
385-
echo " - libvendor........: AX_VAR_EXPAND($domserver_libvendordir)"
386383
echo " - log..............: AX_VAR_EXPAND($domserver_logdir)"
387384
echo " - run..............: AX_VAR_EXPAND($domserver_rundir)"
388385
echo " - sql..............: AX_VAR_EXPAND($domserver_sqldir)"

etc/domserver-static.php.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define('ETCDIR', '@domserver_etcdir@');
1212
define('WEBAPPDIR', '@domserver_webappdir@');
1313
define('LIBDIR', '@domserver_libdir@');
1414
define('SQLDIR', '@domserver_sqldir@');
15-
define('LIBVENDORDIR','@domserver_libvendordir@');
15+
define('LIBVENDORDIR','@domserver_webappdir@/vendor');
1616
define('LOGDIR', '@domserver_logdir@');
1717
define('RUNDIR', '@domserver_rundir@');
1818
define('TMPDIR', '@domserver_tmpdir@');

fix_location.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
for i in ./webapp/public/webfonts ./webapp/public/css/fontawesome-all.min.css ./webapp/public/css/bootstrap.min.css.map ./webapp/public/css/select2.min.css ./webapp/public/css/nv.d3.min.css ./webapp/public/css/bootstrap.min.css ./webapp/public/css/select2-bootstrap-5-theme.min.css ./webapp/public/css/dataTables.bootstrap5.min.css ./webapp/public/css/nv.d3.min.css.map ./webapp/public/js/jquery.min.js ./webapp/public/js/nv.d3.min.js ./webapp/public/js/bootstrap.bundle.min.js ./webapp/public/js/d3.min.js ./webapp/public/js/nv.d3.min.js.map ./webapp/public/js/FileSaver.min.js.map ./webapp/public/js/FileSaver.min.js ./webapp/public/js/dataTables.bootstrap5.min.js ./webapp/public/js/bootstrap.bundle.min.js.map ./webapp/public/js/select2.min.js ./webapp/public/js/dataTables.min.js ./webapp/public/flags
2+
do
3+
old=$(readlink $i)
4+
new=$(readlink $i | sed 's/lib\/vendor/webapp\/vendor/')
5+
echo "Changing $i from $old to $new"
6+
rm $i
7+
ln -s $new $i
8+
done

gitlab/base.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ parameters:
4848
domjudge.webappdir: /webapp
4949
domjudge.libdir: /lib
5050
domjudge.sqldir: /sql
51-
domjudge.libvendordir: /lib/vendor
51+
domjudge.libvendordir: /webapp/vendor
5252
domjudge.logdir: /output/log
5353
domjudge.rundir: /output/run
5454
domjudge.tmpdir: /output/tmp
@@ -59,7 +59,7 @@ EOF
5959
cd webapp
6060
# install check if the cache might be dirty
6161
set +e
62-
composer install --no-scripts || rm -rf lib/vendor
62+
composer install --no-scripts || rm -rf webapp/vendor
6363
set -e
6464

6565
# install all php dependencies

lib/Makefile

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,9 @@ $(OBJECTS): %$(OBJEXT): %.c %.h
1212
clean-l:
1313
rm -f $(OBJECTS)
1414

15-
# Change baseDir in composer autogenerated files
16-
define fix_composer_paths
17-
for file in autoload_psr4.php autoload_classmap.php autoload_files.php autoload_namespaces.php ; do \
18-
sed -i "s#^\$$baseDir = .*#\$$baseDir = dirname('$(domserver_webappdir)');#" $(1)/composer/$$file ; \
19-
done
20-
sed -i "s#__DIR__ \. '/\.\./\.\./\.\.' \. '/webapp#'$(domserver_webappdir)#" $(1)/composer/autoload_static.php
21-
endef
22-
2315
install-domserver:
2416
$(INSTALL_DATA) -t $(DESTDIR)$(domserver_libdir) *.php
2517
$(INSTALL_PROG) -t $(DESTDIR)$(domserver_libdir) alert
26-
for i in vendor/* ; do \
27-
$(call install_tree,$(DESTDIR)$(domserver_libvendordir),$$i) ; \
28-
done
29-
$(call fix_composer_paths,$(DESTDIR)$(domserver_libvendordir))
3018

3119
install-judgehost:
3220
$(INSTALL_DATA) -t $(DESTDIR)$(judgehost_libdir) *.php *.sh

paths.mk.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ domserver_etcdir = @domserver_etcdir@
8686
domserver_webappdir = @domserver_webappdir@
8787
domserver_sqldir = @domserver_sqldir@
8888
domserver_libdir = @domserver_libdir@
89-
domserver_libvendordir = @domserver_libvendordir@
9089
domserver_logdir = @domserver_logdir@
9190
domserver_rundir = @domserver_rundir@
9291
domserver_tmpdir = @domserver_tmpdir@
@@ -111,8 +110,7 @@ systemd_unitdir = @systemd_unitdir@
111110
# The tmpdir's are not in these lists, since they would otherwise get
112111
# their permissions overwritten in FHS install mode.
113112
domserver_dirs = $(domserver_bindir) $(domserver_etcdir) \
114-
$(domserver_libdir) $(domserver_libvendordir) \
115-
$(domserver_logdir) $(domserver_rundir) \
113+
$(domserver_libdir) $(domserver_logdir) $(domserver_rundir) \
116114
$(addprefix $(domserver_webappdir)/public/images/,affiliations countries teams) \
117115
$(domserver_exampleprobdir) $(domserver_databasedumpdir)
118116

@@ -137,7 +135,6 @@ define substconfigvars
137135
-e 's,@domserver_webappdir[@],@domserver_webappdir@,g' \
138136
-e 's,@domserver_sqldir[@],@domserver_sqldir@,g' \
139137
-e 's,@domserver_libdir[@],@domserver_libdir@,g' \
140-
-e 's,@domserver_libvendordir[@],@domserver_libvendordir@,g' \
141138
-e 's,@domserver_logdir[@],@domserver_logdir@,g' \
142139
-e 's,@domserver_rundir[@],@domserver_rundir@,g' \
143140
-e 's,@domserver_tmpdir[@],@domserver_tmpdir@,g' \

phpstan.dist.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ parameters:
2222
message: "#Method .* return type has no value type specified in iterable type array#"
2323
path: webapp/src/DataFixtures/Test
2424
includes:
25-
- lib/vendor/phpstan/phpstan-doctrine/extension.neon
25+
- webapp/vendor/phpstan/phpstan-doctrine/extension.neon

0 commit comments

Comments
 (0)