Skip to content

Commit d706b4d

Browse files
authored
Merge pull request #1837 from JohnTitor/xbuild
Use `build-std` feature instead of using `cargo-xbuild`
2 parents f944fce + 45317a0 commit d706b4d

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

ci/build.sh

+28-14
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ RUST=${TOOLCHAIN}
1515
echo "Testing Rust ${RUST} on ${OS}"
1616

1717
if [ "${TOOLCHAIN}" = "nightly" ] ; then
18-
cargo +nightly install cargo-xbuild
1918
rustup component add rust-src
2019
fi
2120

@@ -41,29 +40,46 @@ test_target() {
4140
fi
4241

4342
# Test that libc builds without any default features (no libstd)
44-
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}"
45-
43+
if [ "${NO_STD}" != "1" ]; then
44+
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}"
45+
else
46+
cargo "+${RUST}" "${BUILD_CMD}" -Z build-std=core,alloc -vv --no-default-features --target "${TARGET}"
47+
fi
4648
# Test that libc builds with default features (e.g. libstd)
4749
# if the target supports libstd
4850
if [ "$NO_STD" != "1" ]; then
4951
cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}"
52+
else
53+
cargo "+${RUST}" "${BUILD_CMD}" -Z build-std=core,alloc -vv --target "${TARGET}"
5054
fi
5155

5256
# Test that libc builds with the `extra_traits` feature
53-
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
57+
if [ "${NO_STD}" != "1" ]; then
58+
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
5459
--features extra_traits
60+
else
61+
cargo "+${RUST}" "${BUILD_CMD}" -Z build-std=core,alloc -vv --no-default-features \
62+
--target "${TARGET}" --features extra_traits
63+
fi
5564

5665
# Test the 'const-extern-fn' feature on nightly
5766
if [ "${RUST}" = "nightly" ]; then
58-
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
59-
--features const-extern-fn
67+
if [ "${NO_STD}" != "1" ]; then
68+
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
69+
--features const-extern-fn
70+
else
71+
cargo "+${RUST}" "${BUILD_CMD}" -Z build-std=core,alloc -vv --no-default-features \
72+
--target "${TARGET}" --features const-extern-fn
73+
fi
6074
fi
6175

62-
6376
# Also test that it builds with `extra_traits` and default features:
6477
if [ "$NO_STD" != "1" ]; then
6578
cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" \
6679
--features extra_traits
80+
else
81+
cargo "+${RUST}" "${BUILD_CMD}" -Z build-std=core,alloc -vv --target "${TARGET}" \
82+
--features extra_traits
6783
fi
6884
}
6985

@@ -166,7 +182,7 @@ case "${OS}" in
166182
esac
167183

168184
for TARGET in $TARGETS; do
169-
if echo "$TARGET"|grep -q "$FILTER";then
185+
if echo "$TARGET"|grep -q "$FILTER"; then
170186
test_target build "$TARGET"
171187
fi
172188
done
@@ -193,6 +209,7 @@ i686-unknown-haiku \
193209
i686-unknown-netbsd \
194210
i686-unknown-openbsd \
195211
mips-unknown-linux-uclibc \
212+
mipsel-sony-psp \
196213
mipsel-unknown-linux-uclibc \
197214
mips64-unknown-linux-muslabi64 \
198215
mips64el-unknown-linux-muslabi64 \
@@ -229,13 +246,10 @@ powerpc64-wrs-vxworks \
229246

230247
if [ "${RUST}" = "nightly" ] && [ "${OS}" = "linux" ]; then
231248
for TARGET in $RUST_LINUX_NO_CORE_TARGETS; do
232-
if echo "$TARGET"|grep -q "$FILTER";then
233-
test_target xbuild "$TARGET" 1
249+
if echo "$TARGET"|grep -q "$FILTER"; then
250+
test_target build "$TARGET" 1
234251
fi
235252
done
236-
237-
# Sony PSP
238-
cargo xbuild --target mipsel-sony-psp
239253
fi
240254

241255
RUST_OSX_NO_CORE_TARGETS="\
@@ -248,7 +262,7 @@ i686-apple-darwin \
248262
if [ "${RUST}" = "nightly" ] && [ "${OS}" = "osx" ]; then
249263
for TARGET in $RUST_OSX_NO_CORE_TARGETS; do
250264
if echo "$TARGET" | grep -q "$FILTER"; then
251-
test_target xbuild "$TARGET" 1
265+
test_target build "$TARGET" 1
252266
fi
253267
done
254268
fi

ci/dox.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ if ! rustc --version | grep -E "nightly" ; then
1919
fi
2020

2121
rustup component add rust-src
22-
cargo +nightly install cargo-xbuild
2322

2423
# List all targets that do currently build successfully:
2524
# shellcheck disable=SC1003
@@ -50,10 +49,11 @@ while read -r target; do
5049
# Enable extra configuration flags:
5150
export RUSTDOCFLAGS="--cfg freebsd11"
5251

53-
# If cargo doc fails, then try xargo:
52+
# If cargo doc fails, then try with unstable feature:
5453
if ! cargo doc --target "${target}" \
5554
--no-default-features --features extra_traits ; then
56-
cargo xdoc --target "${target}" \
55+
cargo doc --target "${target}" \
56+
-Z build-std=core,alloc \
5757
--no-default-features --features extra_traits
5858
fi
5959

ci/run-docker.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ build_switch() {
6262
kvm=""
6363
fi
6464

65-
cargo +nightly install cargo-xbuild
6665
cp "$(which rustup)" "$(rustc --print sysroot)/bin"
6766

6867
docker run \
@@ -82,7 +81,7 @@ build_switch() {
8281
libc \
8382
sh -c "HOME=/tmp RUSTUP_HOME=/tmp PATH=\$PATH:/rust/bin rustup default nightly \
8483
&& rustup component add rust-src --target ci/switch.json \
85-
&& cargo xbuild --target ci/switch.json"
84+
&& cargo build -Z build-std=core,alloc --target ci/switch.json"
8685
}
8786

8887
if [ -z "${1}" ]; then

0 commit comments

Comments
 (0)