<commit_before>#!/bin/bash

set -e

function script_location() {
  local script_location="${BASH_SOURCE[0]}"
  # Resolve symlinks
  while [[ -h "$script_location" ]]; do
    DIR="$(cd -P "$(dirname "$script_location")" >/dev/null && pwd)"
    script_location="$(readlink "$script_location")"
    [[ "$script_location" != /* ]] && script_location="$DIR/$script_location"
  done
  echo "$(cd -P "$(dirname "$script_location")" >/dev/null && pwd)"
}

# So that users can run this script locally from any directory and it will work as
# expected.
SCRIPT_LOCATION="$(script_location)"
FLUTTER_ROOT="$(dirname "$(dirname "$SCRIPT_LOCATION")")"

export PATH="$FLUTTER_ROOT/bin:$FLUTTER_ROOT/bin/cache/dart-sdk/bin:$PATH"

set -x

cd "$FLUTTER_ROOT"

version="$(<version)"
if [[ "$OS" == "linux" ]]; then
  echo "Building Flutter Gallery $version for Android..."
  # ANDROID_SDK_ROOT must be set in the env.
  (
    cd examples/flutter_gallery
    flutter build apk --release -t lib/main_publish.dart
  )
  echo "Android Flutter Gallery built"
  if [[ -z "$CIRRUS_PR" && "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then
    echo "Deploying Flutter Gallery $version to Play Store..."
    set +x # Don't echo back the below.
    if [ -n "$ANDROID_GALLERY_UPLOAD_KEY" ]; then
      echo "$ANDROID_GALLERY_UPLOAD_KEY" | base64 --decode > /root/.android/debug.keystore
    fi
    set -x
    (
      cd examples/flutter_gallery/android
      fastlane deploy_play_store
    )
  else
    echo "(Not deploying; Flutter Gallery is only deployed to Play store for tagged dev branch commits.)"
  fi
elif [[ "$OS" == "darwin" ]]; then
  echo "Building Flutter Gallery $version for iOS..."
  (
    cd examples/flutter_gallery
    flutter build ios --release --no-codesign -t lib/main_publish.dart

    # flutter build ios will run CocoaPods script. Check generated locations.
    if [[ ! -d "ios/Pods" ]]; then
      echo "Error: pod install failed to setup plugins"
      exit 1
    fi

    if [[ ! -d "ios/.symlinks/plugins" ]]; then
      echo "Error: pod install failed to setup plugin symlinks"
      exit 1
    fi

    if [[ -d "ios/.symlinks/flutter" ]]; then
      echo "Error: pod install created flutter symlink"
      exit 1
    fi

    if [[ ! -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets" ]]; then
      echo "Error: flutter_assets not assembled"
      exit 1
    fi

    if [[
      -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/isolate_snapshot_data" ||
      -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin" ||
      -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/vm_snapshot_data"
     ]]; then
      echo "Error: compiled debug version of app with --release flag"
      exit 1
    fi
  )
  echo "iOS Flutter Gallery built"
  if [[ -z "$CIRRUS_PR" ]]; then
    if [[ "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then
      echo "Archiving with distribution profile and deploying to TestFlight..."
      (
        cd examples/flutter_gallery/ios
        export DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS="-t DAV"
        fastlane build_and_deploy_testflight upload:true
      )
    else
      # On iOS the signing can break as well, so we verify this regularly (not just
      # on tagged dev branch commits). We can only do this post-merge, though, because
      # the secrets aren't available on PRs.
      echo "Testing archiving with distribution profile..."
      (
        cd examples/flutter_gallery/ios
        fastlane build_and_deploy_testflight
      )
      echo "(Not deploying; Flutter Gallery is only deployed to TestFlight for tagged dev branch commits.)"
    fi
  else
    echo "(Not archiving or deploying; Flutter Gallery archiving is only tested post-commit.)"
  fi
else
  echo "Unknown OS: $OS"
  echo "Aborted."
  exit 1
fi<commit_msg>comment out fastlane test archiving (#43207)<commit_after>#!/bin/bash

set -e

function script_location() {
  local script_location="${BASH_SOURCE[0]}"
  # Resolve symlinks
  while [[ -h "$script_location" ]]; do
    DIR="$(cd -P "$(dirname "$script_location")" >/dev/null && pwd)"
    script_location="$(readlink "$script_location")"
    [[ "$script_location" != /* ]] && script_location="$DIR/$script_location"
  done
  echo "$(cd -P "$(dirname "$script_location")" >/dev/null && pwd)"
}

# So that users can run this script locally from any directory and it will work as
# expected.
SCRIPT_LOCATION="$(script_location)"
FLUTTER_ROOT="$(dirname "$(dirname "$SCRIPT_LOCATION")")"

export PATH="$FLUTTER_ROOT/bin:$FLUTTER_ROOT/bin/cache/dart-sdk/bin:$PATH"

set -x

cd "$FLUTTER_ROOT"

version="$(<version)"
if [[ "$OS" == "linux" ]]; then
  echo "Building Flutter Gallery $version for Android..."
  # ANDROID_SDK_ROOT must be set in the env.
  (
    cd examples/flutter_gallery
    flutter build apk --release -t lib/main_publish.dart
  )
  echo "Android Flutter Gallery built"
  if [[ -z "$CIRRUS_PR" && "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then
    echo "Deploying Flutter Gallery $version to Play Store..."
    set +x # Don't echo back the below.
    if [ -n "$ANDROID_GALLERY_UPLOAD_KEY" ]; then
      echo "$ANDROID_GALLERY_UPLOAD_KEY" | base64 --decode > /root/.android/debug.keystore
    fi
    set -x
    (
      cd examples/flutter_gallery/android
      fastlane deploy_play_store
    )
  else
    echo "(Not deploying; Flutter Gallery is only deployed to Play store for tagged dev branch commits.)"
  fi
elif [[ "$OS" == "darwin" ]]; then
  echo "Building Flutter Gallery $version for iOS..."
  (
    cd examples/flutter_gallery
    flutter build ios --release --no-codesign -t lib/main_publish.dart

    # flutter build ios will run CocoaPods script. Check generated locations.
    if [[ ! -d "ios/Pods" ]]; then
      echo "Error: pod install failed to setup plugins"
      exit 1
    fi

    if [[ ! -d "ios/.symlinks/plugins" ]]; then
      echo "Error: pod install failed to setup plugin symlinks"
      exit 1
    fi

    if [[ -d "ios/.symlinks/flutter" ]]; then
      echo "Error: pod install created flutter symlink"
      exit 1
    fi

    if [[ ! -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets" ]]; then
      echo "Error: flutter_assets not assembled"
      exit 1
    fi

    if [[
      -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/isolate_snapshot_data" ||
      -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/kernel_blob.bin" ||
      -d "build/ios/iphoneos/Runner.app/Frameworks/App.framework/flutter_assets/vm_snapshot_data"
     ]]; then
      echo "Error: compiled debug version of app with --release flag"
      exit 1
    fi
  )
  echo "iOS Flutter Gallery built"
  if [[ -z "$CIRRUS_PR" ]]; then
    if [[ "$CIRRUS_BRANCH" == "dev" && "$version" != *"pre"* ]]; then
      echo "Archiving with distribution profile and deploying to TestFlight..."
      (
        cd examples/flutter_gallery/ios
        export DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS="-t DAV"
        fastlane build_and_deploy_testflight upload:true
      )
    else
      # On iOS the signing can break as well, so we verify this regularly (not just
      # on tagged dev branch commits). We can only do this post-merge, though, because
      # the secrets aren't available on PRs.
      echo "Testing archiving with distribution profile..."
      (
        cd examples/flutter_gallery/ios
        # TODO(fujino) re-enable after resolving https://github.com/flutter/flutter/issues/43204
        #fastlane build_and_deploy_testflight
      )
      echo "(Not deploying; Flutter Gallery is only deployed to TestFlight for tagged dev branch commits.)"
    fi
  else
    echo "(Not archiving or deploying; Flutter Gallery archiving is only tested post-commit.)"
  fi
else
  echo "Unknown OS: $OS"
  echo "Aborted."
  exit 1
fi
{'fraction_non_alphanumeric': 0.1223410950283197, 'fraction_numerical': 0.003524229074889868, 'mean_word_length': 3.121369294605809, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '209966', 'n_tokens_mistral': 2642, 'n_tokens_neox': 2538, 'n_words': 753}