-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·65 lines (57 loc) · 2.14 KB
/
Copy pathpackage.sh
File metadata and controls
executable file
·65 lines (57 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /bin/sh
# EndBASIC
# Copyright 2021 Julio Merino
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# Verify that "cargo publish" has good chances of succeeding for all of our crates.
#
# This is very hard to do and is not well-documented, so to avoid pulling in very
# heavy dependencies, this tries to simulate the above by "just" packaging the
# crates (a la "cargo package") and adding them to a local-only index.
#
# WARNING: These checks are extremely expensive and only run at release time.
# WARNING: Make sure to follow the instructions in RELEASE.md for these to apply.
set -eux
cargo install cargo-index cargo-local-registry
# Build once to generate a Cargo.lock file.
cargo build --all-features
cargo clean
# Initialize a local registry based on the Cargo.lock file.
registry="$(pwd)/registry"
git config --global user.email "nobody@example.com"
git config --global user.name "Nobody"
cargo local-registry --sync . "${registry}"
(
cd "${registry}/index"
git init
git add *
git commit -a -m 'Initialize local registry'
)
# Configure Cargo overrides to use the local registry.
cat >.cargo/config <<EOF
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'local-registry'
[source.local-registry]
local-registry = '${registry}'
EOF
# Package one crate at a time and add it to the local registry so that subsequent crates
# can pick them up.
for dir in core std client terminal sdl st7735s rpi repl cli; do
cd "${dir}"
cargo index add --index "${registry}/index" --index-url https://example.com
cd -
if [ "${dir}" != cli ]; then
cp target/package/endbasic-"${dir}"-*.crate "${registry}"
fi
done