Skip to content

Commit 7f1d6bf

Browse files
authored
Merge pull request #66 from linux-credentials/cargo-offline-builds
Cargo offline builds
2 parents dc201b7 + 3ece050 commit 7f1d6bf

9 files changed

Lines changed: 45 additions & 23 deletions

File tree

credentialsd-common/meson.build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,8 @@
3535
# cargo_options += [
3636
# '--target-dir', meson.project_build_root() / meson.current_build_dir() / 'target',
3737
# ]
38+
# if get_option('cargo_offline') == true
39+
# cargo_options += ['--offline']
40+
# endif
3841
#
39-
# subdir('src')
42+
# subdir('src')

credentialsd-common/src/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# message('Building in debug mode')
1111
# endif
1212
#
13-
# cargo_env = ['CARGO_HOME=' + meson.project_build_root() / 'cargo-home']
13+
# cargo_env = ['CARGO_HOME=' + cargo_home]
1414
#
1515
# custom_target(
1616
# 'cargo-build',
@@ -31,4 +31,4 @@
3131
# common_lib_name / 'src' / rust_target / common_lib_name,
3232
# '@OUTPUT@',
3333
# ],
34-
# )
34+
# )

credentialsd-ui/meson.build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ if get_option('profile') == 'development'
6363
run_command('cp', '-f', 'hooks/pre-commit.hook', '.git/hooks/pre-commit', check: false)
6464
endif
6565

66+
cargo_options = [
67+
'--manifest-path', meson.project_source_root() / gui_source_dir / 'Cargo.toml',
68+
]
69+
cargo_options += ['--target-dir', meson.project_build_root() / gui_build_dir / 'target']
70+
if get_option('cargo_offline') == true
71+
cargo_options += ['--offline']
72+
endif
73+
6674
subdir('data')
6775
subdir('po')
6876
subdir('src')

credentialsd-ui/src/meson.build

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ run_command(
2222
check: true,
2323
)
2424

25-
cargo_options = [
26-
'--manifest-path', meson.project_source_root() / gui_source_dir / 'Cargo.toml',
27-
]
28-
cargo_options += ['--target-dir', meson.project_build_root() / gui_build_dir / 'target']
29-
3025
if get_option('profile') == 'default'
3126
cargo_options += ['--release']
3227
rust_target = 'release'
@@ -36,7 +31,7 @@ else
3631
message('Building in debug mode')
3732
endif
3833

39-
cargo_env = ['CARGO_HOME=' + meson.project_build_root() / 'cargo-home']
34+
cargo_env = ['CARGO_HOME=' + cargo_home]
4035

4136
custom_target(
4237
'cargo-build',
@@ -72,4 +67,4 @@ test(
7267
'--nocapture',
7368
],
7469
protocol: 'exitcode',
75-
)
70+
)

credentialsd/meson.build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ cargo_options = [
4848
cargo_options += [
4949
'--target-dir', meson.project_build_root() / meson.current_build_dir() / 'target',
5050
]
51+
if get_option('cargo_offline') == true
52+
cargo_options += ['--offline']
53+
endif
5154

5255
subdir('src')
53-
subdir('tests')
56+
subdir('tests')

credentialsd/src/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ else
77
message('Building in debug mode')
88
endif
99

10-
cargo_env = ['CARGO_HOME=' + meson.project_build_root() / 'cargo-home']
10+
cargo_env = ['CARGO_HOME=' + cargo_home]
1111
message('@0@'.format(cargo_options))
1212

1313
custom_target(
@@ -43,4 +43,4 @@ test(
4343
'--nocapture',
4444
],
4545
protocol: 'exitcode',
46-
)
46+
)

meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ prefix = get_option('prefix')
1212
bindir = prefix / get_option('bindir')
1313
localedir = prefix / get_option('localedir')
1414

15+
cargo_home = get_option('cargo_home')
16+
if cargo_home == ''
17+
cargo_home = meson.project_build_root() / 'cargo-home'
18+
endif
19+
1520
meson.add_dist_script(
1621
'build-aux/dist-vendor.sh',
1722
meson.project_build_root() / 'meson-dist' / meson.project_name()

meson.options

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
option(
2+
'profile',
3+
type: 'combo',
4+
choices: ['default', 'development'],
5+
value: 'default',
6+
description: 'The build profile for Credential Manager. One of "default" or "development".',
7+
)
8+
option(
9+
'cargo_home',
10+
type: 'string',
11+
description: 'The directory to store files downloaded by Cargo',
12+
)
13+
option(
14+
'cargo_offline',
15+
type: 'boolean',
16+
value: false,
17+
description: 'Whether to perform an offline build with Cargo. Defaults to false to download crates from registries.',
18+
)

meson_options.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)