list_toolchain_updates_checks 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #!/bin/bash
  2. # ndk version
  3. read -d '' p << 'EOF' || true
  4. if (m/^\\s*NDK_VERSION\\s*=\\s*"(.+)"/) {
  5. print $1;
  6. exit;
  7. }
  8. EOF
  9. needed=$(cat python/mozboot/mozboot/android.py | perl -ne "$p")
  10. current='r[% pc("android-toolchain", "var/android_ndk_version") %][% pc("android-toolchain", "var/android_ndk_revision") %]'
  11. check_update_needed ndk_version "$needed" "$current"
  12. # rust
  13. read -d '' p << 'EOF' || true
  14. my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/rust.yml');
  15. foreach my $t (keys %$d) {
  16. if ($d->{$t}{run}{'toolchain-alias'} eq 'linux64-rust-android') {
  17. my $channel;
  18. foreach my $arg (@{$d->{$t}{run}{arguments}}) {
  19. if ($arg eq '--channel') {
  20. $channel = 1;
  21. next;
  22. }
  23. if ($channel) {
  24. print $arg;
  25. exit;
  26. }
  27. }
  28. }
  29. }
  30. EOF
  31. needed=$(perl -MYAML::XS -e "$p")
  32. current='[% pc("rust", "version") %]'
  33. check_update_needed rust "$needed" "$current"
  34. # build_tools
  35. read -d '' p << 'EOF' || true
  36. if (m/build_tools_version\\s*=\\s*"([^"]+)"/) {
  37. print $1;
  38. exit;
  39. }
  40. EOF
  41. needed=$(cat build/moz.configure/android-sdk.configure | perl -ne "$p")
  42. current='[% pc("android-toolchain", "var/version_30") %]'
  43. check_update_needed build_tools "$needed" "$current"
  44. # target_sdk
  45. read -d '' p << 'EOF' || true
  46. if (m/target_sdk_version\\s*=\\s*"(.+)"/) {
  47. print $1;
  48. exit;
  49. }
  50. EOF
  51. needed=$(cat build/moz.configure/android-sdk.configure | perl -ne "$p")
  52. current='[% pc("android-toolchain", "var/android_api_level") %]'
  53. check_update_needed target_sdk "$needed" "$current"
  54. # sdk-tools
  55. read -d '' p << 'EOF' || true
  56. if (m|https://dl\\.google\\.com/android/repository/sdk-tools-.+-([^-]+).zip|) {
  57. print $1;
  58. exit;
  59. }
  60. EOF
  61. needed=$(cat python/mozboot/mozboot/android.py | perl -ne "$p")
  62. current='[% pc("android-toolchain", "var/sdk_tools_version") %]'
  63. check_update_needed sdk-tools "$needed" "$current"
  64. # min-android
  65. read -d '' p << 'EOF' || true
  66. use Path::Tiny;
  67. use Digest::SHA qw(sha256_hex);
  68. my $f;
  69. my $min_indent;
  70. foreach (path('build/moz.configure/android-ndk.configure')->lines_utf8) {
  71. if ($_ eq "def min_android_version(target):\\n") {
  72. $f = $_;
  73. next;
  74. } else {
  75. next unless $f;
  76. }
  77. m/^(\\s*)/;
  78. my $indent = length $1;
  79. $min_indent = $indent unless $min_indent;
  80. last if $indent < $min_indent;
  81. $f .= $_;
  82. }
  83. print substr(sha256_hex($f), 0, 10);
  84. EOF
  85. needed=$(perl -e "$p")
  86. # We can't easily parse the min_android_version function.
  87. # Instead we get a checksum of the function, and manually check it when
  88. # it was updated.
  89. # Current value of min_android_version is:
  90. # 21 on aarch64, x86_64
  91. # 16 on other archs
  92. current=303de6de36
  93. check_update_needed min-android "$needed" "$current"
  94. # min_sdk
  95. read -d '' p << 'EOF' || true
  96. if (m/^\\s*MOZ_ANDROID_MIN_SDK_VERSION\\s*=\\s*([^\\s]+)/) {
  97. print $1;
  98. exit;
  99. }
  100. EOF
  101. needed=$(cat mobile/android/confvars.sh | perl -ne "$p")
  102. current=16
  103. check_update_needed min_sdk "$needed" "$current"
  104. # gradle
  105. read -d '' p << 'EOF' || true
  106. if (m|distributionUrl=https\\\\://services.gradle.org/distributions/gradle-(.*)-all.zip|) {
  107. print $1;
  108. exit;
  109. }
  110. EOF
  111. needed=$(cat gradle/wrapper/gradle-wrapper.properties | perl -ne "$p")
  112. current='[% c("var/gradle_version") %]'
  113. check_update_needed gradle "$needed" "$current"
  114. # cbindgen
  115. read -d '' p << 'EOF' || true
  116. if (m/^\\s*cbindgen_min_version\\s*=\\s*Version\\("([^"]+)"\\)/) {
  117. print $1;
  118. exit;
  119. }
  120. EOF
  121. needed=$(cat build/moz.configure/bindgen.configure | perl -ne "$p")
  122. current='[% pc("cbindgen", "version") %]'
  123. check_update_needed cbindgen "$needed" "$current"
  124. # nasm
  125. read -d '' p << 'EOF' || true
  126. if (m/^\\s*MODERN_NASM_VERSION\\s*=\\s*LooseVersion\\("([^"]+)"\\)/) {
  127. print $1;
  128. exit;
  129. }
  130. EOF
  131. needed=$(cat python/mozboot/mozboot/base.py | perl -ne "$p")
  132. current='2.14'
  133. check_update_needed nasm "$needed" "$current"
  134. # clang
  135. read -d '' p << 'EOF' || true
  136. my $d = YAML::XS::LoadFile('taskcluster/ci/toolchain/clang.yml');
  137. my $clang_toolchain;
  138. foreach my $t (keys %$d) {
  139. if ($d->{$t}{run}{'toolchain-alias'} eq 'linux64-clang-android-cross') {
  140. foreach my $fetch (@{$d->{$t}{fetches}{fetch}}) {
  141. $clang_toolchain = $fetch if $fetch =~ m/^clang-.*/;
  142. }
  143. last;
  144. }
  145. }
  146. if (!$clang_toolchain) {
  147. print STDERR "Error: could not find clang toolchain";
  148. exit 1;
  149. }
  150. my $fetch = YAML::XS::LoadFile('taskcluster/ci/fetch/toolchains.yml');
  151. print $fetch->{$clang_toolchain}{fetch}{revision};
  152. EOF
  153. needed=$(perl -MYAML::XS -e "$p")
  154. current='[% pc("llvm-project", "git_hash") %]'
  155. check_update_needed clang "$needed" "$current"
  156. # node
  157. read -d '' p << 'EOF' || true
  158. if (m/^\\s*NODE_MIN_VERSION\\s*=\\s*StrictVersion\\("([^"]+)"\\)/) {
  159. print $1;
  160. exit;
  161. }
  162. EOF
  163. needed=$(cat python/mozbuild/mozbuild/nodeutil.py | perl -ne "$p")
  164. current='[% pc("node", "version") %]'
  165. check_update_needed node "$needed" "$current"
  166. # python
  167. read -d '' p << 'EOF' || true
  168. if (m/find_python3_executable\\(min_version\\s*=\\s*"([^"]+)"/) {
  169. print $1;
  170. exit;
  171. }
  172. EOF
  173. needed=$(cat build/moz.configure/init.configure | perl -ne "$p")
  174. current=3.6.0
  175. check_update_needed python "$needed" "$current"