[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser-build][main] 2 commits: Bug 41232: Implement single-arch testbuilds on the monorepo.



Title: GitLab

Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build

Commits:

  • fe08aea2
    by Pier Angelo Vendrame at 2024-09-10T09:54:59+02:00
    Bug 41232: Implement single-arch testbuilds on the monorepo.
    
    The trick of the fake fat AAR does not work anymore, as the fat AAR is
    consumed in the same script where it is created.
    However, running an Android build from a single-arch tree seems not to
    involve different commands, so we can create a shared script and
    include it in both the build steps.
    
  • d057d3b5
    by Pier Angelo Vendrame at 2024-09-10T09:55:04+02:00
    Bug 41234: Add some dependencies needed for Android/release.
    
    Building Android as release fails because we do not provide some
    additional dependencies to our offline builds.
    

9 changed files:

Changes:

  • projects/browser/config
    ... ... @@ -90,7 +90,11 @@ input_files:
    90 90
       - project: geckoview
    
    91 91
         name: fenix
    
    92 92
         pkg_type: build_apk
    
    93
    -    enable: '[% c("var/android") %]'
    
    93
    +    enable: '[% c("var/android") && !c("var/android_single_arch") %]'
    
    94
    +  - project: geckoview
    
    95
    +    name: fenix
    
    96
    +    pkg_type: build
    
    97
    +    enable: '[% c("var/android") && c("var/android_single_arch") %]'
    
    94 98
       - project: tor-expert-bundle
    
    95 99
         name: tor-expert-bundle
    
    96 100
         enable: '[% c("var/tor-browser") %]'
    

  • projects/geckoview/build
    ... ... @@ -43,29 +43,14 @@ echo "Starting ./mach configure $(date)"
    43 43
     echo "Starting ./mach build $(date)"
    
    44 44
     ./mach build --verbose
    
    45 45
     
    
    46
    +echo "Build finished, copying the AAR to the to the destination directory $(date)"
    
    47
    +
    
    46 48
     [% IF !c("var/android_single_arch") -%]
    
    47 49
       mkdir "$distdir/[% project %]"
    
    48 50
       # We don't want the debug or "exoplayer" .aars, but the .aar that has `omni` in its name.
    
    49 51
       find obj-* -type f -name geckoview*omni*.aar -exec cp {} $distdir/[% project %] \;
    
    50 52
     [% ELSE -%]
    
    51
    -  # For single-arch builds, we want to fake a fat aar anyway, to avoid having
    
    52
    -  # arch suffixes in filenames, or having to rename files.
    
    53
    -  cat >> mozconfig-android-all << 'MOZCONFIG_EOF'
    
    54
    -ac_add_options --enable-update-channel=[% c("var/variant") %]
    
    55
    -ac_add_options --with-base-browser-version=[% c("var/torbrowser_version") %]
    
    56
    -export MOZ_INCLUDE_SOURCE_INFO=1
    
    57
    -export MOZ_SOURCE_REPO="[% c('var/gitlab_project') %]"
    
    58
    -export MOZ_SOURCE_CHANGESET=[% c("var/git_commit") %]
    
    59
    -MOZCONFIG_EOF
    
    60
    -
    
    61
    -  echo "Starting the creation of the fake fat AAR $(date)"
    
    62
    -  pushd tools/geckoview
    
    63
    -  touch android-env.sh
    
    64
    -  make fataar ARCHS="[% c('arch') %]"
    
    65
    -  popd
    
    66
    -  MOZCONFIG=mozconfig-android-all ./mach gradle \
    
    67
    -    geckoview:publishWithGeckoBinariesDebugPublicationToMavenLocal \
    
    68
    -    exoplayer2:publishDebugPublicationToMavenLocal
    
    53
    +[% INCLUDE 'build_ac_fenix' %]
    
    69 54
     [% END -%]
    
    70 55
     
    
    71 56
     echo "Starting to package artifacts $(date)"
    

  • projects/geckoview/build_ac_fenix
    1
    +[% IF c('var/has_l10n') -%]
    
    2
    +  echo "Injecting the Firefox's localization to GV $(date)"
    
    3
    +  supported_locales="[% tmpl(c('var/locales_mobile').join(' ')).replace('-r', '-').replace('in', 'id').replace('iw', 'he') %]"
    
    4
    +  l10ncentral="$HOME/.mozbuild/l10n-central"
    
    5
    +  mkdir "$l10ncentral"
    
    6
    +  for tarball in $rootdir/[% c('input_files_by_name/firefox-l10n') %]/*; do
    
    7
    +    tar -C "$l10ncentral" -xf "$tarball"
    
    8
    +  done
    
    9
    +
    
    10
    +  # Do not setup our localization files, as we do not provide any frontend
    
    11
    +  # through GeckoView.
    
    12
    +
    
    13
    +  # No quotes on purpose, to pass each locale as an additional argument.
    
    14
    +  ./mach package-multi-locale --locales en-US $supported_locales
    
    15
    +[% END -%]
    
    16
    +
    
    17
    +echo "Building Android Components $(date)"
    
    18
    +pushd mobile/android/android-components
    
    19
    +gradle $GRADLE_FLAGS assembleGecko -x lint
    
    20
    +popd
    
    21
    +
    
    22
    +# The build might fail with "file exists" otherwise.
    
    23
    +rm -rf /var/tmp/dist/android-toolchain/gradle/glean/pythonenv
    
    24
    +
    
    25
    +echo "Building Fenix $(date)"
    
    26
    +pushd mobile/android/fenix
    
    27
    +
    
    28
    +cp -a $rootdir/[% c('input_files_by_name/tor-expert-bundle-aar') %]/tor-expert-bundle.aar app/
    
    29
    +
    
    30
    +# Use the Android Components we have just built
    
    31
    +echo autoPublish.android-components.dir=../android-components > local.properties
    
    32
    +
    
    33
    +[% IF c('var/has_l10n') -%]
    
    34
    +  tar -C $distdir -xf $rootdir/[% c('input_files_by_name/translation-fenix') %]
    
    35
    +  # Add our localized strings
    
    36
    +  supported_locales="[% tmpl(c('var/locales_mobile').join(' ')) %]"
    
    37
    +  for lang in $supported_locales; do
    
    38
    +    cp "/var/tmp/dist/translation-fenix/$lang/torbrowser_strings.xml" "app/src/main/res/values-$lang/"
    
    39
    +  done
    
    40
    +[% END -%]
    
    41
    +
    
    42
    +# Bug 40485: Inject deterministic build date into Glean.
    
    43
    +echo 'ext.gleanBuildDate = "0"' >> app/build.gradle
    
    44
    +
    
    45
    +variant='[% c("var/variant") %]'
    
    46
    +version_name="[% c('var/torbrowser_version') %] ([% c('var/geckoview_version') %])"
    
    47
    +
    
    48
    +gradle $GRADLE_FLAGS -PversionName="$version_name" "assemble$variant"
    
    49
    +
    
    50
    +echo "Build finished, copying the APK(s) to the destination directory $(date)"
    
    51
    +
    
    52
    +mkdir $distdir/[% project %]
    
    53
    +cp app/build/outputs/apk/fenix/$variant/*.apk $distdir/[% project %]
    
    54
    +
    
    55
    +popd
    
    56
    +

  • projects/geckoview/build_apk
    1 1
     #!/bin/bash
    
    2 2
     [% INCLUDE 'build_common' %]
    
    3 3
     
    
    4
    -tar -C $distdir -xf $rootdir/[% c('input_files_by_name/translation-fenix') %]
    
    5
    -
    
    6
    -tar -xf [% c('input_files_by_name/glean-wheels') %]
    
    7
    -export GLEAN_PYTHON_WHEELS_DIR=$rootdir/glean-wheels
    
    4
    +echo "Starting the creation of the fat AAR $(date)"
    
    8 5
     
    
    9 6
     tar -C $builddir -xf [% c('input_files_by_name/geckoview_armv7') %]
    
    10 7
     tar -C $builddir -xf [% c('input_files_by_name/geckoview_aarch64') %]
    
    ... ... @@ -29,18 +26,6 @@ export MOZ_SOURCE_REPO="[% c('var/gitlab_project') %]"
    29 26
     export MOZ_SOURCE_CHANGESET=[% c("var/git_commit") %]
    
    30 27
     MOZCONFIG_EOF
    
    31 28
     
    
    32
    -[% IF c("var/has_l10n") -%]
    
    33
    -  supported_locales="[% tmpl(c('var/locales_mobile').join(' ')).replace('-r', '-').replace('in', 'id').replace('iw', 'he') %]"
    
    34
    -  l10ncentral="$HOME/.mozbuild/l10n-central"
    
    35
    -  mkdir "$l10ncentral"
    
    36
    -  for tarball in $rootdir/[% c('input_files_by_name/firefox-l10n') %]/*; do
    
    37
    -    tar -C "$l10ncentral" -xf "$tarball"
    
    38
    -  done
    
    39
    -
    
    40
    -  # Do not setup our localization files, as we do not provide any frontend
    
    41
    -  # through GeckoView.
    
    42
    -[% END -%]
    
    43
    -
    
    44 29
     # We still need to specify --tor-browser-version due to bug 34005.
    
    45 30
     ./mach configure \
    
    46 31
       --with-base-browser-version=[% c("var/torbrowser_version") %] \
    
    ... ... @@ -49,43 +34,7 @@ MOZCONFIG_EOF
    49 34
     
    
    50 35
     ./mach build --verbose
    
    51 36
     
    
    52
    -[% IF c('var/has_l10n') -%]
    
    53
    -  # No quotes on purpose, to pass each locale as an additional argument.
    
    54
    -  ./mach package-multi-locale --locales en-US $supported_locales
    
    55
    -[% END -%]
    
    56
    -
    
    57
    -pushd mobile/android/android-components
    
    58
    -gradle $GRADLE_FLAGS assembleGecko -x lint
    
    59
    -popd
    
    60
    -
    
    61
    -# The build might fail with "file exists" otherwise.
    
    62
    -rm -rf /var/tmp/dist/android-toolchain/gradle/glean/pythonenv
    
    63
    -
    
    64
    -pushd mobile/android/fenix
    
    65
    -
    
    66
    -cp -a $rootdir/[% c('input_files_by_name/tor-expert-bundle-aar') %]/tor-expert-bundle.aar app/
    
    67
    -
    
    68
    -# Use the Android Components we have just built
    
    69
    -echo autoPublish.android-components.dir=../android-components > local.properties
    
    70
    -
    
    71
    -# Add our localized strings
    
    72
    -supported_locales="[% tmpl(c('var/locales_mobile').join(' ')) %]"
    
    73
    -for lang in $supported_locales; do
    
    74
    -  cp "/var/tmp/dist/translation-fenix/$lang/torbrowser_strings.xml" "app/src/main/res/values-$lang/"
    
    75
    -done
    
    76
    -
    
    77
    -# Bug 40485: Inject deterministic build date into Glean.
    
    78
    -echo 'ext.gleanBuildDate = "0"' >> app/build.gradle
    
    79
    -
    
    80
    -variant='[% c("var/variant") %]'
    
    81
    -version_name="[% c('var/torbrowser_version') %] ([% c('var/geckoview_version') %])"
    
    82
    -
    
    83
    -gradle $GRADLE_FLAGS -PversionName="$version_name" "assemble$variant"
    
    84
    -
    
    85
    -mkdir $distdir/[% project %]
    
    86
    -cp app/build/outputs/apk/fenix/$variant/*.apk $distdir/[% project %]
    
    87
    -
    
    88
    -popd
    
    37
    +[% INCLUDE 'build_ac_fenix' %]
    
    89 38
     
    
    90 39
     cd $distdir/
    
    91 40
     [% c('tar', {
    

  • projects/geckoview/build_common
    ... ... @@ -37,6 +37,9 @@ cp -rl $gradle_repo/dl/android/maven2/* $gradle_repo || true
    37 37
     cp -rl $gradle_repo/m2/* $gradle_repo || true
    
    38 38
     cp -rl $gradle_repo/maven2/* $gradle_repo || true
    
    39 39
     
    
    40
    +tar -xf [% c('input_files_by_name/glean-wheels') %]
    
    41
    +export GLEAN_PYTHON_WHEELS_DIR=$rootdir/glean-wheels
    
    42
    +
    
    40 43
     tar -xf [% c('input_files_by_name/oss-licenses-plugin') %]
    
    41 44
     cp -rl oss-licenses-plugin/. $gradle_repo
    
    42 45
     
    

  • projects/geckoview/config
    ... ... @@ -36,7 +36,7 @@ var:
    36 36
         - openjdk-17-jdk-headless
    
    37 37
       # this should be updated when the list of gradle dependencies is changed
    
    38 38
       # see doc/how-to-create-gradle-dependencies-list.txt
    
    39
    -  gradle_dependencies_version: 14
    
    39
    +  gradle_dependencies_version: 15
    
    40 40
       gradle_version: 8.8
    
    41 41
       glean_parser: 14.0.1
    
    42 42
       variant: beta
    
    ... ... @@ -105,6 +105,7 @@ steps:
    105 105
           - name: translation-fenix
    
    106 106
             project: translation
    
    107 107
             pkg_type: fenix
    
    108
    +        enable: '[% c("var/has_l10n") %]'
    
    108 109
           - URL: '[% pc("glean", "var/glean_wheels_url/" _ c("var/glean_parser"), { error_if_undef => 1 }) %]'
    
    109 110
             name: glean-wheels
    
    110 111
             sha256sum: '[% pc("glean", "var/glean_wheels_sha256sum/" _ c("var/glean_parser"), { error_if_undef => 1 }) %]'
    
    ... ... @@ -150,5 +151,18 @@ input_files:
    150 151
       - filename: 'gradle-dependencies-[% c("var/gradle_dependencies_version") %]'
    
    151 152
         name: gradle-dependencies
    
    152 153
         exec: '[% INCLUDE "fetch-gradle-dependencies" %]'
    
    154
    +  - URL: '[% pc("glean", "var/glean_wheels_url/" _ c("var/glean_parser"), { error_if_undef => 1 }) %]'
    
    155
    +    name: glean-wheels
    
    156
    +    sha256sum: '[% pc("glean", "var/glean_wheels_sha256sum/" _ c("var/glean_parser"), { error_if_undef => 1 }) %]'
    
    153 157
       - project: oss-licenses-plugin
    
    154 158
         name: oss-licenses-plugin
    
    159
    +  - name: tor-expert-bundle-aar
    
    160
    +    project: tor-expert-bundle-aar
    
    161
    +    enable: '[% c("var/android_single_arch") %]'
    
    162
    +  - project: firefox-l10n
    
    163
    +    name: firefox-l10n
    
    164
    +    enable: '[% c("var/android_single_arch") && c("var/has_l10n") %]'
    
    165
    +  - name: translation-fenix
    
    166
    +    project: translation
    
    167
    +    pkg_type: fenix
    
    168
    +    enable: '[% c("var/android_single_arch") && c("var/has_l10n") %]'

  • projects/geckoview/gradle-dependencies-list.txt
    ... ... @@ -2907,3 +2907,25 @@ fd64e97234d4c056018ed5ab1e22932bfe5a31b8d80ab9375b6b7b9dfa7ed031 | https://maven
    2907 2907
     9f40ab0b8cf4e7cb0f593493c2ed96e7155d0e91eb592407597ecd61e2d5a054 | https://maven.google.com/androidx/compose/runtime/runtime/1.6.7/runtime-1.6.7.jar
    
    2908 2908
     3018ecf7ef0302f1c2492e4c627ae36b763167779b4595fa89331553f5b0c51a | https://maven.google.com/androidx/compose/material/material-ripple/1.6.7/material-ripple-1.6.7.jar
    
    2909 2909
     4e75469751c9d4c464c7d06af283b9737693c20bc4aaf657630bb294c27bbff1 | https://maven.google.com/androidx/compose/foundation/foundation-layout/1.6.7/foundation-layout-1.6.7.jar
    
    2910
    +74c0e3f8c3df0b1d32ab9d839448c914586d3e8479611e4386fecfa6b3f0a26b | https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp-urlconnection/4.12.0/okhttp-urlconnection-4.12.0.jar
    
    2911
    +a99cf993825e5a2ff12f50973398e7c9fc570055368bdf1026a79efcfb5e6d72 | https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp-urlconnection/4.12.0/okhttp-urlconnection-4.12.0.pom
    
    2912
    +b88186fde75edc3871c5e785c112006dfdd670abba1bb50cdb669fd32291f411 | https://repo1.maven.org/maven2/com/squareup/leakcanary/leakcanary-android-instrumentation/2.14/leakcanary-android-instrumentation-2.14.aar
    
    2913
    +db2f190ebcb2d5d2d5fdb535907df5ab0df0854db49186409ba51c7942441d96 | https://repo1.maven.org/maven2/com/squareup/leakcanary/leakcanary-android-instrumentation/2.14/leakcanary-android-instrumentation-2.14.pom
    
    2914
    +15848fb56db32f4c7cdc72b324003183d52a4884d6bf09be708ac7f587d139b5 | https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-common/2.3.1/lifecycle-common-2.3.1.jar
    
    2915
    +8cd23d889a14095c6ce16840d29b1a6388fa5e115144c1309d4d6d469c1bc351 | https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-common/2.3.1/lifecycle-common-2.3.1.pom
    
    2916
    +67359f609dfc2bf65da1270b23033f856064ec279f058e0a70c715f7c9003031 | https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-livedata/2.6.2/lifecycle-livedata-2.6.2.aar
    
    2917
    +d7c9e019cf68779387481877878f6c499d1786b85f2c0480e9264dd5097c51c0 | https://dl.google.com/dl/android/maven2/androidx/lifecycle/lifecycle-livedata/2.6.2/lifecycle-livedata-2.6.2.pom
    
    2918
    +0157de61a2064047896a058080f3fd67ba57ad9a94857b3f7a363660243e3f90 | https://maven.google.com/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.aar
    
    2919
    +550a6601e1af47cf99501cc6cc15d1ebe9cef17b51e5dd58b6ab6c23568ef7a9 | https://maven.google.com/androidx/annotation/annotation-experimental/1.1.0/annotation-experimental-1.1.0.pom
    
    2920
    +9029262bddce116e6d02be499e4afdba21f24c239087b76b3b57d7e98b490a36 | https://maven.google.com/androidx/annotation/annotation/1.2.0/annotation-1.2.0.jar
    
    2921
    +62fb6dca2777efe08e7077d6b872d69110619df7fc21c99a6f54066499cc0383 | https://maven.google.com/androidx/annotation/annotation/1.2.0/annotation-1.2.0.pom
    
    2922
    +4867fd5279742fba8388821930cb2affe06d81a52814e7e41e70392ea0ef887c | https://maven.google.com/androidx/lifecycle/lifecycle-runtime/2.6.2/lifecycle-runtime-2.6.2.aar
    
    2923
    +8175255546e2a5f510865f84ace680660954730240b1905d9175b4345beda977 | https://maven.google.com/androidx/lifecycle/lifecycle-runtime/2.6.2/lifecycle-runtime-2.6.2.pom
    
    2924
    +7bc7dcbab17636ec076f12afe4d02671265c389457b1b366b37a0e8cb91e2da0 | https://maven.google.com/androidx/lifecycle/lifecycle-viewmodel-savedstate/2.6.2/lifecycle-viewmodel-savedstate-2.6.2.aar
    
    2925
    +7fc854440644cf52c35894d58d946b208e42769e8517d71a5efcba17865432de | https://maven.google.com/androidx/lifecycle/lifecycle-viewmodel-savedstate/2.6.2/lifecycle-viewmodel-savedstate-2.6.2.pom
    
    2926
    +2256780a3cff4a1e57fbb3d442557c17dc363ab8af105bcaf5261d8e2d5db949 | https://maven.google.com/androidx/lifecycle/lifecycle-livedata-core/2.6.2/lifecycle-livedata-core-2.6.2.aar
    
    2927
    +1faf8ebf53f28b2f0ae2c2095371ae67d0ca16ac328fce7f163609a43214b5a4 | https://maven.google.com/androidx/lifecycle/lifecycle-livedata-core/2.6.2/lifecycle-livedata-core-2.6.2.pom
    
    2928
    +e4ff4338999e1c6c9c724719f5d4aa7dd61bf6f545d5256a27a9d375df9f2330 | https://maven.google.com/androidx/lifecycle/lifecycle-viewmodel/2.6.2/lifecycle-viewmodel-2.6.2.aar
    
    2929
    +a9fb0b39a8360beef7bdc8f3953d4d78f3d85304fc80adac3c8eaf530d758050 | https://maven.google.com/androidx/lifecycle/lifecycle-viewmodel/2.6.2/lifecycle-viewmodel-2.6.2.pom
    
    2930
    +f34831b6c71cd844e1d35d1be49d5e79447c5ab856346531b1e8676fda7374b1 | https://maven.google.com/androidx/lifecycle/lifecycle-common/2.6.2/lifecycle-common-2.6.2.jar
    
    2931
    +57304cdac4da289a6ecdd0738e16b1d8858f1ef8e9fabe2d65a963719fd81dba | https://maven.google.com/androidx/lifecycle/lifecycle-common/2.6.2/lifecycle-common-2.6.2.pom

  • projects/tor-expert-bundle-aar/build
    ... ... @@ -7,8 +7,12 @@ mkdir -p /var/tmp/build $distdir
    7 7
     mkdir tor-expert-bundle-aar
    
    8 8
     cd tor-expert-bundle-aar
    
    9 9
     
    
    10
    -[% FOREACH arch = ['armv7', 'aarch64', 'x86', 'x86_64'] -%]
    
    11
    -  unzip -o $rootdir/[% c('input_files_by_name/tor-expert-bundle-' _ arch) %]/tor-expert-bundle-[% arch %].aar
    
    10
    +[% IF c("var/android_single_arch") -%]
    
    11
    +  unzip -o $rootdir/[% c('input_files_by_name/tor-expert-bundle') %]/tor-expert-bundle-[% c("arch") %].aar
    
    12
    +[% ELSE -%]
    
    13
    +  [% FOREACH arch = ['armv7', 'aarch64', 'x86', 'x86_64'] -%]
    
    14
    +    unzip -o $rootdir/[% c('input_files_by_name/tor-expert-bundle-' _ arch) %]/tor-expert-bundle-[% arch %].aar
    
    15
    +  [% END -%]
    
    12 16
     [% END -%]
    
    13 17
     
    
    14
    -jar -cvf $distdir/tor-expert-bundle.aar *
    \ No newline at end of file
    18
    +jar -cvf $distdir/tor-expert-bundle.aar *

  • projects/tor-expert-bundle-aar/config
    ... ... @@ -12,15 +12,22 @@ input_files:
    12 12
         name: tor-expert-bundle-armv7
    
    13 13
         target_replace:
    
    14 14
           '^torbrowser-(?!testbuild).*': 'torbrowser-android-armv7'
    
    15
    +    enable: '[% !c("var/android_single_arch") %]'
    
    15 16
       - project: tor-expert-bundle
    
    16 17
         name: tor-expert-bundle-aarch64
    
    17 18
         target_replace:
    
    18 19
           '^torbrowser-(?!testbuild).*': 'torbrowser-android-aarch64'
    
    20
    +    enable: '[% !c("var/android_single_arch") %]'
    
    19 21
       - project: tor-expert-bundle
    
    20 22
         name: tor-expert-bundle-x86
    
    21 23
         target_replace:
    
    22 24
           '^torbrowser-(?!testbuild).*': 'torbrowser-android-x86'
    
    25
    +    enable: '[% !c("var/android_single_arch") %]'
    
    23 26
       - project: tor-expert-bundle
    
    24 27
         name: tor-expert-bundle-x86_64
    
    25 28
         target_replace:
    
    26 29
           '^torbrowser-(?!testbuild).*': 'torbrowser-android-x86_64'
    
    30
    +    enable: '[% !c("var/android_single_arch") %]'
    
    31
    +  - project: tor-expert-bundle
    
    32
    +    name: tor-expert-bundle
    
    33
    +    enable: '[% c("var/android_single_arch") %]'

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits