Unverified Commit 69317005 authored by boklm's avatar boklm
Browse files

Bug 40089: Change how we set MOZ_BUILD_DATE

For normal alpha/release builds, we use the date from the commit, on
which we add the numbers from the version string as seconds (in order to
keep increasing the build date when we release a new version without
adding new commits).

For nightly-testbuild, we use the date from the commit.

For nightly we try to parse the day from the version number, or use the
current day at 00:00:01.
parent 0a782e66
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -9,10 +9,6 @@ builddir=/var/tmp/build/[% project %]
mkdir $distdir/[% project %]
mkdir /var/tmp/build

cat > get-moz-build-date << "EOF"
[% INCLUDE "get-moz-build-date" %]
EOF

[% IF !c("var/fetch_gradle_dependencies") %]
  tar -C $distdir -xf [% c('input_files_by_name/geckoview') %]
  gradle_repo=$rootdir/[% c('input_files_by_name/gradle-dependencies') %]
@@ -60,12 +56,7 @@ sed -i 's/tag = getGitHash()/tag = \"[% c('abbrev') %]\"/' publish.gradle
  export LANG=C.UTF-8
  patch -p1 < $rootdir/mavenLocal.patch

  eval $(perl $rootdir/get-moz-build-date [% pc("fenix", "var/copyright_year") %] [% pc("fenix", "var/torbrowser_version") %])
  if [ -z $MOZ_BUILD_DATE ]
  then
    echo "MOZ_BUILD_DATE is not set"
    exit 1
  fi
  [% c("var/set_MOZ_BUILD_DATE") %]

  # Increase the maximum memory usage, for when compiling with --disable-install-strip
  gradle_args="--offline --no-daemon -Dmaven.repo.local=$gradle_repo -Dorg.gradle.jvmargs=-Xmx8g"
+0 −30
Original line number Diff line number Diff line
#!/usr/bin/perl -w
# Generate a MOZ_BUILD_DATE based on Tor Browser version number

use strict;

die "wrong number of arguments" unless @ARGV == 2;
my ($year, $version) = @ARGV;
my $date;
if ($version =~ m/^tbb-nightly\.([^\.]+)\.([^\.]+)\.([^\.]+)$/) {
  $date = sprintf("%d%02d%02d010101", $1, $2, $3);
} elsif ($version eq 'testbuild') {
  # There is no need for an increasing build date in test builds. Just hardcode
  # it to a value that is compatible with the v1 versionCode scheme on Android,
  # see: #34163. We adjust the date to the new cutoff according to
  # https://github.com/mozilla-mobile/fenix/pull/14952, following Mozilla.
  # This should be unproblematic for test builds anyway.
  $date = 20141228000000;
} else {
  my @v = split(/[\.ab]/, $version);
  push @v, '0' if @v < 4;
  push @v, '0' if @v < 4;
  # When MOZ_BUILD_DATE was based on the firefox version, with
  # Tor Browser 8.0.6 and firefox 60.5.1 it was 20190204060201
  # We can remove 5 from the month, while keeping it increasing.
  my $month = $v[0] - 5;
  $date = 1010101 + $year * 10000000000 + $month * 100000000
             + $v[1] * 1000000 + $v[2] * 10000 + $v[3];
  $date += 1000000 unless $version =~ m/[ab]/;
}
print "export MOZ_BUILD_DATE=$date\n";
+1 −10
Original line number Diff line number Diff line
@@ -9,10 +9,6 @@ builddir=/var/tmp/build/[% project %]
mkdir -p $distdir/[% project %]
mkdir -p /var/tmp/build

cat > get-moz-build-date << "EOF"
[% INCLUDE "get-moz-build-date" %]
EOF

[% IF !c("var/fetch_gradle_dependencies") %]
  tar -C $distdir -xf [% c('input_files_by_name/geckoview') %]
  gradle_repo=$rootdir/[% c('input_files_by_name/gradle-dependencies') %]
@@ -71,12 +67,7 @@ v=[% c("variant") %]
  export LANG=C.UTF-8
  patch -p1 < $rootdir/mavenLocal.patch

  eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
  if [ -z $MOZ_BUILD_DATE ]
  then
    echo "MOZ_BUILD_DATE is not set"
    exit 1
  fi
  [% c("var/set_MOZ_BUILD_DATE") %]

  # Bug 40485: Inject deterministic build date into Glean.
  echo "ext.gleanBuildDate = \"0\"" >> app/build.gradle
+1 −6
Original line number Diff line number Diff line
@@ -70,12 +70,7 @@ MOZCONFIG_EOF
  export ASAN_OPTIONS="detect_leaks=0"
[% END -%]

eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
if [ -z $MOZ_BUILD_DATE ]
then
    echo "MOZ_BUILD_DATE is not set"
    exit 1
fi
[% c("var/set_MOZ_BUILD_DATE") %]

[% IF c("var/windows") %]
  # Make sure widl is not inserting random timestamps, see #21837.
+0 −1
Original line number Diff line number Diff line
@@ -153,7 +153,6 @@ input_files:
  - project: container-image
  - name: '[% c("var/compiler") %]'
    project: '[% c("var/compiler") %]'
  - filename: get-moz-build-date
  - project: binutils
    name: binutils
    enable: '[% c("var/linux") %]'
Loading