Skip to content

Commit 0d2a418

Browse files
committed
Add PlainSourceTarballGpl component that includes also GPL code
1 parent a2cff48 commit 0d2a418

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,8 @@ impl Step for Src {
12111211
}
12121212

12131213
/// Tarball for people who want to build rustc and other components from the source.
1214-
/// Does not contain GPL code for licensing reasons.
1214+
/// Does not contain GPL code, which is separated into `PlainSourceTarballGpl`
1215+
/// for licensing reasons.
12151216
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
12161217
pub struct PlainSourceTarball;
12171218

@@ -1261,7 +1262,39 @@ impl Step for PlainSourceTarball {
12611262
}
12621263
}
12631264

1264-
fn prepare_source_tarball(builder: &Builder<'_>, name: &str, exclude_dirs: &[&str]) -> Tarball {
1265+
/// Tarball with *all* source code for source builds, including GPL-licensed code.
1266+
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
1267+
pub struct PlainSourceTarballGpl;
1268+
1269+
impl Step for PlainSourceTarballGpl {
1270+
/// Produces the location of the tarball generated
1271+
type Output = GeneratedTarball;
1272+
const IS_HOST: bool = true;
1273+
1274+
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1275+
run.alias("rustc-src-gpl")
1276+
}
1277+
1278+
fn is_default_step(builder: &Builder<'_>) -> bool {
1279+
builder.config.rust_dist_src
1280+
}
1281+
1282+
fn make_run(run: RunConfig<'_>) {
1283+
run.builder.ensure(PlainSourceTarballGpl);
1284+
}
1285+
1286+
/// Creates the plain source tarball
1287+
fn run(self, builder: &Builder<'_>) -> GeneratedTarball {
1288+
let tarball = prepare_source_tarball(builder, "src-gpl", &[]);
1289+
tarball.bare()
1290+
}
1291+
}
1292+
1293+
fn prepare_source_tarball<'a>(
1294+
builder: &'a Builder<'a>,
1295+
name: &str,
1296+
exclude_dirs: &[&str],
1297+
) -> Tarball<'a> {
12651298
// NOTE: This is a strange component in a lot of ways. It uses `src` as the target, which
12661299
// means neither rustup nor rustup-toolchain-install-master know how to download it.
12671300
// It also contains symbolic links, unlike other any other dist tarball.

src/bootstrap/src/core/builder/cli_paths/snapshots/x_dist.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ expression: dist
2929
[Dist] dist::PlainSourceTarball
3030
targets: [x86_64-unknown-linux-gnu]
3131
- Set({dist::rustc-src})
32+
[Dist] dist::PlainSourceTarballGpl
33+
targets: [x86_64-unknown-linux-gnu]
34+
- Set({dist::rustc-src-gpl})
3235
[Dist] dist::ReproducibleArtifacts
3336
targets: [x86_64-unknown-linux-gnu]
3437
- Set({dist::reproducible-artifacts})

src/bootstrap/src/core/builder/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,7 @@ impl<'a> Builder<'a> {
986986
// and force us to rebuild tools after vendoring dependencies.
987987
// To work around this, create the Tarball after building all the tools.
988988
dist::PlainSourceTarball,
989+
dist::PlainSourceTarballGpl,
989990
dist::BuildManifest,
990991
dist::ReproducibleArtifacts,
991992
dist::Gcc

0 commit comments

Comments
 (0)