<commit_before>import fs from 'fs-extra';
import path from 'path';

import { ANDROID_DIR } from '../Constants';
import { androidAppVersionAsync } from '../ProjectVersions';
import { spawnAsync } from '../Utils';
import { ClientBuilder, ClientBuildFlavor, Platform, S3Client } from './types';

export default class AndroidClientBuilder implements ClientBuilder {
  platform: Platform = 'android';

  getAppPath(): string {
    return path.join(ANDROID_DIR, 'app', 'build', 'outputs', 'apk', 'release', 'app-release.apk');
  }

  getClientUrl(appVersion: string): string {
    return `https://d1ahtucjixef4r.cloudfront.net/Exponent-${appVersion}.apk`;
  }

  async getAppVersionAsync(): Promise<string> {
    return androidAppVersionAsync();
  }

  async buildAsync(flavor: ClientBuildFlavor = ClientBuildFlavor.VERSIONED) {
    await spawnAsync('fastlane', ['android', 'build', 'build_type:Release', `flavor:${flavor}`], {
      stdio: 'inherit',
    });
  }

  async uploadBuildAsync(s3Client: S3Client, appVersion: string) {
    const file = fs.createReadStream(this.getAppPath());

    await s3Client
      .putObject({
        Bucket: 'exp-android-apks',
        Key: `Exponent-${appVersion}.apk`,
        Body: file,
        ACL: 'public-read',
      })
      .promise();
  }
}
<commit_msg>[tools] Workaround - use versioned path in AndroidClientBuilder.getAppPath<commit_after>import fs from 'fs-extra';
import path from 'path';

import { ANDROID_DIR } from '../Constants';
import { androidAppVersionAsync } from '../ProjectVersions';
import { spawnAsync } from '../Utils';
import { ClientBuilder, ClientBuildFlavor, Platform, S3Client } from './types';

export default class AndroidClientBuilder implements ClientBuilder {
  platform: Platform = 'android';

  getAppPath(): string {
    return path.join(
      ANDROID_DIR,
      'app',
      'build',
      'outputs',
      'apk',
      'versioned',
      'release',
      'app-versioned-release.apk'
    );
  }

  getClientUrl(appVersion: string): string {
    return `https://d1ahtucjixef4r.cloudfront.net/Exponent-${appVersion}.apk`;
  }

  async getAppVersionAsync(): Promise<string> {
    return androidAppVersionAsync();
  }

  async buildAsync(flavor: ClientBuildFlavor = ClientBuildFlavor.VERSIONED) {
    await spawnAsync('fastlane', ['android', 'build', 'build_type:Release', `flavor:${flavor}`], {
      stdio: 'inherit',
    });
  }

  async uploadBuildAsync(s3Client: S3Client, appVersion: string) {
    const file = fs.createReadStream(this.getAppPath());

    await s3Client
      .putObject({
        Bucket: 'exp-android-apks',
        Key: `Exponent-${appVersion}.apk`,
        Body: file,
        ACL: 'public-read',
      })
      .promise();
  }
}

{'fraction_non_alphanumeric': 0.14526779163609685, 'fraction_numerical': 0.004402054292002935, 'mean_word_length': 3.65358361774744, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '4324506', 'n_tokens_mistral': 860, 'n_tokens_neox': 840, 'n_words': 184}