2019-10-03 21:49:04 +03:00
|
|
|
default: test
|
|
|
|
|
|
|
|
# All builds
|
|
|
|
|
|
|
|
build: build-rust
|
|
|
|
|
|
|
|
build-rust:
|
|
|
|
cargo build --all
|
|
|
|
|
|
|
|
build-kotlin:
|
|
|
|
./gradlew build -x test
|
|
|
|
|
|
|
|
build-swift:
|
|
|
|
bin/run-ios-build.sh
|
|
|
|
|
2019-04-30 15:46:21 +03:00
|
|
|
build-apk:
|
2019-06-05 15:02:12 +03:00
|
|
|
./gradlew glean-core:build
|
2019-04-30 15:46:21 +03:00
|
|
|
./gradlew glean-sample-app:build
|
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
.PHONY: build build-rust build-kotlin build-swift build-apk
|
2019-04-30 15:46:21 +03:00
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
# All tests
|
|
|
|
|
|
|
|
test: test-rust
|
|
|
|
|
|
|
|
test-rust:
|
|
|
|
cargo test --all
|
|
|
|
|
|
|
|
test-rust-with-logs:
|
|
|
|
RUST_LOG=glean_core=debug cargo test --all -- --nocapture --test-threads=1
|
|
|
|
|
|
|
|
test-kotlin:
|
|
|
|
./gradlew test
|
|
|
|
|
|
|
|
test-swift:
|
|
|
|
bin/run-ios-tests.sh
|
|
|
|
|
|
|
|
.PHONY: test test-rust test-rust-with-logs test-kotlin test-swift
|
2019-04-30 15:46:21 +03:00
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
# Linting
|
|
|
|
|
|
|
|
lint: clippy
|
|
|
|
|
|
|
|
clippy:
|
2019-05-20 17:17:24 +03:00
|
|
|
cargo clippy --all --all-targets --all-features -- -D warnings
|
2019-05-23 18:11:30 +03:00
|
|
|
|
|
|
|
ktlint:
|
2019-05-14 17:54:33 +03:00
|
|
|
./gradlew ktlint detekt
|
2019-05-23 18:11:30 +03:00
|
|
|
|
2019-09-11 12:13:57 +03:00
|
|
|
swiftlint:
|
|
|
|
swiftlint --strict
|
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
.PHONY: lint clippy ktlint swiftlint
|
|
|
|
|
|
|
|
# Formatting
|
|
|
|
|
|
|
|
fmt: rustfmt
|
|
|
|
|
|
|
|
rustfmt:
|
2019-04-30 15:46:21 +03:00
|
|
|
cargo fmt --all
|
|
|
|
|
2019-09-11 12:13:57 +03:00
|
|
|
swiftfmt:
|
|
|
|
swiftformat glean-core/ios samples/ios --swiftversion 5 --verbose
|
2019-05-12 17:21:33 +03:00
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
.PHONY: fmt rustfmt swiftfmt
|
2019-06-05 16:50:44 +03:00
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
# Docs
|
2019-09-11 17:30:25 +03:00
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
docs: rust-docs kotlin-docs
|
2019-06-05 15:02:12 +03:00
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
rust-docs:
|
2019-06-05 15:02:12 +03:00
|
|
|
bin/build-rust-docs.sh
|
2019-10-03 21:49:04 +03:00
|
|
|
|
|
|
|
kotlin-docs:
|
2019-06-05 15:02:12 +03:00
|
|
|
./gradlew docs
|
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
swift-docs:
|
2019-09-27 19:49:34 +03:00
|
|
|
bin/build-swift-docs.sh
|
2019-10-03 21:49:04 +03:00
|
|
|
|
|
|
|
.PHONY: docs rust-docs kotlin-docs swift-docs
|
2019-09-27 19:49:34 +03:00
|
|
|
|
2019-06-05 15:02:12 +03:00
|
|
|
linkcheck: docs
|
|
|
|
# Requires https://wummel.github.io/linkchecker/
|
|
|
|
linkchecker --ignore-url javadoc --ignore-url docs/glean_core build/docs
|
|
|
|
.PHONY: linkcheck
|
2019-08-09 10:25:47 +03:00
|
|
|
|
2019-10-03 21:49:04 +03:00
|
|
|
# Utilities
|
|
|
|
|
|
|
|
android-emulator:
|
|
|
|
$(ANDROID_HOME)/emulator/emulator -avd Nexus_5X_API_P -netdelay none -netspeed full
|
|
|
|
.PHONY: android-emulator
|
|
|
|
|
|
|
|
cbindgen:
|
|
|
|
RUSTUP_TOOLCHAIN=nightly \
|
|
|
|
cbindgen glean-core/ffi --lockfile Cargo.lock -o glean-core/ffi/glean.h
|
|
|
|
cp glean-core/ffi/glean.h glean-core/ios/Glean/GleanFfi.h
|
|
|
|
.PHONY: cbindgen
|
|
|
|
|
2019-08-09 10:25:47 +03:00
|
|
|
rust-coverage:
|
|
|
|
# Expects a Rust nightly toolchain to be available.
|
|
|
|
# Expects grcov and genhtml to be available in $PATH.
|
|
|
|
CARGO_INCREMENTAL=0 \
|
|
|
|
RUSTFLAGS='-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads' \
|
|
|
|
RUSTUP_TOOLCHAIN=nightly \
|
|
|
|
cargo build
|
|
|
|
zip -0 ccov.zip `find . \( -name "glean*.gc*" \) -print`
|
|
|
|
grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore-dir "/*" --ignore-dir "glean-core/ffi/*" -o lcov.info
|
|
|
|
genhtml -o report/ --show-details --highlight --ignore-errors source --legend lcov.info
|
|
|
|
.PHONY: rust-coverage
|