/
patch-build_configure_src_rust.rs
69 lines (66 loc) · 1.98 KB
/
patch-build_configure_src_rust.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Check for the OFFLINE_BUILD environment variable to prevent issuing the repo
sync that requires git and an internet connection.
--- build/configure/src/rust.rs.orig 2023-03-31 02:32:25 UTC
+++ build/configure/src/rust.rs
@@ -1,6 +1,8 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
+use std::env;
+
use ninja_gen::cargo::CargoBuild;
use ninja_gen::cargo::CargoClippy;
use ninja_gen::cargo::CargoFormat;
@@ -8,6 +10,7 @@ use ninja_gen::git::SyncSubmodule;
use ninja_gen::cargo::CargoTest;
use ninja_gen::cargo::RustOutput;
use ninja_gen::git::SyncSubmodule;
+use ninja_gen::git::SyncSubmoduleOffline;
use ninja_gen::glob;
use ninja_gen::inputs;
use ninja_gen::Build;
@@ -24,18 +27,34 @@ fn prepare_translations(build: &mut Build) -> Result<(
fn prepare_translations(build: &mut Build) -> Result<()> {
// ensure repos are checked out
- build.add(
- "ftl:repo:core",
- SyncSubmodule {
- path: "ftl/core-repo",
- },
- )?;
- build.add(
- "ftl:repo:qt",
- SyncSubmodule {
- path: "ftl/qt-repo",
- },
- )?;
+ if env::var("OFFLINE_BUILD").is_ok() {
+ println!("OFFLINE_BUILD set, skipping git repository sync for translation files.");
+ build.add(
+ "ftl:repo:core",
+ SyncSubmoduleOffline {
+ path: "ftl/core-repo",
+ },
+ )?;
+ build.add(
+ "ftl:repo:qt",
+ SyncSubmoduleOffline {
+ path: "ftl/qt-repo",
+ },
+ )?;
+ } else {
+ build.add(
+ "ftl:repo:core",
+ SyncSubmodule {
+ path: "ftl/core-repo",
+ },
+ )?;
+ build.add(
+ "ftl:repo:qt",
+ SyncSubmodule {
+ path: "ftl/qt-repo",
+ },
+ )?;
+ }
// build anki_i18n and spit out strings.json
build.add(
"rslib/i18n",