Skip to content

Commit 01f703f

Browse files
authored
Set a doc build variable for executorch version (#13351)
### Summary Now in docs we can use `${executorch_version}` to represent executorch version. It's defined in docs/source/executorch_custom_versions.py `EXECUTORCH_VERSION = "0.7.0"` ### Test plan In https://docs-preview.pytorch.org/pytorch/executorch/13351/getting-started.html#id1, the version is correct: ``` implementation("org.pytorch:executorch-android:0.7.0") ```
1 parent 1e3be14 commit 01f703f

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

docs/source/executorch_custom_versions.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"""
88
Sphinx extension to replace ${executorch_version:TAG} with version numbers.
99
10+
It also defines a special variable ${executorch_version} that is set to the value
11+
of `EXECUTORCH_VERSION` defined in this file.
12+
1013
This custom extension pulls third-party version strings from files in the
1114
.ci/docker/ci_commit_pins directory, and uses them to expand specific strings in
1215
markdown files.
@@ -24,10 +27,13 @@
2427
"pytorch.txt",
2528
]
2629

30+
EXECUTORCH_VERSION = "0.7.0"
31+
2732
variables: dict[str, str] = {}
2833

2934

30-
def read_version_files():
35+
def populate_version_variable():
36+
variables["${executorch_version}"] = EXECUTORCH_VERSION
3137
cwd = os.getcwd()
3238
version_file_path = os.path.join(cwd, "..", ".ci", "docker", "ci_commit_pins")
3339

@@ -38,7 +44,7 @@ def read_version_files():
3844
variables[var_name] = f.read().strip()
3945

4046

41-
read_version_files()
47+
populate_version_variable()
4248

4349

4450
def replace_variables(app, doctree, docname):

docs/source/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ To add the library to your app, add the following dependency to gradle build rul
124124
```
125125
# app/build.gradle.kts
126126
dependencies {
127-
implementation("org.pytorch:executorch-android:0.6.0")
127+
implementation("org.pytorch:executorch-android:${executorch_version}")
128128
}
129129
130130
# See latest available versions in https://mvnrepository.com/artifact/org.pytorch/executorch-android

docs/source/using-executorch-android.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ The AAR library can be used for generic Android device with arm64-v8a or x86_64
2828

2929
ExecuTorch is available on [Maven Central](https://mvnrepository.com/artifact/org.pytorch/executorch-android).
3030

31-
Simply add the target [`org.pytorch:executorch-android:0.6.0-rc1`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/0.6.0-rc1/) to your Android app dependency (build.gradle), and build your app.
31+
Simply add the target [`org.pytorch:executorch-android:${executorch_version}`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/${executorch_version}/) to your Android app dependency (build.gradle), and build your app.
3232

3333
For example:
3434
```
3535
# app/build.gradle.kts
3636
dependencies {
37-
implementation("org.pytorch:executorch-android:0.6.0-rc1")
37+
implementation("org.pytorch:executorch-android:${executorch_version}")
3838
}
3939
```
4040

@@ -53,7 +53,8 @@ You can also directly specify an AAR file in the app. We upload pre-built AAR to
5353

5454
| Version | AAR | SHASUMS |
5555
| ------- | --- | ------- |
56-
| [v0.6.0-rc1](https://github.com/pytorch/executorch/releases/tag/v0.6.0-rc1) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0-rc1/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0-rc1/executorch.aar.sha256sums) |
56+
| [${executorch_version}](https://github.com/pytorch/executorch/releases/tag/${executorch_version}) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version}/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version}/executorch.aar.sha256sums) |
57+
| [v0.6.0](https://github.com/pytorch/executorch/releases/tag/v0.6.0) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0/executorch.aar.sha256sums) |
5758
| [v0.5.0](https://github.com/pytorch/executorch/releases/tag/v0.5.0) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar.sha256sums) |
5859

5960
### Snapshots from main branch
@@ -90,7 +91,7 @@ implementation("com.facebook.fbjni:fbjni:0.5.1")
9091
In your app working directory, such as executorch/examples/demo-apps/android/LlamaDemo,
9192
```
9293
mkdir -p app/libs
93-
curl https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0-rc1/executorch.aar -o app/libs/executorch.aar
94+
curl https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version}/executorch.aar -o app/libs/executorch.aar
9495
```
9596

9697
And include it in gradle:

0 commit comments

Comments
 (0)