Skip to content

Commit a0bcf8b

Browse files
committed
Expose the curl geturl backend
And rework the CI to build/test both with and without it.
1 parent 7af050c commit a0bcf8b

File tree

8 files changed

+94
-26
lines changed

8 files changed

+94
-26
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ serialization = ["serde", "toml"]
9797

9898
external-harfbuzz = ["tectonic_bridge_harfbuzz/external-harfbuzz"]
9999

100+
geturl-curl = ["tectonic_geturl/curl"]
100101
geturl-reqwest = ["tectonic_geturl/reqwest"]
101102

102103
# developer feature to compile with the necessary flags for profiling tectonic.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ external library can be detected with either [pkg-config] or [vcpkg]. See the
8787
[vcpkg]: https://vcpkg.readthedocs.io/
8888
[howto-build]: https://tectonic-typesetting.github.io/book/latest/#update-link-when-published
8989

90+
##### `geturl-curl`
91+
92+
Use the [curl] crate to implement HTTP requests. In order for this to take
93+
effect, you must use `--no-default-features` because `geturl-reqwest` is a
94+
default feature and it takes precedence.
95+
96+
[reqwest]: https://docs.rs/curl/
97+
9098
##### `geturl-reqwest` (enabled by default)
9199

92100
Use the [reqwest] crate to implement HTTP requests. This is the default

dist/azure-build-and-test-pkgconfig.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ parameters:
1616
- name: primaryBuild
1717
type: boolean
1818
default: false
19-
- name: externalDeps
19+
- name: installAllDeps
2020
type: boolean
2121
default: false
22+
- name: defaultFeatures
23+
type: boolean
24+
default: true
25+
- name: explicitFeatures
26+
type: string
27+
default: ''
2228

2329
steps:
2430
- template: azure-generic-build-setup.yml
@@ -33,7 +39,7 @@ steps:
3339
libssl-dev
3440
openssl
3541
zlib1g-dev"
36-
if [[ $EXTERNAL_DEPS == True ]] ; then
42+
if [[ $INSTALL_ALL_DEPS == True ]] ; then
3743
pkgs="$pkgs libharfbuzz-dev"
3844
fi
3945
@@ -42,7 +48,7 @@ steps:
4248
displayName: "Install pkg-config dependencies (Ubuntu)"
4349
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
4450
env:
45-
EXTERNAL_DEPS: ${{ parameters.externalDeps }} # maps to "True" or "False"
51+
INSTALL_ALL_DEPS: ${{ parameters.installAllDeps }} # maps to "True" or "False"
4652

4753
- bash: |
4854
set -xeuo pipefail
@@ -53,7 +59,7 @@ steps:
5359
icu4c
5460
libpng
5561
openssl"
56-
if [[ $EXTERNAL_DEPS == True ]] ; then
62+
if [[ $INSTALL_ALL_DEPS == True ]] ; then
5763
pkgs="$pkgs harfbuzz"
5864
fi
5965
@@ -65,7 +71,7 @@ steps:
6571
displayName: "Install pkg-config dependencies (macOS)"
6672
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
6773
env:
68-
EXTERNAL_DEPS: ${{ parameters.externalDeps }}
74+
INSTALL_ALL_DEPS: ${{ parameters.installAllDeps }}
6975

7076
- bash: |
7177
echo "##vso[task.prependpath]C:\msys64\usr\bin"
@@ -92,6 +98,7 @@ steps:
9298

9399
- template: azure-generic-build.yml
94100
parameters:
95-
canaryBuild: ${{ parameters.canaryBuild }}
96-
primaryBuild: ${{ parameters.primaryBuild }}
97-
externalDeps: ${{ parameters.externalDeps }}
101+
canaryBuild: ${{ parameters.canaryBuild }}
102+
primaryBuild: ${{ parameters.primaryBuild }}
103+
defaultFeatures: ${{ parameters.defaultFeatures }}
104+
explicitFeatures: ${{ parameters.explicitFeatures }}

dist/azure-build-and-test-vcpkg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ steps:
7575
- template: azure-generic-build.yml
7676
parameters:
7777
canaryBuild: ${{ parameters.canaryBuild }}
78-
externalDeps: true
78+
explicitFeatures: "external-harfbuzz"

dist/azure-ci-cd.yml

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ parameters:
3535
vmImage: ubuntu-20.04
3636
params:
3737
canaryBuild: true
38-
externalDeps: true
38+
installAllDeps: true
39+
explicitFeatures: "external-harfbuzz"
3940
vars:
4041
TARGET: x86_64-unknown-linux-gnu
4142
TOOLCHAIN: stable
@@ -44,7 +45,7 @@ parameters:
4445
vmImage: ubuntu-20.04
4546
params:
4647
canaryBuild: true
47-
externalDeps: false
48+
installAllDeps: false
4849
vars:
4950
TARGET: x86_64-unknown-linux-gnu
5051
TOOLCHAIN: stable
@@ -69,7 +70,7 @@ parameters:
6970
vmImage: macos-10.15
7071
params:
7172
canaryBuild: true
72-
externalDeps: false
73+
installAllDeps: false
7374
vars:
7475
TARGET: x86_64-apple-darwin
7576
TOOLCHAIN: stable
@@ -78,15 +79,16 @@ parameters:
7879
vmImage: macos-10.15
7980
params:
8081
canaryBuild: true
81-
externalDeps: true
82+
installAllDeps: true
83+
explicitFeatures: "external-harfbuzz"
8284
vars:
8385
TARGET: x86_64-apple-darwin
8486
TOOLCHAIN: stable
8587

