Rework documentation

This commit is contained in:
Kyle Mayes
2020-03-31 13:14:52 -04:00
parent 50bfe0c4d0
commit 9ab21d07a9
5 changed files with 64 additions and 24 deletions
+1
View File
@@ -1,3 +1,4 @@
.docs/
target/
Cargo.lock
+5 -1
View File
@@ -10,7 +10,7 @@ license = "Apache-2.0"
description = "Rust bindings for libclang."
documentation = "https://kylemayes.github.io/clang-sys/3_5/clang_sys"
documentation = "https://kylemayes.github.io/clang-sys/runtime/clang_sys"
repository = "https://github.com/KyleMayes/clang-sys"
links = "clang"
@@ -53,3 +53,7 @@ libloading = { version = "0.5", optional = true }
[build-dependencies]
glob = "0.3"
[package.metadata.docs.rs]
features = ["clang_9_0", "runtime"]
+15 -11
View File
@@ -14,32 +14,36 @@ Minimum supported Rust version: **1.36.0**
Released under the Apache License 2.0.
## Documentation
There are two versions of the documentation, one for the API exposed when
linking dynamically or statically and one for the API exposed when linking at
runtime (see the
[Dependencies](https://github.com/KyleMayes/clang-sys#dependencies) section
of the README for more information on the linking options).
The only difference between the APIs exposed is that when linking at runtime a
few additional types and functions are exposed to manage the loaded `libclang`
shared library.
* Runtime - [Documentation](https://kylemayes.github.io/clang-sys/runtime/clang_sys)
* Dynamic / Static - [Documentation](https://kylemayes.github.io/clang-sys/default/clang_sys)
## Supported Versions
To target a version of `libclang`, enable one of the following Cargo features:
* `clang_3_5` - requires `libclang` 3.5 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_5/clang_sys))
* `clang_3_6` - requires `libclang` 3.6 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_6/clang_sys))
* `clang_3_7` - requires `libclang` 3.7 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_7/clang_sys))
* `clang_3_8` - requires `libclang` 3.8 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_8/clang_sys))
* `clang_3_9` - requires `libclang` 3.9 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_9/clang_sys))
* `clang_4_0` - requires `libclang` 4.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/4_0/clang_sys))
* `clang_5_0` - requires `libclang` 5.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/5_0/clang_sys))
* `clang_6_0` - requires `libclang` 6.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/6_0/clang_sys))
* `clang_7_0` - requires `libclang` 7.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/7_0/clang_sys))
* `clang_8_0` - requires `libclang` 8.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/8_0/clang_sys))
* `clang_9_0` - requires `libclang` 9.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/9_0/clang_sys))
If you do not enable one of these features, the API provided by `libclang` 3.5 will be available by
default.
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env python3
import os
import shutil
import subprocess
TARGET = ".docs"
VERSION = "clang_9_0"
if os.path.isdir(TARGET):
shutil.rmtree(TARGET)
os.mkdir(TARGET)
for (name, features) in [("default", VERSION), ("runtime", f"runtime,{VERSION}")]:
subprocess.call(["cargo", "clean"])
subprocess.call(["cargo", "doc", f"--features={features}", "--no-deps"])
print(f"Copying docs to {TARGET}/{name}...")
shutil.copytree(f"target/doc", f"{TARGET}/{name}")
os.chdir(TARGET)
subprocess.call(["git", "init"])
subprocess.call(["git", "remote", "add", "origin", "git@github.com:KyleMayes/clang-sys.git"])
subprocess.call(["git", "checkout", "--orphan", "gh-pages"])
subprocess.call(["git", "add", "-A"])
subprocess.call(["git", "commit", "-m", "\"Update documentation\""])
subprocess.call(["git", "push", "origin", "gh-pages", "--force"])
os.chdir("..")
shutil.rmtree(TARGET)
+13 -12
View File
@@ -14,19 +14,20 @@
//! Rust bindings for `libclang`.
//!
//! ## Supported Versions
//! ## Documentation
//!
//! * 3.5 - [Documentation](https://kylemayes.github.io/clang-sys/3_5/clang_sys)
//! * 3.6 - [Documentation](https://kylemayes.github.io/clang-sys/3_6/clang_sys)
//! * 3.7 - [Documentation](https://kylemayes.github.io/clang-sys/3_7/clang_sys)
//! * 3.8 - [Documentation](https://kylemayes.github.io/clang-sys/3_8/clang_sys)
//! * 3.9 - [Documentation](https://kylemayes.github.io/clang-sys/3_9/clang_sys)
//! * 4.0 - [Documentation](https://kylemayes.github.io/clang-sys/4_0/clang_sys)
//! * 5.0 - [Documentation](https://kylemayes.github.io/clang-sys/5_0/clang_sys)
//! * 6.0 - [Documentation](https://kylemayes.github.io/clang-sys/6_0/clang_sys)
//! * 7.0 - [Documentation](https://kylemayes.github.io/clang-sys/7_0/clang_sys)
//! * 8.0 - [Documentation](https://kylemayes.github.io/clang-sys/8_0/clang_sys)
//! * 9.0 - [Documentation](https://kylemayes.github.io/clang-sys/9_0/clang_sys)
//! There are two versions of the documentation, one for the API exposed when
//! linking dynamically or statically and one for the API exposed when linking
//! at runtime (see the
//! [Dependencies](https://github.com/KyleMayes/clang-sys#dependencies) section
//! of the README for more information on the linking options).
//!
//! The only difference between the APIs exposed is that when linking at runtime
//! a few additional types and functions are exposed to manage the loaded
//! `libclang` shared library.
//!
//! * Runtime - [Documentation](https://kylemayes.github.io/clang-sys/runtime/clang_sys)
//! * Dynamic / Static - [Documentation](https://kylemayes.github.io/clang-sys/default/clang_sys)
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal))]