Update documentation version
Use latest GDAL 3.5 pre-bindings for compiling for docs.
MODIFY
gdal-sys/build.rs
gdal-sys/build.rs
@@ -57,13 +57,15 @@ fn find_gdal_dll(lib_dir: &Path) -> io::Result<Option<String>> {
Ok(None)
}
-fn add_docs_rs_helper() {
+fn add_docs_rs_helper(version: Option<&str>) {
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("docs_rs_helper.rs");
- let docs_helper_code = if std::env::var_os("DOCS_RS").is_some() {
+ let docs_helper_code = if let Some(version) = version {
+ format!(
r#"
- pub fn gdal_version_docs_rs_wrapper() -> String {
- "3020000".to_string()
- }"#
+ pub fn gdal_version_docs_rs_wrapper() -> String {{
+ "{version}".to_string()
+ }}"#
+ )
} else {
r#"
pub fn gdal_version_docs_rs_wrapper() -> String {
@@ -76,18 +78,19 @@ fn add_docs_rs_helper() {
c_res.to_string_lossy().into_owned()
}
}"#
+ .to_string()
};
std::fs::write(&out_path, docs_helper_code.as_bytes()).unwrap();
}
fn main() {
- add_docs_rs_helper();
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("bindings.rs");
// Hardcode a prebuilt binding version while generating docs.
// Otherwise docs.rs will explode due to not actually having libgdal installed.
if std::env::var("DOCS_RS").is_ok() {
- let version = Version::parse("3.2.0").expect("invalid version for docs.rs");
+ let version = Version::parse("3.5.0").expect("invalid version for docs.rs");
+ add_docs_rs_helper(Some("3050000"));
println!(
"cargo:rustc-cfg=gdal_sys_{}_{}_{}",
version.major, version.minor, version.patch
@@ -107,6 +110,7 @@ fn main() {
return;
}
+ add_docs_rs_helper(None);
println!("cargo:rerun-if-env-changed=GDAL_STATIC");
println!("cargo:rerun-if-env-changed=GDAL_DYNAMIC");
println!("cargo:rerun-if-env-changed=GDAL_INCLUDE_DIR");

Update documentation version

Use latest GDAL 3.5 pre-bindings for compiling for docs.