8688
- name: windows_intdeps
8789
vmImage: windows-2019
8890
params:
89-
externalDeps: false
91+
installAllDeps: false
9092
vars:
9193
TARGET: x86_64-pc-windows-gnu
9294
TOOLCHAIN: stable-x86_64-pc-windows-gnu
@@ -95,11 +97,43 @@ parameters:
9597
vmImage: windows-2019
9698
params:
9799
canaryBuild: true
98-
externalDeps: true
100+
installAllDeps: true
101+
explicitFeatures: "external-harfbuzz"
99102
vars:
100103
TARGET: x86_64-pc-windows-gnu
101104
TOOLCHAIN: stable-x86_64-pc-windows-gnu
102105

106+
- name: linux_ftmtx_none
107+
vmImage: ubuntu-20.04
108+
params:
109+
canaryBuild: true
110+
installAllDeps: false
111+
defaultFeatures: false
112+
vars:
113+
TARGET: x86_64-unknown-linux-gnu
114+
TOOLCHAIN: stable
115+
116+
- name: linux_ftmtx_all
117+
vmImage: ubuntu-20.04
118+
params:
119+
canaryBuild: true
120+
installAllDeps: true
121+
explicitFeatures: _all_
122+
vars:
123+
TARGET: x86_64-unknown-linux-gnu
124+
TOOLCHAIN: stable
125+
126+
- name: linux_ftmtx_curl
127+
vmImage: ubuntu-20.04
128+
params:
129+
canaryBuild: true
130+
installAllDeps: true
131+
defaultFeatures: false
132+
explicitFeatures: geturl-curl
133+
vars:
134+
TARGET: x86_64-unknown-linux-gnu
135+
TOOLCHAIN: stable
136+
103137
- name: vcpkgBuilds
104138
type: object
105139
default:

dist/azure-generic-build.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,42 @@ parameters:
1616
- name: primaryBuild
1717
type: boolean
1818
default: false
19-
- name: externalDeps
19+
- name: defaultFeatures
2020
type: boolean
21-
default: false
21+
default: true
22+
- name: explicitFeatures
23+
type: string
24+
default: ''
2225

2326
steps:
27+
# We use two variables for feature flagging just because I'm worried about
28+
# quoting the `--features` argument, which will contain spaces.
2429
- bash: |
25-
if [[ $EXTERNAL_DEPS == True ]] ; then
26-
features="external-harfbuzz"
30+
ffs=
31+
fts=
32+
33+
if [[ $DEFAULT_FEATURES_FLAG == False ]] ; then
34+
ffs="--no-default-features"
35+
fi
36+
37+
if [[ $EXPLICIT_FEATURES == _all_ ]] ; then
38+
ffs="--all-features"
2739
else
28-
features=
40+
fts="$EXPLICIT_FEATURES"
2941
fi
3042
31-
echo "Cargo features for this build: $features"
32-
echo "##vso[task.setvariable variable=CARGO_FEATURES;]$features"
43+
echo "Cargo features for this build: $ffs --features=\"$fts\""
44+
echo "##vso[task.setvariable variable=CARGO_FEATURES_EXPLICIT;]$fts"
45+
echo "##vso[task.setvariable variable=CARGO_FEATURES_FLAGS;]$ffs"
3346
displayName: Set feature flags
3447
env:
35-
EXTERNAL_DEPS: ${{ parameters.externalDeps }}
48+
DEFAULT_FEATURES_FLAG: ${{ parameters.defaultFeatures }}
49+
EXPLICIT_FEATURES: ${{ parameters.explicitFeatures }}
3650

37-
- bash: cargo build --all --release --features="$CARGO_FEATURES" -v
51+
- bash: cargo build --all --release $CARGO_FEATURES_FLAGS --features="$CARGO_FEATURES_EXPLICIT" -v
3852
displayName: "cargo build"
3953

40-
- bash: cargo test --all --release --features="$CARGO_FEATURES"
54+
- bash: cargo test --all --release $CARGO_FEATURES_FLAGS --features="$CARGO_FEATURES_EXPLICIT"
4155
displayName: "cargo test"
4256

4357
# For non-canary builds, export artifacts.

docs/src/howto/build-tectonic/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,13 @@ control build options. Tectonic offers the following features:
103103
to a “vendored” (static, internal) version of the [Harfbuzz] text shaping
104104
library. If you would like to link to an externally-supplied version instead,
105105
enable this feature.
106+
- **`geturl-curl`**. Uses the [curl] crate to get URLs. In order for this to
107+
take effect, you must use `--no-default-features` because `geturl-reqwest` is
108+
a default feature and it takes precedence.
106109
- **`geturl-reqwest`** (enabled by default). Uses the [reqwest] crate to get
107110
URLs. This is a good portable default.
108111

112+
[curl]: https://docs.rs/curl/
109113
[reqwest]: https://docs.rs/reqwest/
110114

111115
Some lesser-used features are:

src/io/cached_itarbundle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ fn make_txt_path(base: &Path, digest_text: &str) -> PathBuf {
227227
}
228228

229229
/// Bundle provided by an indexed tar file over http with a local cache.
230-
#[derive(Clone, Debug)]
230+
#[derive(Debug)]
231231
pub struct CachedITarBundle {
232232
url: String,
233233
redirect_url: String,

0 commit comments

Comments
 (0)