Skip to content

Commit 2cde969

Browse files
author
Michael Vasseur
committed
lib/vendor should not show up in the configure
1 parent 5d378a1 commit 2cde969

File tree

7 files changed

+63
-50
lines changed

7 files changed

+63
-50
lines changed

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

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

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

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

webapp/Makefile

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ include $(TOPDIR)/Makefile.global
99
# Subdirectories to recurse into for REC_TARGETS
1010
SUBDIRS = config
1111

12-
maintainer-conf: .env.local
12+
dist: composer-dependencies
13+
inplace-conf: composer-dependencies
14+
maintainer-conf: composer-dependencies-dev .env.local
1315

1416
# Run Symfony in dev mode (for maintainer-mode):
1517
.env.local:
@@ -18,32 +20,62 @@ maintainer-conf: .env.local
1820
@echo "# the DOMjudge Symfony application in developer mode. Adjust as needed." >> $@
1921
@echo "APP_ENV=dev" >> $@
2022

23+
# Install PHP dependencies
24+
composer-dependencies:
25+
ifeq (, $(shell command -v composer 2> /dev/null))
26+
$(error "'composer' command not found in $(PATH), install it via your package manager or https://getcomposer.org/download/")
27+
endif
28+
# We use --no-scripts here because at this point the autoload.php file is
29+
# not generated yet, which is needed to run the post-install scripts.
30+
composer $(subst 1,-q,$(QUIET)) install --prefer-dist -o -a --no-scripts --no-plugins
31+
32+
composer-dependencies-dev:
33+
composer $(subst 1,-q,$(QUIET)) install --prefer-dist --no-scripts --no-plugins
34+
35+
# Dump autoload dependencies (including plugins)
36+
# This is needed since symfony/runtime is a Composer plugin that runs while dumping
37+
# the autoload file
38+
composer-dump-autoload:
39+
composer $(subst 1,-q,$(QUIET)) dump-autoload -o -a
40+
41+
composer-dump-autoload-dev:
42+
composer $(subst 1,-q,$(QUIET)) dump-autoload
43+
2144
copy-bundle-assets:
2245
# We can not use bin/console here, as when using a fakeroot,
2346
# the include paths are broken. We just copy in the data we need
2447
-rm -rf public/bundles/nelmioapidoc
2548
mkdir -p public/bundles/nelmioapidoc
26-
cp -R ../lib/vendor/nelmio/api-doc-bundle/Resources/public/* public/bundles/nelmioapidoc/
49+
cp -R ../webapp/vendor/nelmio/api-doc-bundle/Resources/public/* public/bundles/nelmioapidoc/
2750

2851
clean-l:
2952
-rm -rf public/bundles/nelmioapidoc
3053

54+
# Change baseDir in composer autogenerated files
55+
define fix_composer_paths
56+
for file in autoload_psr4.php autoload_classmap.php autoload_files.php autoload_namespaces.php ; do \
57+
sed -i "s#^\$$baseDir = .*#\$$baseDir = dirname('$(domserver_webappdir)');#" $(1)/composer/$$file ; \
58+
done
59+
sed -i "s#__DIR__ \. '/\.\./\.\./\.\.' \. '/webapp#'$(domserver_webappdir)#" $(1)/composer/autoload_static.php
60+
endef
61+
3162
install-domserver:
3263
# This must be done first to install with the rest.
3364
$(MAKE) copy-bundle-assets
3465
$(INSTALL_DIR) $(DESTDIR)$(domserver_webappdir);
35-
for d in bin config migrations public resources src templates tests ; do \
66+
for d in bin config migrations public resources src templates tests vendor; do \
3667
$(call install_tree,$(DESTDIR)$(domserver_webappdir),$$d) ; \
3768
done
69+
$(call fix_composer_paths,$(DESTDIR)$(domserver_webappdir)/vendor)
3870
# Change webapp/public/doc symlink
3971
rm $(DESTDIR)$(domserver_webappdir)/public/doc
4072
ln -s $(domjudge_docdir) $(DESTDIR)$(domserver_webappdir)/public/doc
4173
# Now change all relative symlinks in webapp/public to their correct paths
4274
for link in $$(find $(DESTDIR)$(domserver_webappdir)/public/$$dir -maxdepth 2 -type l); do \
4375
target=$$(readlink $$link) ; \
44-
if echo $${target} | grep -q '\.\./\.\./lib/vendor' ; then \
76+
if echo $${target} | grep -q '\.\./\.\./webapp/vendor' ; then \
4577
rm $$link ; \
46-
realtarget=$(domserver_libvendordir)$$(echo $${target} | sed 's!^.*\.\./\.\./lib/vendor!!') ; \
78+
realtarget=$(domserver_webappdir)/vendor$$(echo $${target} | sed 's!^.*\.\./\.\./webapp/vendor!!') ; \
4779
ln -s $$realtarget $$link ; \
4880
fi \
4981
done
@@ -56,4 +88,7 @@ maintainer-clean-l:
5688
done ; \
5789
done
5890

91+
composer-clean:
92+
composer auto-scripts
93+
5994
.PHONY: copy-bundle-assets

0 commit comments

Comments
 (0)