Skip to content

Simplify relative paths to webapp/vendor #2635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/jobs/syntax-check
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ while read -r i ; do
fi
if grep -qE "^#\\!.*/bin/(ba)?sh" "$i" && \
[ "${i##*.}" != "zip" ] && \
echo "$i" | grep -qvE '(^\./(config|autom4te|install-sh|sql/files/defaultdata/hs/run|lib/vendor/|output|judge/judgedaemon))'; then
echo "$i" | grep -qvE '(^\./(config|autom4te|install-sh|sql/files/defaultdata/hs/run|webapp/vendor/|output|judge/judgedaemon))'; then
# We ignore the following shellcheck warnings, for more details see:
# https://github.com/koalaman/shellcheck/wiki/<code>
#
Expand Down
8 changes: 4 additions & 4 deletions webapp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ copy-bundle-assets:
# the include paths are broken. We just copy in the data we need
-rm -rf public/bundles/nelmioapidoc
mkdir -p public/bundles/nelmioapidoc
cp -R ../webapp/vendor/nelmio/api-doc-bundle/public/* public/bundles/nelmioapidoc/
cp -R vendor/nelmio/api-doc-bundle/public/* public/bundles/nelmioapidoc/

clean-l:
-rm -rf public/bundles/nelmioapidoc
Expand All @@ -44,11 +44,11 @@ install-domserver:
# Now change all relative symlinks in webapp/public to their correct paths
for link in $$(find $(DESTDIR)$(domserver_webappdir)/public/$$dir -maxdepth 2 -type l); do \
target=$$(readlink $$link) ; \
if echo $${target} | grep -q '\.\./\.\./webapp/vendor' ; then \
case $${target} in *../vendor*) \
rm $$link ; \
realtarget=$(domserver_webappdir)/vendor$$(echo $${target} | sed 's!^.*\.\./\.\./webapp/vendor!!') ; \
realtarget=$(domserver_webappdir)/vendor$${target#*../vendor} ; \
ln -s $$realtarget $$link ; \
fi \
esac \
done
$(INSTALL_DATA) -t $(DESTDIR)$(domserver_webappdir) phpunit.xml.dist .env

Expand Down
4 changes: 2 additions & 2 deletions webapp/bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_file(dirname(__DIR__, 2) . '/webapp/vendor/autoload_runtime.php')) {
if (!is_file(dirname(__DIR__) . '/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__, 2) . '/webapp/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/config/load_db_secrets.php';

set_time_limit(0);
Expand Down
11 changes: 5 additions & 6 deletions webapp/bin/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__, 2) . '/webapp/vendor/phpunit/phpunit/phpunit')) {
if (is_file(dirname(__DIR__) . '/vendor/phpunit/phpunit/phpunit')) {
if (PHP_VERSION_ID >= 80000) {
require dirname(__DIR__, 2) . '/webapp/vendor/phpunit/phpunit/phpunit';
require dirname(__DIR__) . '/vendor/phpunit/phpunit/phpunit';
} else {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__, 2) . '/webapp/vendor/autoload.php');
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
}
} else {
if (!is_file(dirname(__DIR__,
2) . '/webapp/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
if (!is_file(dirname(__DIR__) . '/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__, 2) . '/webapp/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
require dirname(__DIR__) . '/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}
2 changes: 1 addition & 1 deletion webapp/public/css/bootstrap.min.css
2 changes: 1 addition & 1 deletion webapp/public/css/bootstrap.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/public/css/dataTables.bootstrap5.min.css
2 changes: 1 addition & 1 deletion webapp/public/css/fontawesome-all.min.css
2 changes: 1 addition & 1 deletion webapp/public/css/nv.d3.min.css
2 changes: 1 addition & 1 deletion webapp/public/css/nv.d3.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/public/css/select2-bootstrap-5-theme.min.css
2 changes: 1 addition & 1 deletion webapp/public/css/select2.min.css
2 changes: 1 addition & 1 deletion webapp/public/flags
2 changes: 1 addition & 1 deletion webapp/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use App\Kernel;

require_once dirname(__DIR__, 2) . '/webapp/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';
require_once dirname(__DIR__) . '/config/load_db_secrets.php';

return function (array $context) {
Expand Down
2 changes: 1 addition & 1 deletion webapp/public/js/FileSaver.min.js
2 changes: 1 addition & 1 deletion webapp/public/js/FileSaver.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/public/js/bootstrap.bundle.min.js
2 changes: 1 addition & 1 deletion webapp/public/js/bootstrap.bundle.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/public/js/d3.min.js
2 changes: 1 addition & 1 deletion webapp/public/js/dataTables.bootstrap5.min.js
2 changes: 1 addition & 1 deletion webapp/public/js/dataTables.min.js
2 changes: 1 addition & 1 deletion webapp/public/js/jquery.min.js
2 changes: 1 addition & 1 deletion webapp/public/js/nv.d3.min.js
2 changes: 1 addition & 1 deletion webapp/public/js/nv.d3.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapp/public/js/select2.min.js
2 changes: 1 addition & 1 deletion webapp/public/webfonts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function testProblemsetManagement(): void
self::assertArrayNotHasKey('problemset', $object);

// Now upload a problemset
$problemsetFile = __DIR__ . '/../../../../../webapp/public/doc/logos/DOMjudgelogo.pdf';
$problemsetFile = __DIR__ . '/../../../../public/doc/logos/DOMjudgelogo.pdf';
$problemset = new UploadedFile($problemsetFile, 'DOMjudgelogo.pdf');
$this->verifyApiJsonResponse('POST', $url . '/problemset', 204, $this->apiUser, null, ['problemset' => $problemset]);

Expand All @@ -199,7 +199,7 @@ public function testProblemsetManagement(): void
self::assertEquals(file_get_contents($problemsetFile), $callbackData);

// Upload the problemset again, this time using PUT to also test that
$problemsetFile = __DIR__ . '/../../../../../webapp/public/doc/logos/DOMjudgelogo.pdf';
$problemsetFile = __DIR__ . '/../../../../public/doc/logos/DOMjudgelogo.pdf';
$problemset = new UploadedFile($problemsetFile, 'DOMjudgelogo.pdf');
$this->verifyApiJsonResponse('PUT', $url . '/problemset', 204, $this->apiUser, null, ['problemset' => $problemset]);

Expand Down
2 changes: 1 addition & 1 deletion webapp/tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__, 2) . '/webapp/vendor/autoload.php';
require dirname(__DIR__) . '/vendor/autoload.php';
require dirname(__DIR__) . '/config/load_db_secrets.php';

if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) {
Expand Down
Loading