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

Commits:

4 changed files:

Changes:

  • projects/browser/build.android
    ... ... @@ -4,19 +4,13 @@
    4 4
     
    
    5 5
     tar -xf $rootdir/[% c('input_files_by_name/fenix') %]
    
    6 6
     
    
    7
    -assets_dir=assets
    
    8
    -ext_dir=$assets_dir/extensions
    
    9
    -qa_apk=[% dest_dir %]/[% c('filename') %]/[% c("var/project-name") %]-qa-[% c("var/osname") %]-[% c("version") %].apk
    
    10
    -apk=$rootdir/geckoview/*-[% c("var/abi") %]-*.apk
    
    11
    -
    
    12
    -# tor-browser-build#40920
    
    13
    -sorted_baseline_apk=$(basename $apk .apk)_sorted_baseline.apk
    
    14
    -$rootdir/sort-baseline.py --apk $apk $sorted_baseline_apk
    
    15
    -mv $sorted_baseline_apk $apk
    
    16
    -
    
    17 7
     # Bundle our extension(s).
    
    8
    +#
    
    18 9
     # NoScript will be copied over to the profile folder
    
    19 10
     # as a "regular" browser extension receiving regular AMO updates.
    
    11
    +assets_dir=assets
    
    12
    +ext_dir=$assets_dir/extensions
    
    13
    +
    
    20 14
     noscript_path="$ext_dir/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi"
    
    21 15
     
    
    22 16
     mkdir -p /var/tmp/build/$ext_dir [% dest_dir _ '/' _ c('filename') %]
    
    ... ... @@ -34,43 +28,93 @@ popd
    34 28
     [%IF c("var/tor-browser") -%]
    
    35 29
       tar -xaf "$rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz" tor/pluggable_transports/pt_config.json
    
    36 30
     [% END -%]
    
    37
    -unzip -j "$apk" assets/omni.ja
    
    38
    -mkdir omni
    
    39
    -pushd omni
    
    40
    -unzip ../omni.ja
    
    41
    -[%IF c("var/tor-browser") -%]
    
    42
    -  cp -a ../tor/pluggable_transports/pt_config.json chrome/toolkit/content/global/pt_config.json
    
    43
    -[% END -%]
    
    44
    -[% c('zip', {
    
    31
    +
    
    32
    +# This function generates a signed APK from a given APK file.
    
    33
    +#
    
    34
    +# Arguments:
    
    35
    +#   $1 - The final APK file name.
    
    36
    +#   $2 - The input APK file.
    
    37
    +#   $3 - [Optional] The patch file for the unsigned APK.
    
    38
    +#
    
    39
    +# Steps:
    
    40
    +# 1. Sort the baseline APK.
    
    41
    +# 2. Extract the omni.ja file from the APK and modify its contents.
    
    42
    +# 3. Repack the APK with the modified omni.ja file.
    
    43
    +# 4. Align the APK using zipalign.
    
    44
    +# 5. Sign the APK using apksigner.
    
    45
    +# 6. [Optional] Generate a patch file for the unsigned APK using bsdiff.
    
    46
    +function generate_apk {
    
    47
    +  local final_apk=$1
    
    48
    +  local apk=$2
    
    49
    +
    
    50
    +  # tor-browser-build#40920
    
    51
    +  sorted_baseline_apk=$(basename $apk .apk)_sorted_baseline.apk
    
    52
    +  $rootdir/sort-baseline.py --apk $apk $sorted_baseline_apk
    
    53
    +  mv $sorted_baseline_apk $apk
    
    54
    +
    
    55
    +  unzip -j "$apk" assets/omni.ja
    
    56
    +  mkdir omni
    
    57
    +  pushd omni
    
    58
    +  unzip ../omni.ja
    
    59
    +  [%IF c("var/tor-browser") -%]
    
    60
    +    cp -an ../tor/pluggable_transports/pt_config.json chrome/toolkit/content/global/pt_config.json
    
    61
    +  [% END -%]
    
    62
    +  [% c('zip', {
    
    45 63
             zip_src   => [ '.' ],
    
    46 64
             zip_args  => '-0 ../assets/omni.ja',
    
    47 65
           }) %]
    
    48
    -popd
    
    66
    +  popd
    
    49 67
     
    
    50
    -mkdir apk
    
    51
    -pushd apk
    
    52
    -7zz x "$apk"
    
    53
    -cp -R ../assets ./
    
    54
    -find -type f -exec touch -m -t '[% USE date; date.format(pc("geckoview", "timestamp"), format = "%Y%m%d%H%M") %]' {} \;
    
    55
    -find -type f ! -name resources.arsc -printf '%P\n' | sort > ../files.txt
    
    56
    -7zz a -tzip -mx9 -mtc- -spf ../repacked.apk @../files.txt
    
    57
    -# resources.arsc must not be compressed as per the APK specifications
    
    58
    -7zz a -tzip -mm=Copy -mtc- ../repacked.apk resources.arsc
    
    59
    -popd
    
    68
    +  mkdir apk
    
    69
    +  pushd apk
    
    70
    +  7zz x "$apk"
    
    71
    +  cp -Rn ../assets ./
    
    72
    +  find -type f -exec touch -m -t '[% USE date; date.format(pc("geckoview", "timestamp"), format = "%Y%m%d%H%M") %]' {} \;
    
    73
    +  find -type f ! -name resources.arsc -printf '%P\n' | sort > ../files.txt
    
    74
    +  7zz a -tzip -mx9 -mtc- -spf ../repacked.apk @../files.txt
    
    75
    +  # resources.arsc must not be compressed as per the APK specifications
    
    76
    +  7zz a -tzip -mm=Copy -mtc- ../repacked.apk resources.arsc
    
    77
    +  popd
    
    78
    +
    
    79
    +  aligned_apk=$(basename $apk .apk)_aligned.apk
    
    80
    +  zipalign -vp 4 repacked.apk $aligned_apk
    
    60 81
     
    
    61
    -aligned_apk=$(basename $apk .apk)_aligned.apk
    
    62
    -zipalign -vp 4 repacked.apk $aligned_apk
    
    82
    +  # Sign a QA build. This .apk is not a debug version and doesn't contain a debug
    
    83
    +  # flag in the manifest.
    
    84
    +  apksigner sign --verbose --min-sdk-version [% c("var/android_min_api") %] --ks $rootdir/android-qa.keystore --out $final_apk --in $aligned_apk --ks-key-alias androidqakey --key-pass pass:android --ks-pass pass:android
    
    85
    +
    
    86
    +  local unsign_patch=$3
    
    87
    +  if [ -n "$unsign_patch" ]; then
    
    88
    +    bsdiff $final_apk $aligned_apk $unsign_patch
    
    89
    +  fi
    
    90
    +
    
    91
    +  # Clean up
    
    92
    +  rm -rf omni
    
    93
    +  rm omni.ja
    
    94
    +  rm -rf apk
    
    95
    +  rm repacked.apk
    
    96
    +  rm $aligned_apk
    
    97
    +}
    
    98
    +
    
    99
    +# Generate the QA APK and unsign patch.
    
    100
    +qa_apk=[% dest_dir %]/[% c('filename') %]/[% c("var/project-name") %]-qa-[% c("var/osname") %]-[% c("version") %].apk
    
    101
    +qa_unsign_patch="[% dest_dir %]/[% c('filename') %]/[% c('var/project-name') %]-qa-unsign-[% c('var/osname') %]-[% c('version') %].bspatch"
    
    102
    +apk=$rootdir/geckoview/*-[% c("var/abi") %]-*.apk
    
    103
    +generate_apk $qa_apk $apk $qa_unsign_patch
    
    63 104
     
    
    64
    -# Sign a QA build. This .apk is not a debug version and doesn't contain a debug
    
    65
    -# flag in the manifest.
    
    66
    -apksigner sign --verbose --min-sdk-version [% c("var/android_min_api") %] --ks $rootdir/android-qa.keystore --out $qa_apk --in $aligned_apk --ks-key-alias androidqakey --key-pass pass:android --ks-pass pass:android
    
    105
    +# Generate the non-optimized APK used for testing and its unsign patch.
    
    106
    +noopt_apk=[% dest_dir %]/[% c('filename') %]/[% c("var/project-name") %]-noopt-[% c("var/osname") %]-[% c("version") %].apk
    
    107
    +noopt_final_apk=$rootdir/geckoview/tests/*-[% c("var/abi") %]-*.apk
    
    108
    +generate_apk $noopt_apk $noopt_final_apk
    
    67 109
     
    
    68
    -unsign_patch="[% dest_dir %]/[% c('filename') %]/[% c('var/project-name') %]-qa-unsign-[% c('var/osname') %]-[% c('version') %].bspatch"
    
    69
    -bsdiff $qa_apk $aligned_apk $unsign_patch
    
    110
    +# Copy and sign the Android test APK.
    
    111
    +test_apk=[% dest_dir %]/[% c('filename') %]/[% c("var/project-name") %]-[% c("version") %]-androidTest.apk
    
    112
    +cp $rootdir/geckoview/tests/*-androidTest.apk $test_apk
    
    113
    +apksigner sign --verbose --min-sdk-version [% c("var/android_min_api") %] --ks $rootdir/android-qa.keystore --out $test_apk --in $test_apk --ks-key-alias androidqakey --key-pass pass:android --ks-pass pass:android
    
    70 114
     
    
    71 115
     [%IF c("var/tor-browser") -%]
    
    72
    -  tor_expert_bundle_src="[% c('input_files_by_name/tor-expert-bundle') %]"
    
    73
    -  # strip off trailing "$buildid.tar.gz"
    
    74
    -  tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
    
    75
    -  cp "$rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz" [% dest_dir %]/[% c('filename') %]/$tor_expert_bundle_dest
    
    116
    +    tor_expert_bundle_src="[% c('input_files_by_name/tor-expert-bundle') %]"
    
    117
    +    # strip off trailing "$buildid.tar.gz"
    
    118
    +    tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
    
    119
    +    cp "$rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz" [% dest_dir %]/[% c('filename') %]/$tor_expert_bundle_dest
    
    76 120
     [% END -%]

  • projects/geckoview/build_ac_fenix
    ... ... @@ -45,12 +45,24 @@ echo 'ext.gleanBuildDate = "0"' >> app/build.gradle
    45 45
     variant='[% c("var/variant") %]'
    
    46 46
     version_name="[% c('var/torbrowser_version') %] ([% c('var/geckoview_version') %])"
    
    47 47
     
    
    48
    +echo "Building $variant Fenix APK"
    
    48 49
     gradle $GRADLE_FLAGS -PversionName="$version_name" "assemble$variant"
    
    49 50
     
    
    50 51
     echo "Build finished, copying the APK(s) to the destination directory $(date)"
    
    51
    -
    
    52 52
     mkdir $distdir/[% project %]
    
    53 53
     cp app/build/outputs/apk/fenix/$variant/*.apk $distdir/[% project %]
    
    54 54
     
    
    55
    +echo "Building non optimized $variant Fenix APK for testing"
    
    56
    +gradle $GRADLE_FLAGS -PversionName="$version_name" -PdisableOptimization "assemble$variant"
    
    57
    +
    
    58
    +echo "Building Fenix instrumentation tests"
    
    59
    +gradle $GRADLE_FLAGS -PversionName="$version_name" -PtestBuildType="$variant" -PdisableOptimization assembleAndroidTest
    
    60
    +
    
    61
    +echo "Test build finished, copying the APKs to the destination directory $(date)"
    
    62
    +
    
    63
    +mkdir $distdir/[% project %]/tests
    
    64
    +cp app/build/outputs/apk/fenix/$variant/*.apk $distdir/[% project %]/tests
    
    65
    +cp app/build/outputs/apk/androidTest/fenix/$variant/*.apk $distdir/[% project %]/tests
    
    66
    +
    
    55 67
     popd
    
    56 68
     

  • 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: 15
    
    39
    +  gradle_dependencies_version: 16
    
    40 40
       gradle_version: 8.8
    
    41 41
       glean_parser: 14.0.1
    
    42 42
       variant: beta
    

  • projects/geckoview/gradle-dependencies-list.txt
    ... ... @@ -2929,3 +2929,44 @@ e4ff4338999e1c6c9c724719f5d4aa7dd61bf6f545d5256a27a9d375df9f2330 | https://maven
    2929 2929
     a9fb0b39a8360beef7bdc8f3953d4d78f3d85304fc80adac3c8eaf530d758050 | https://maven.google.com/androidx/lifecycle/lifecycle-viewmodel/2.6.2/lifecycle-viewmodel-2.6.2.pom
    
    2930 2930
     f34831b6c71cd844e1d35d1be49d5e79447c5ab856346531b1e8676fda7374b1 | https://maven.google.com/androidx/lifecycle/lifecycle-common/2.6.2/lifecycle-common-2.6.2.jar
    
    2931 2931
     57304cdac4da289a6ecdd0738e16b1d8858f1ef8e9fabe2d65a963719fd81dba | https://maven.google.com/androidx/lifecycle/lifecycle-common/2.6.2/lifecycle-common-2.6.2.pom
    
    2932
    +caa72885d1ce7979c1d6c59a8b255c6097b770780d4d4da95d56979a348646cd | https://maven.google.com/androidx/activity/activity-compose/1.7.0/activity-compose-1.7.0.aar
    
    2933
    +85e1fe770ed673ecb8552eaadc23b96d8db0a14a10eaa7789518496e5d99362c | https://maven.google.com/androidx/arch/core/core-testing/2.2.0/core-testing-2.2.0.aar
    
    2934
    +89536d9f0763e268fc9504fffeada04d483b36fe46f8c6eff5ee64642e36539f | https://maven.google.com/androidx/arch/core/core-testing/2.2.0/core-testing-2.2.0.pom
    
    2935
    +9a4a6e4c9ed089619306f21853a82e7ceeefd38fa69534f2b45a931b2ec827ae | https://maven.google.com/androidx/compose/ui/ui-test-manifest/1.6.7/ui-test-manifest-1.6.7.aar
    
    2936
    +dd61a9738e9eea4691bd7ade9e2cb8acb4f0cb73e048d8611edaa118d032235a | https://maven.google.com/androidx/compose/ui/ui-test-manifest/1.6.7/ui-test-manifest-1.6.7.pom
    
    2937
    +ea66d01428a8c8f26a0ee2259a96d7763dd0d3aef5321730790f8e9cfbe28360 | https://maven.google.com/androidx/room/room-testing/2.6.1/room-testing-2.6.1.aar
    
    2938
    +b39a4b9e96b9e5d51b06e4438b182d9ef0f1f91f9338abe1fd0aa45946929968 | https://maven.google.com/androidx/room/room-testing/2.6.1/room-testing-2.6.1.pom
    
    2939
    +9e672028617979dab465678efdd1650b53c929634c399b1f5fef28252483684d | https://maven.google.com/androidx/test/espresso/espresso-core/3.5.0/espresso-core-3.5.0.pom
    
    2940
    +34b0493f4e002f205d961e562add0c0c31bb0acc657e89d89d4b188ac13f242c | https://maven.google.com/androidx/test/espresso/espresso-core/3.5.0/espresso-core-3.5.0.aar
    
    2941
    +109eec25d79146122fcdaea91d27ab6e437ccd1aec54eb8e4ac23b23f4011deb | https://maven.google.com/androidx/test/espresso/espresso-idling-resource/3.5.0/espresso-idling-resource-3.5.0.pom
    
    2942
    +84fb8e2f5eda937771bee28582f5d2cfa61b0e9438d02041ca61b81e3dac3c87 | https://maven.google.com/androidx/test/espresso/espresso-idling-resource/3.5.0/espresso-idling-resource-3.5.0.aar
    
    2943
    +b3c5aabd545b6c260528c8f4e7c98f73628614ea3d5df3a7a44af2136fd8720b | https://maven.google.com/androidx/test/runner/1.5.0/runner-1.5.0.aar
    
    2944
    +909882bb86a8618f307d439ead4545cf74f54d3dc6088c232e1bab4f9a97f6cc | https://maven.google.com/androidx/test/runner/1.5.0/runner-1.5.0.pom
    
    2945
    +914d8c83aa16455d431b5b3af306cef0eb0a0bfd6550d097e39ad475435bf56c | https://maven.google.com/androidx/tracing/tracing-ktx/1.1.0/tracing-ktx-1.1.0.aar
    
    2946
    +2f2ee5c58561d72cabe9207c43669fe92d6c1386f8c1c2624489e6ab367b121e | https://maven.google.com/androidx/tracing/tracing-perfetto-handshake/1.0.0/tracing-perfetto-handshake-1.0.0.jar
    
    2947
    +5b78e2c618fc10b3d14decc01df76158f15954ad746aacf0607766721da081f6 | https://maven.google.com/androidx/tracing/tracing/1.1.0/tracing-1.1.0.aar
    
    2948
    +f1db502b5d539d94dfb6c659deb76872b1e9d8266d7aa4083868a29c33c22917 | https://maven.google.com/androidx/tracing/tracing/1.1.0/tracing-1.1.0.pom
    
    2949
    +38c45cdaf993a7df6697703ca6ee00acbe376d3dade8d44daac3e33f039ca516 | https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotation/2.19.1/error_prone_annotation-2.19.1.jar
    
    2950
    +1faf214c94723ab9fbadfedd9af88ddc325faf669e68eab04688c3afcf59c037 | https://repo1.maven.org/maven2/com/google/guava/guava/28.2-android/guava-28.2-android.jar
    
    2951
    +b29c1c21e52ed6238cd3fed39d880a17ecf2360118604548cea8821be6801e1c | https://repo1.maven.org/maven2/com/jakewharton/android/repackaged/dalvik-dx/9.0.0_r3/dalvik-dx-9.0.0_r3.jar
    
    2952
    +7ed7862122ecff00f9c582a61a83397f549f92f347825eca8bb7ad94aef7e92d | https://repo1.maven.org/maven2/com/linkedin/dexmaker/dexmaker/2.28.3/dexmaker-2.28.3.jar
    
    2953
    +90bb885e3f0a3546e4670ea2b66f291319dff0c6878e8aaead0abf3268934b5a | https://repo1.maven.org/maven2/com/squareup/leakcanary/leakcanary-android-instrumentation/2.14/leakcanary-android-instrumentation-2.14.module
    
    2954
    +a901efac8b81a6f9fe6c970708e353bd4bd1da03b929dfac01a7617b2d4fea31 | https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp-urlconnection/4.12.0/okhttp-urlconnection-4.12.0.module
    
    2955
    +11d134b245e9cacc474514d2d66b5b8618f8039a1465cdc55bbc0b34e0008b7a | https://repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar
    
    2956
    +164fe9728cf95a2cdea93e257d0dc3d5e29f29256b3cca900a8e619bc94d5b1f | https://repo1.maven.org/maven2/org/checkerframework/checker-qual/2.5.5/checker-qual-2.5.5.jar
    
    2957
    +eaf537d98e033d0f0451cd1b8cc74e02d7b55ec882da63c88060d806ba89c348 | https://repo1.maven.org/maven2/org/conscrypt/conscrypt-openjdk-uber/2.5.2/conscrypt-openjdk-uber-2.5.2.jar
    
    2958
    +8a835f5176355083668aff0ed6eef5b3eb030e10e89679ed3eeb703fd2d5b900 | https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.9.10/kotlin-reflect-1.9.10.jar
    
    2959
    +1f9b6f110f498bb5796cbe2cdd36a83ae242619c816821db23ed088a30347b4a | https://repo1.maven.org/maven2/org/jsoup/jsoup/1.12.2/jsoup-1.12.2.jar
    
    2960
    +1808ee87e0f718cd6e25f3b75afc17956ac8a3edc48c7e9bab9f19f9a79e3801 | https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar
    
    2961
    +753b7726cdd158bb34cedb94c161e2291896f47832a1e9eda53d970020a8184e | https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar
    
    2962
    +d1c22d6fe5483568c08c8913f34abd2303490c3480ce6c18a2ea31c65e44102a | https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-params/5.8.2/junit-jupiter-params-5.8.2.jar
    
    2963
    +4f5c1cc6432244cd16e36aa0e02b74bce34a81ff95a13d63d50951ec4ce3f4bd | https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter/5.8.2/junit-jupiter-5.8.2.jar
    
    2964
    +d2e015fca7130e79af2f4608dc54415e4b10b592d77333decb4b1a274c185050 | https://repo1.maven.org/maven2/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar
    
    2965
    +0b7d000f8c3e8e5f7d6b819649936e7b9938314e87c8f983805218ea57567e59 | https://repo1.maven.org/maven2/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar
    
    2966
    +28028d70cc27d61442948fcb3d249d9df5b37c47aa0b82490a3d049094ff411f | https://repo1.maven.org/maven2/org/mockito/mockito-core/2.25.0/mockito-core-2.25.0.jar
    
    2967
    +5a841dd993e6fd310f08e62df4bdc3eddd9a25245a87650fac99fbff01607d3e | https://repo1.maven.org/maven2/org/mockito/mockito-core/2.25.0/mockito-core-2.25.0.pom
    
    2968
    +3825feca2a3c176400b063dec7c6b0643e2b5256bbbfd4e0a7c11e0dd0983baa | https://repo1.maven.org/maven2/org/objenesis/objenesis-parent/2.6/objenesis-parent-2.6.pom
    
    2969
    +5e168368fbc250af3c79aa5fef0c3467a2d64e5a7bd74005f25d8399aeb0708d | https://repo1.maven.org/maven2/org/objenesis/objenesis/2.6/objenesis-2.6.jar
    
    2970
    +4c1307909dc62df1bd91f075503f8bdef5ae445e13353f1752af9448bea1d3f1 | https://repo1.maven.org/maven2/org/objenesis/objenesis/2.6/objenesis-2.6.pom
    
    2971
    +58812de60898d976fb81ef3b62da05c6604c18fd4a249f5044282479fc286af2 | https://repo1.maven.org/maven2/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar
    
    2972
    +5be3bd2a9d6cee0ea930fb3a92c4585c87524b2ae7871f381e8f5647736836dc | https://repo1.maven.org/maven2/org/robolectric/nativeruntime-dist-compat/1.0.9/nativeruntime-dist-compat-1.0.9.jar