Skip to content

Commit

Permalink
fix - build-script (#93)
Browse files Browse the repository at this point in the history
* update build
* fix missing version
  • Loading branch information
gennadigennadigennadi authored Nov 21, 2024
1 parent d88d325 commit 2297ae1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
15 changes: 10 additions & 5 deletions build-deptrac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ DEPTRAC_DIR="${DEPTRAC_DIR:-../deptrac-scoped}"
BUILD_DIR=build
BUILD_TMP=${BUILD_DIR}/deptrac-build
PHP='docker compose exec -u 1000 deptrac php -d memory_limit=-1'
CONTAINER='docker compose exec -u 1000 deptrac bash'
SCOPER=$BUILD_DIR/php-scoper.phar
BOX=$BUILD_DIR/box.phar

echo $DEPTRAC_DIR
echo $BUILD_DIR
echo $BUILD_TMP

info()
{
MESSAGE=$1;
Expand All @@ -26,19 +31,19 @@ $PHP $SCOPER add-prefix --force --config scoper.inc.php --working-dir . --output
$PHP $BOX compile

# info "sign phar"
gpg --detach-sign --armor --local-user ${USER} --output $BUILD_TMP/deptrac.phar.asc $BUILD_TMP/deptrac.phar
gpg --detach-sign --armor --local-user 974E9033414D7F2BC9FE1E6AD4F06E96D1BD037B --output $BUILD_TMP/deptrac.phar.asc $BUILD_TMP/deptrac.phar
gpg --verify $BUILD_TMP/deptrac.phar.asc $BUILD_TMP/deptrac.phar

info "Dump Composer Autoloader"
$PHP /usr/bin/composer dump-autoload --working-dir $BUILD_TMP -a --no-dev

info "Copy package templates"
cp -r $BUILD_DIR/template/* *.md mkdocs.yml docs -t $BUILD_TMP
cp -r $BUILD_DIR/template/.* -t $BUILD_TMP
$CONTAINER cp -rv $BUILD_DIR/template/* *.md mkdocs.yml docs -t $BUILD_TMP
$CONTAINER cp -rv $BUILD_DIR/template/.github -t $BUILD_TMP
$CONTAINER cp -rv $BUILD_DIR/template/.gitignore -t $BUILD_TMP

info "Copy build into deptrac distrubtion repository"
cp -r $BUILD_TMP/* $DEPTRAC_DIR
cp -rv $BUILD_TMP/.* $DEPTRAC_DIR
cp -rv $BUILD_TMP/* $DEPTRAC_DIR

# info "Git commit changes"
# echo "Update $(date)" > git_commit_message.txt
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
},
{
"name": "Denis Brumann",
"email": "[email protected]",
"role": "maintainer"
"email": "[email protected]"
}
],
"bin": [
Expand Down
23 changes: 22 additions & 1 deletion scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,28 @@
'test',
])->notName('/.*\\.(xml|md|dist|neon|zip)|Makefile|composer\\.json|composer\\.lock/'),
],
'patchers' => [],
'patchers' => [
static function (string $filePath, string $prefix, string $content): string {
if (str_contains($filePath, 'src/Supportive/Console/Application.php')) {
// resolve current tag
exec('git tag --points-at', $output, $result_code);

if (0 !== $result_code) {
throw new InvalidArgumentException('Ensure to run compile from composer git repository clone and that git binary is available.');
}

if ([] !== $output) {
$tag = $output[0];

if ('' !== $tag) {
return str_replace('@git-version@', $tag, $content);
}
}
}

return $content;
},
],
'tag-declarations-as-internal' => false,
'exclude-files' => array_map(
static function ($file) {
Expand Down

0 comments on commit 2297ae1

Please sign in to comment.