-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
AVRO-3423: Add build.sh step to encapsulate all the steps needed during release #1570
Changes from all commits
10dfc37
041cea3
9728e4e
37969df
d44f97c
01b00b1
9cb6f7b
094e4bf
24b9597
ea34d82
58087e9
1b4bb56
4529ceb
ca37318
cc31d5f
5fb53d3
c289053
cfe026e
df4be9d
c9ca4bc
30ed375
3f09206
5f7621e
b7c4e58
c0cd424
c9ced07
c9f26d5
0e61c64
5fc2a2b
3f127f6
7432a4c
4757ead
69772c3
6ebfc85
bdc773c
388daa3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,84 +20,82 @@ | |
|
||
set -e # exit on error | ||
|
||
cd "$(dirname "$0")" # If being called from another folder, cd into the directory containing this script. | ||
|
||
# shellcheck disable=SC1091 | ||
source ../../share/build-helper.sh "C" | ||
|
||
root_dir=$(pwd) | ||
build_dir="../../build/c" | ||
dist_dir="../../dist/c" | ||
build_dir="$BUILD_ROOT/build/c" | ||
dist_dir="$BUILD_ROOT/dist/c" | ||
version=$(./version.sh project) | ||
tarball="avro-c-$version.tar.gz" | ||
doc_dir="../../build/avro-doc-$version/api/c" | ||
doc_dir="$BUILD_ROOT/build/avro-doc-$version/api/c" | ||
|
||
function prepare_build { | ||
clean | ||
mkdir -p $build_dir | ||
(cd $build_dir && cmake $root_dir -DCMAKE_BUILD_TYPE=RelWithDebInfo) | ||
function prepare_build() | ||
{ | ||
command_clean | ||
execute mkdir -p "$build_dir" | ||
execute pushd "$build_dir" | ||
execute cmake "$root_dir" -DCMAKE_BUILD_TYPE=RelWithDebInfo | ||
execute popd | ||
} | ||
|
||
function clean { | ||
if [ -d $build_dir ]; then | ||
find $build_dir | xargs chmod 755 | ||
rm -rf $build_dir | ||
function command_clean() | ||
{ | ||
if [ -d "$build_dir" ]; then | ||
execute find "$build_dir" -exec chmod 755 {} + | ||
execute rm -rf "$build_dir" | ||
fi | ||
rm -f VERSION.txt | ||
rm -f examples/quickstop.db | ||
execute rm -f VERSION.txt | ||
execute rm -f examples/quickstop.db | ||
} | ||
|
||
for target in "$@" | ||
do | ||
|
||
case "$target" in | ||
|
||
interop-data-generate) | ||
prepare_build | ||
make -C $build_dir | ||
$build_dir/tests/generate_interop_data "../../share/test/schemas/interop.avsc" "../../build/interop/data" | ||
;; | ||
|
||
interop-data-test) | ||
prepare_build | ||
make -C $build_dir | ||
$build_dir/tests/test_interop_data "../../build/interop/data" | ||
;; | ||
|
||
lint) | ||
echo 'This is a stub where someone can provide linting.' | ||
;; | ||
|
||
test) | ||
prepare_build | ||
make -C $build_dir | ||
make -C $build_dir test | ||
;; | ||
function command_interop-data-generate() | ||
{ | ||
prepare_build | ||
execute make -C "$build_dir" | ||
execute "$build_dir/tests/generate_interop_data" "$BUILD_ROOT/share/test/schemas/interop.avsc" "$BUILD_ROOT/build/interop/data" | ||
} | ||
|
||
dist) | ||
prepare_build | ||
cp ../../share/VERSION.txt $root_dir | ||
make -C $build_dir docs | ||
# This is a hack to force the built documentation to be included | ||
# in the source package. | ||
cp $build_dir/docs/*.html $root_dir/docs | ||
make -C $build_dir package_source | ||
rm $root_dir/docs/*.html | ||
if [ ! -d $dist_dir ]; then | ||
mkdir -p $dist_dir | ||
fi | ||
if [ ! -d $doc_dir ]; then | ||
mkdir -p $doc_dir | ||
fi | ||
mv $build_dir/$tarball $dist_dir | ||
cp $build_dir/docs/*.html $doc_dir | ||
clean | ||
;; | ||
function command_interop-data-test() | ||
{ | ||
prepare_build | ||
execute make -C "$build_dir" | ||
execute "$build_dir/tests/test_interop_data" "$BUILD_ROOT/build/interop/data" | ||
} | ||
|
||
clean) | ||
clean | ||
;; | ||
function command_lint() | ||
{ | ||
echo 'This is a stub where someone can provide linting.' | ||
} | ||
|
||
*) | ||
echo "Usage: $0 {interop-data-generate|interop-data-test|lint|test|dist|clean}" | ||
exit 1 | ||
esac | ||
function command_test() | ||
{ | ||
prepare_build | ||
execute make -C "$build_dir" | ||
execute make -C "$build_dir" test | ||
} | ||
|
||
done | ||
function command_dist() | ||
{ | ||
prepare_build | ||
execute cp "$BUILD_ROOT/share/VERSION.txt" "$root_dir" | ||
execute make -C "$build_dir" docs | ||
# This is a hack to force the built documentation to be included | ||
# in the source package. | ||
execute cp "$build_dir"/docs/*.html "$root_dir/docs" | ||
execute make -C "$build_dir" package_source | ||
execute rm "$root_dir"/docs/*.html | ||
if [ ! -d "$dist_dir" ]; then | ||
execute mkdir -p "$dist_dir" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Roger. I followed the original build.sh scripts as much to the letter as possible. At this stage my objective was to be able to easily compare roiginal build shells cripts with the new ones. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand but since you're adding |
||
fi | ||
if [ ! -d "$doc_dir" ]; then | ||
execute mkdir -p "$doc_dir" | ||
fi | ||
execute mv "$build_dir/$tarball" "$dist_dir" | ||
execute cp "$build_dir"/docs/*.html "$doc_dir" | ||
command_clean | ||
} | ||
|
||
exit 0 | ||
build-run "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is
execute
defined?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
share/build-helper.sh
in the PR. The main reason behind theexecute
concept was to be able to have a--dry-run
option, where the build.sh just prints out what would be running. The user can copy paste it and run it manually step by step if needed, or just simply checking the steps. Additionally there is a step option, IIRC I implemented it :) Wit enables to user to execute the build scripts step by step.The build helper is pretty much the common code between all the build scripts and all build scripts include it. It has the execute implementation, the common help, the colored logging, etc.