Skip to content

Fix issue 20444 - Support SOURCE_DATE_EPOCH for reproducible builds#11035

Merged
dlang-bot merged 3 commits intodlang:masterfrom
Geod24:source-date-epoch
Apr 17, 2020
Merged

Fix issue 20444 - Support SOURCE_DATE_EPOCH for reproducible builds#11035
dlang-bot merged 3 commits intodlang:masterfrom
Geod24:source-date-epoch

Conversation

@Geod24
Copy link
Member

@Geod24 Geod24 commented Apr 14, 2020

Adds support for the de-facto standard `SOURCE_DATE_EPOCH` variable,
for lexer tokens `__DATE__`, `__TIME__`, `__TIMESTAMP__`.

Since this PR touches a bunch of unrelated things, I'll split it into multiple PRs, this PR is solely to show the end goal.

CC @jelly : Can you check the last commit ?
CC @ibuclaw , you might be interested in this.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @Geod24!

Bugzilla references

Auto-close Bugzilla Severity Description
20444 enhancement Make DATE in dlang reproducible using SOURCE_DATE_EPOCH

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#11035"

@Geod24 Geod24 force-pushed the source-date-epoch branch from 4ab95db to 42096e1 Compare April 14, 2020 14:04
@Geod24
Copy link
Member Author

Geod24 commented Apr 14, 2020

Rebased on master, fixed the styling error, applied @WebFreak001 's suggestion.

@Geod24 Geod24 force-pushed the source-date-epoch branch from 42096e1 to f06d8dc Compare April 14, 2020 18:06
Geod24 added 2 commits April 15, 2020 22:01
Instead of having those `__gshared` constant hiddent in the middle of a very long function,
move them to a struct and add documentation.
@Geod24 Geod24 force-pushed the source-date-epoch branch from f06d8dc to f67c53a Compare April 15, 2020 13:18
Adds support for the de-facto standard `SOURCE_DATE_EPOCH` variable,
for lexer tokens `__DATE__`, `__TIME__`, `__TIMESTAMP__`.
@Geod24 Geod24 force-pushed the source-date-epoch branch from f67c53a to bfb538a Compare April 15, 2020 13:21
@Geod24
Copy link
Member Author

Geod24 commented Apr 15, 2020

Moving things to target was a terrible idea. I changed that now, the PR should be much simpler.

@Geod24
Copy link
Member Author

Geod24 commented Apr 16, 2020

Ping ?

@dlang-bot dlang-bot merged commit 4a9d5a0 into dlang:master Apr 17, 2020
@Geod24 Geod24 deleted the source-date-epoch branch April 17, 2020 00:39
@jelly
Copy link

jelly commented Apr 17, 2020

Awesome to see this PR! I tried to build dmd 2.09 with this PR but it doesn't seem compatible. I'll check if it's do-able to build master on Arch.

@baryluk
Copy link

baryluk commented May 28, 2020

Works perfectly for me. Checked on Linux, amd64, with dmd v2.092.0.

Thanks!

@PetarKirov
Copy link
Member

PetarKirov commented Mar 26, 2021

I missed this PR, thanks a lot @Geod24! On less thing to worry about when building D code on NixOS ;)

@ibuclaw
Copy link
Member

ibuclaw commented Jan 28, 2026

CC @ibuclaw , you might be interested in this.

@Geod24 yes I am interested, and the implementation is wrong. Thanks for crossing me out. :-)

$ cat test.c
#include <stdio.h>
void main() { printf(__DATE__ " " __TIME__ "\n"); }

$ SOURCE_DATE_EPOCH=1 gcc test.c -o test-c
$ ./test-c
Jan  1 1970 00:00:01
$ cat test.d
import core.stdc.stdio;
void main() { printf(__DATE__ ~ " " ~ __TIME__ ~ "\n"); }

$ SOURCE_DATE_EPOCH=1 dmd test.d -oftest-d
$ ./test-d
Dec 31 1969 16:00:01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants