Create default bundles archive in ninja file and store in build dir

Previously we would download and archive the default bundles as part of ./configure and place the result in our source directory, this however both pollutes the source directory with generated files, but also had the ./configure step actually do a partial build, since we need to build the ‘bl’ executable to download bundles.
This commit is contained in:
Allan Odgaard
2021-01-16 16:10:02 +01:00
parent c90a9bb329
commit 4606fdefff
4 changed files with 30 additions and 27 deletions

View File

@@ -0,0 +1 @@
mandatories defaults

View File

@@ -1,21 +0,0 @@
#!/bin/sh
set -u
TBZ_DST=$1
BZIP2_FLAG="-j"
if which -s pbzip2; then
BZIP2_FLAG="--use-compress-prog=pbzip2"
fi
BUNDLES_DST="$(/usr/bin/mktemp -dt bundles)"
trap 'rm -rf "$BUNDLES_DST"' EXIT
builddir="${builddir:-$HOME/build/TextMate}"
bl="$builddir/Applications/bl/bl"
{ [ -x "$bl" ] || ninja "$bl"; } && \
mkdir -p "$BUNDLES_DST/Managed" && \
"$bl" -C "$BUNDLES_DST/Managed" install mandatories defaults && \
/usr/bin/tar --disable-copyfile -cf "$TBZ_DST~" "$BZIP2_FLAG" -C "$BUNDLES_DST" "Managed" && \
mv "$TBZ_DST~" "$TBZ_DST"

View File

@@ -837,6 +837,32 @@ class CompileMarkdown < Compiler
end
end
class CreateBundlesArchive < Compiler
transforms '.tbz.bl' => '.tbz'
def setup(buildfile, context)
buildfile.rule('download_bundles', {
'command' => "#{buildfile.dir}/Applications/bl/bl -C $out install $$(<$in)",
'description' => 'Download bundles…',
'pool' => 'console',
})
buildfile.rule('archive_bundles', {
'command' => '/usr/bin/tar --disable-copyfile $bzip2_flag -cf $out~ -C "$$(dirname $in)" "$$(basename $in)" && mv $out~ $out',
'description' => 'Create tbz archive for $in…',
'generator' => 'true',
})
end
def transform(asset, buildfile)
tmp_dir_asset = Asset.new(File.expand_path("#{asset.file}/Managed", buildfile.dir), asset.context)
new_asset = self.derive_asset(asset, buildfile.dir)
buildfile.build('download_bundles', asset.file, tmp_dir_asset.file, nil, [ "#{buildfile.dir}/Applications/bl/bl" ])
buildfile.build('archive_bundles', tmp_dir_asset.file, new_asset.file)
[ new_asset ]
end
end
# ========
# = Main =
# ========

9
configure vendored
View File

@@ -68,11 +68,8 @@ for dep in ninja ragel multimarkdown pgrep pkill; do
which -s "$dep" || error "*** dependency missing: ${dep}."
done
# =====================================
# = Generate fixtures and build files =
# =====================================
# ========================
# = Generate build files =
# ========================
bin/gen_build -o build.ninja -C "$builddir" -dAPP_VERSION="$ver" -didentity="$identity" -drest_api="$rest_api" -dbzip2_flag="$bzip2_flag" -dcapnp_prefix="$capnp_prefix" target
BUNDLES_TBZ=Applications/TextMate/resources/DefaultBundles.tbz
test -e "$BUNDLES_TBZ" || builddir="$builddir" bin/create_default_bundles_tbz "$BUNDLES_TBZ"