diff options
-rw-r--r-- | tools/minicargo/main.cpp | 6 | ||||
-rw-r--r-- | tools/minicargo/manifest.cpp | 13 | ||||
-rw-r--r-- | tools/minicargo/manifest.h | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/tools/minicargo/main.cpp b/tools/minicargo/main.cpp index 2c1188c8..a00e3192 100644 --- a/tools/minicargo/main.cpp +++ b/tools/minicargo/main.cpp @@ -46,15 +46,17 @@ int main(int argc, const char* argv[]) repo.load_vendored(opts.vendor_dir); } + auto bs_override_dir = opts.override_directory ? ::helpers::path(opts.override_directory) : ::helpers::path(); + // 1. Load the Cargo.toml file from the passed directory auto dir = ::helpers::path(opts.directory ? opts.directory : "."); auto m = PackageManifest::load_from_toml( dir / "Cargo.toml" ); // 2. Load all dependencies - m.load_dependencies(repo); + m.load_dependencies(repo, !bs_override_dir.is_valid()); // 3. Build dependency tree and build program. - MiniCargo_Build(m, opts.override_directory ? ::helpers::path(opts.override_directory) : ::helpers::path() ); + MiniCargo_Build(m, bs_override_dir ); } catch(const ::std::exception& e) { diff --git a/tools/minicargo/manifest.cpp b/tools/minicargo/manifest.cpp index 67c4e8a6..dd7d8d23 100644 --- a/tools/minicargo/manifest.cpp +++ b/tools/minicargo/manifest.cpp @@ -459,7 +459,7 @@ void PackageManifest::set_features(const ::std::vector<::std::string>& features, } } } -void PackageManifest::load_dependencies(Repository& repo) +void PackageManifest::load_dependencies(Repository& repo, bool include_build) { TRACE_FUNCTION_F(m_name); DEBUG("Loading depencencies for " << m_name); @@ -472,17 +472,16 @@ void PackageManifest::load_dependencies(Repository& repo) { continue ; } - dep.load_manifest(repo, base_path); + dep.load_manifest(repo, base_path, include_build); } // TODO: Only enable if build script overrides aren't enabled. - // - Loading it doesn't matter much - if( m_build_script != "" /*&& false*/ ) + if( m_build_script != "" && include_build ) { for(auto& dep : m_build_dependencies) { assert( !dep.m_optional ); - dep.load_manifest(repo, base_path); + dep.load_manifest(repo, base_path, true); } } } @@ -554,7 +553,7 @@ void PackageManifest::load_build_script(const ::std::string& path) m_build_script_output = rv; } -void PackageRef::load_manifest(Repository& repo, const ::helpers::path& base_path) +void PackageRef::load_manifest(Repository& repo, const ::helpers::path& base_path, bool include_build_deps) { TRACE_FUNCTION_F(this->m_name); // If the path isn't set, check for: @@ -585,7 +584,7 @@ void PackageRef::load_manifest(Repository& repo, const ::helpers::path& base_pat } m_manifest->set_features(this->m_features, this->m_use_default_features); - m_manifest->load_dependencies(repo); + m_manifest->load_dependencies(repo, include_build_deps); } PackageVersion PackageVersion::from_string(const ::std::string& s) diff --git a/tools/minicargo/manifest.h b/tools/minicargo/manifest.h index 71eb066d..a17db929 100644 --- a/tools/minicargo/manifest.h +++ b/tools/minicargo/manifest.h @@ -150,7 +150,7 @@ public: return *m_manifest; } - void load_manifest(Repository& repo, const ::helpers::path& base_path); + void load_manifest(Repository& repo, const ::helpers::path& base_path, bool include_build_deps); }; struct PackageTarget @@ -261,7 +261,7 @@ public: } void set_features(const ::std::vector<::std::string>& features, bool enable_default); - void load_dependencies(Repository& repo); + void load_dependencies(Repository& repo, bool include_build); void load_build_script(const ::std::string& path); }; |