Move root of Rust crate into repo root

This enables IDE integration to work (which requires the Cargo.toml to
be in the repo root).

"make clean" no longer runs "cargo clean", because IDE integrations hold
locks on files within the Rust build directory, and an error inside
"cargo clean" error would prevent "make clean" from completing (and
removing other files).
This commit is contained in:
Jack Grigg 2020-02-04 12:55:35 +00:00
parent 90f7234136
commit 5fe41654bf
6 changed files with 14 additions and 15 deletions

6
.gitignore vendored
View File

@ -73,9 +73,9 @@ src/univalue/gen
Makefile
# Rust
src/.cargo/.configured-for-*
src/.cargo/config
src/rust/target
.cargo/.configured-for-*
.cargo/config
target/
# Unit-tests
Makefile.test

View File

View File

@ -16,7 +16,7 @@ edition = "2018"
[lib]
name = "rustzcash"
path = "src/rustzcash.rs"
path = "src/rust/src/rustzcash.rs"
crate-type = ["staticlib"]
[dependencies]

View File

@ -39,9 +39,9 @@ LIBBITCOIN_CLI=libbitcoin_cli.a
LIBBITCOIN_UTIL=libbitcoin_util.a
LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
if TARGET_WINDOWS
LIBRUSTZCASH=rust/target/$(RUST_TARGET)/release/rustzcash.lib
LIBRUSTZCASH=$(top_builddir)/target/$(RUST_TARGET)/release/rustzcash.lib
else
LIBRUSTZCASH=rust/target/$(RUST_TARGET)/release/librustzcash.a
LIBRUSTZCASH=$(top_builddir)/target/$(RUST_TARGET)/release/librustzcash.a
endif
LIBSECP256K1=secp256k1/libsecp256k1.la
LIBUNIVALUE=univalue/libunivalue.la
@ -65,25 +65,25 @@ RUST_BUILD_OPTS = --release --target $(RUST_TARGET)
if ENABLE_ONLINE_RUST
# Ensure that .cargo/config does not exist
CARGO_CONFIGURED = .cargo/.configured-for-online
CARGO_CONFIGURED = $(top_srcdir)/.cargo/.configured-for-online
$(CARGO_CONFIGURED):
$(AM_V_at)rm -f .cargo/.configured-for-offline .cargo/config
$(AM_V_at)rm -f $(top_srcdir)/.cargo/.configured-for-offline $(top_srcdir)/.cargo/config
$(AM_V_at)touch $@
else
# Enable dependency vendoring
RUST_BUILD_OPTS += --locked --offline
CARGO_CONFIGURED = .cargo/.configured-for-offline
$(CARGO_CONFIGURED): .cargo/config.offline
$(AM_V_at)rm -f .cargo/.configured-for-online
$(AM_V_at)cp $< .cargo/config
$(AM_V_at)echo "directory = \"$(RUST_VENDORED_SOURCES)\"" >>.cargo/config
CARGO_CONFIGURED = $(top_srcdir)/.cargo/.configured-for-offline
$(CARGO_CONFIGURED): $(top_srcdir)/.cargo/config.offline
$(AM_V_at)rm -f $(top_srcdir)/.cargo/.configured-for-online
$(AM_V_at)cp $< $(top_srcdir)/.cargo/config
$(AM_V_at)echo "directory = \"$(RUST_VENDORED_SOURCES)\"" >>$(top_srcdir)/.cargo/config
$(AM_V_at)touch $@
endif
cargo-build: $(CARGO_CONFIGURED)
$(RUST_ENV_VARS) $(CARGO) build $(RUST_BUILD_OPTS) --manifest-path $(srcdir)/rust/Cargo.toml
$(RUST_ENV_VARS) $(CARGO) build $(RUST_BUILD_OPTS) --manifest-path $(top_srcdir)/Cargo.toml
$(LIBRUSTZCASH): cargo-build
@ -603,7 +603,6 @@ DISTCLEANFILES = obj/build.h
EXTRA_DIST = leveldb
clean-local:
$(CARGO) clean --manifest-path $(srcdir)/rust/Cargo.toml
rm -f .cargo/config .cargo/.configured-for-online .cargo/.configured-for-offline
-$(MAKE) -C leveldb clean
-$(MAKE) -C secp256k1 clean