diff --git a/Cargo.lock b/Cargo.lock index ad268a474a..58f209d62b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -241,6 +241,13 @@ dependencies = [ "whatsys", ] +[[package]] +name = "glean-bundle" +version = "1.0.0" +dependencies = [ + "glean-ffi", +] + [[package]] name = "glean-core" version = "36.0.1" diff --git a/Cargo.toml b/Cargo.toml index ce14c91011..2704a16dc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,13 @@ members = [ "glean-core", "glean-core/ffi", "glean-core/rlb", + "glean-core/bundle", +] + +default-members = [ + "glean-core", + "glean-core/ffi", + "glean-core/rlb", ] exclude = [ diff --git a/glean-core/android/build.gradle b/glean-core/android/build.gradle index a2462e2159..d1a71ef531 100644 --- a/glean-core/android/build.gradle +++ b/glean-core/android/build.gradle @@ -140,7 +140,7 @@ afterEvaluate { cargo { // The directory of the Cargo.toml to build. - module = '../ffi' + module = '../bundle' // The Android NDK API level to target. apiLevel = 21 diff --git a/glean-core/bundle/Cargo.toml b/glean-core/bundle/Cargo.toml new file mode 100644 index 0000000000..84f3e3ed71 --- /dev/null +++ b/glean-core/bundle/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "glean-bundle" +# No need to ever change this version +version = "1.0.0" +authors = ["The Glean Team "] +edition = "2018" +description = "Static/Dynamic library build of glean-ffi, for use in mobile builds" +repository = "https://github.com/mozilla/glean" +license = "MPL-2.0" + +# This crate is never published to crates.io +publish = false + +# We use the same name as glean-ffi. +# The Kotlin/Swift/Python bindings will use this name. +[lib] +name = "glean_ffi" +crate-type = ["staticlib", "cdylib"] + +[dependencies.glean-ffi] +# No version specified, we build against what's available here. +path = "../ffi" + +[features] +# Enable the "safe-mode" Rust storage backend instead of the default LMDB one. +rkv-safe-mode = ["glean-ffi/rkv-safe-mode"] diff --git a/glean-core/bundle/src/lib.rs b/glean-core/bundle/src/lib.rs new file mode 100644 index 0000000000..4186312f15 --- /dev/null +++ b/glean-core/bundle/src/lib.rs @@ -0,0 +1,5 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +pub use glean_ffi; diff --git a/glean-core/ffi/Cargo.toml b/glean-core/ffi/Cargo.toml index 6936793ce3..c857408999 100644 --- a/glean-core/ffi/Cargo.toml +++ b/glean-core/ffi/Cargo.toml @@ -24,7 +24,7 @@ maintenance = { status = "actively-developed" } [lib] name = "glean_ffi" -crate-type = ["lib", "staticlib", "cdylib"] +crate-type = ["lib"] [dependencies] ffi-support = "0.4.0" diff --git a/glean-core/ffi/examples/Makefile b/glean-core/ffi/examples/Makefile index e3e96ebbc7..b68c2d0c0e 100644 --- a/glean-core/ffi/examples/Makefile +++ b/glean-core/ffi/examples/Makefile @@ -18,7 +18,7 @@ glean_app_release: $(SRC) $(OBJECTS_RELEASE) $(HEADERS) $(CC) $(CFLAGS) -I.. -o $@ $(SRC) $(OBJECTS_RELEASE) $(OBJECTS_DEBUG): ../src/lib.rs - cargo build + cargo build --package glean-bundle $(OBJECTS_RELEASE): ../src/lib.rs - cargo build --release + cargo build --package glean-bundle --release diff --git a/glean-core/ios/Glean.xcodeproj/project.pbxproj b/glean-core/ios/Glean.xcodeproj/project.pbxproj index 8c50559073..e0136efbc7 100644 --- a/glean-core/ios/Glean.xcodeproj/project.pbxproj +++ b/glean-core/ios/Glean.xcodeproj/project.pbxproj @@ -523,7 +523,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "bash $PWD/../../build-scripts/xc-universal-binary.sh glean-ffi $PWD/../.. $buildvariant\n"; + shellScript = "bash $PWD/../../build-scripts/xc-universal-binary.sh glean-bundle $PWD/../.. $buildvariant\n"; }; BFB59A9723429FC000F40CA8 /* Run Glean SDK generator */ = { isa = PBXShellScriptBuildPhase; diff --git a/glean-core/python/setup.py b/glean-core/python/setup.py index 6fc71453c1..22f1cead7e 100644 --- a/glean-core/python/setup.py +++ b/glean-core/python/setup.py @@ -183,7 +183,7 @@ def run(self): "cargo", "build", "--package", - "glean-ffi", + "glean-bundle", "--target", target, "--features",