Skip to content

Commit 51ee421

Browse files
committed
tectonic(!): switch to using tectonic_bundles
Start using the separated-out bundle implementation crate. Now you can work with bundles, and the cache, without having to link to XeTeX and everything! This is a BREAKING CHANGE because the original bundle implementations have been removed, and the Bundle trait has gained a new required method.
1 parent a070d2b commit 51ee421

11 files changed

+60
-796
lines changed

Diff for: CARGO_README.md

+2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ sub-crates:
5757
- [`tectonic_bridge_graphite2`](https://crates.io/crates/tectonic_bridge_graphite2)
5858
- [`tectonic_bridge_harfbuzz`](https://crates.io/crates/tectonic_bridge_harfbuzz)
5959
- [`tectonic_bridge_icu`](https://crates.io/crates/tectonic_bridge_icu)
60+
- [`tectonic_bundles`](https://crates.io/crates/tectonic_bundles)
6061
- [`tectonic_cfg_support`](https://crates.io/crates/tectonic_cfg_support)
6162
- [`tectonic_dep_support`](https://crates.io/crates/tectonic_dep_support)
63+
- [`tectonic_docmodel`](https://crates.io/crates/tectonic_docmodel)
6264
- [`tectonic_engine_bibtex`](https://crates.io/crates/tectonic_engine_bibtex)
6365
- [`tectonic_engine_xdvipdfmx`](https://crates.io/crates/tectonic_engine_xdvipdfmx)
6466
- [`tectonic_engine_xetex`](https://crates.io/crates/tectonic_engine_xetex)

Diff for: Cargo.lock

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+5-3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ serde = { version = "^1.0", features = ["derive"], optional = true }
6767
sha2 = "^0.9"
6868
structopt = "0.3"
6969
tectonic_bridge_core = { path = "crates/bridge_core", version = "0.0.0-dev.0" }
70+
tectonic_bundles = { path = "crates/bundles", version = "0.0.0-dev.0", default-features = false }
7071
tectonic_docmodel = { path = "crates/docmodel", version = "0.0.0-dev.0", optional = true }
7172
tectonic_engine_bibtex = { path = "crates/engine_bibtex", version = "0.0.0-dev.0" }
7273
tectonic_engine_xdvipdfmx = { path = "crates/engine_xdvipdfmx", version = "0.0.0-dev.0" }
@@ -97,10 +98,10 @@ serialization = ["serde", "tectonic_docmodel", "toml"]
9798

9899
external-harfbuzz = ["tectonic_engine_xetex/external-harfbuzz"]
99100

100-
geturl-curl = ["tectonic_geturl/curl"]
101-
geturl-reqwest = ["tectonic_geturl/reqwest"]
101+
geturl-curl = ["tectonic_bundles/geturl-curl", "tectonic_geturl/curl"]
102+
geturl-reqwest = ["tectonic_bundles/geturl-reqwest", "tectonic_geturl/reqwest"]
102103

103-
native-tls-vendored = ["tectonic_geturl/native-tls-vendored"]
104+
native-tls-vendored = ["tectonic_bundles/native-tls-vendored", "tectonic_geturl/native-tls-vendored"]
104105

105106
# developer feature to compile with the necessary flags for profiling tectonic.
106107
profile = []
@@ -129,6 +130,7 @@ tectonic_bridge_flate = "thiscommit:2021-01-01:eer4ahL4"
129130
tectonic_bridge_graphite2 = "2c1ffcd702a662c003bd3d7d0ca4d169784cb6ad"
130131
tectonic_bridge_harfbuzz = "2c1ffcd702a662c003bd3d7d0ca4d169784cb6ad"
131132
tectonic_bridge_icu = "2c1ffcd702a662c003bd3d7d0ca4d169784cb6ad"
133+
tectonic_bundles = "thiscommit:2021-06-13:Q0esYor"
132134
tectonic_cfg_support = "thiscommit:aeRoo7oa"
133135
tectonic_dep_support = "5faf4205bdd3d31101b749fc32857dd746f9e5bc"
134136
tectonic_docmodel = "cd77b60d48b1ae3ef80d708e6858ea91cd9fa812"

Diff for: src/config.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ use std::{
1515
path::{Path, PathBuf},
1616
sync::atomic::{AtomicBool, Ordering},
1717
};
18+
use tectonic_bundles::{
19+
cache::Cache, dir::DirBundle, itar::IndexedTarBackend, zip::ZipBundle, Bundle,
20+
};
21+
use tectonic_io_base::app_dirs;
1822
use url::Url;
1923

2024
use crate::{
21-
app_dirs,
2225
errors::{ErrorKind, Result},
23-
io::cached_itarbundle::CachedITarBundle,
24-
io::dirbundle::DirBundle,
25-
io::zipbundle::ZipBundle,
26-
io::Bundle,
2726
status::StatusBackend,
2827
};
2928

@@ -123,8 +122,13 @@ impl PersistentConfig {
123122
custom_cache_root: Option<&Path>,
124123
status: &mut dyn StatusBackend,
125124
) -> Result<Box<dyn Bundle>> {
126-
let bundle = CachedITarBundle::new(url, only_cached, custom_cache_root, status)?;
125+
let mut cache = if let Some(root) = custom_cache_root {
126+
Cache::get_for_custom_directory(root)
127+
} else {
128+
Cache::get_user_default()?
129+
};
127130

131+
let bundle = cache.open::<IndexedTarBackend>(url, only_cached, status)?;
128132
Ok(Box::new(bundle) as _)
129133
}
130134

@@ -190,7 +194,7 @@ impl Default for PersistentConfig {
190194
fn default() -> Self {
191195
PersistentConfig {
192196
default_bundles: vec![BundleInfo {
193-
url: String::from("https://archive.org/services/purl/net/pkgwpub/tectonic-default"),
197+
url: String::from(tectonic_bundles::FALLBACK_BUNDLE_URL),
194198
}],
195199
}
196200
}

Diff for: src/docmodel.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ use std::{
1212
fs, io,
1313
path::{Path, PathBuf},
1414
};
15+
use tectonic_bundles::{
16+
cache::Cache, dir::DirBundle, itar::IndexedTarBackend, zip::ZipBundle, Bundle,
17+
};
1518
use tectonic_docmodel::{
1619
document::{BuildTargetType, Document},
1720
workspace::{Workspace, WorkspaceCreator},
@@ -23,7 +26,6 @@ use crate::{
2326
config, ctry,
2427
driver::{OutputFormat, PassSetting, ProcessingSessionBuilder},
2528
errors::{ErrorKind, Result},
26-
io::{cached_itarbundle::CachedITarBundle, dirbundle::DirBundle, zipbundle::ZipBundle, Bundle},
2729
status::StatusBackend,
2830
test_util, tt_note,
2931
};
@@ -109,10 +111,10 @@ impl DocumentExt for Document {
109111
Ok(Box::new(test_util::TestBundle::default()))
110112
} else if let Ok(url) = Url::parse(&self.bundle_loc) {
111113
if url.scheme() != "file" {
112-
let bundle = CachedITarBundle::new(
114+
let mut cache = Cache::get_user_default()?;
115+
let bundle = cache.open::<IndexedTarBackend>(
113116
&self.bundle_loc,
114117
setup_options.only_cached,
115-
None,
116118
status,
117119
)?;
118120
Ok(Box::new(bundle))

Diff for: src/driver.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use std::{
2727
time::SystemTime,
2828
};
2929
use tectonic_bridge_core::{CoreBridgeLauncher, DriverHooks, SystemRequestError};
30+
use tectonic_bundles::Bundle;
3031
use tectonic_io_base::{
3132
digest::DigestData,
3233
filesystem::{FilesystemIo, FilesystemPrimaryInputIo},
@@ -40,7 +41,7 @@ use crate::{
4041
io::{
4142
format_cache::FormatCache,
4243
memory::{MemoryFileCollection, MemoryIo},
43-
Bundle, InputOrigin,
44+
InputOrigin,
4445
},
4546
status::StatusBackend,
4647
tt_error, tt_note, tt_warning,

0 commit comments

Comments
 (0)