<commit_before>require 'fastlane'

module Souyuz
  class Runner
    def run
      config = Souyuz.config

      build_app

      if Souyuz.project.ios? or Souyuz.project.osx?
        compress_and_move_dsym
        path = ipa_file

        path
      elsif Souyuz.project.android?
        path = apk_file
        if config[:keystore_path] && config[:keystore_alias]
          apksign_and_zipalign
        end

        path
      end
    end

    def build_app
      command = BuildCommandGenerator.generate
      FastlaneCore::CommandExecutor.execute(command: command,
                                            print_all: true,
                                            print_command: !Souyuz.config[:silent])
    end

    #
    # android build stuff to follow..
    #

    def apk_file
      build_path = Souyuz.project.options[:output_path]
      assembly_name = Souyuz.project.options[:assembly_name]

      Souyuz.cache[:build_apk_path] = "#{build_path}/#{assembly_name}.apk"

      "#{build_path}/#{assembly_name}.apk"
    end

    def apksign_and_zipalign
      UI.success "Start signing process..."

      command = ZipalignCommandGenerator.generate
      FastlaneCore::CommandExecutor.execute(command: command,
                                            print_all: true,
                                            print_command: !Souyuz.config[:silent])

      command = ApkSignCommandGenerator.generate
      FastlaneCore::CommandExecutor.execute(command: command,
                                            print_all: false,
                                            print_command: !Souyuz.config[:silent])

      UI.success "Successfully signed apk #{Souyuz.cache[:build_apk_path]}"
    end

    #
    # ios build stuff to follow..
    #

    def package_path
      build_path = Souyuz.project.options[:output_path]
      assembly_name = Souyuz.project.options[:assembly_name]
<commit_msg>fix build apk path<commit_after>require 'fastlane'

module Souyuz
  class Runner
    def run
      config = Souyuz.config

      build_app

      if Souyuz.project.ios? or Souyuz.project.osx?
        compress_and_move_dsym
        path = ipa_file

        path
      elsif Souyuz.project.android?
        path = apk_file
        if config[:keystore_path] && config[:keystore_alias]
          apksign_and_zipalign
        end

        path
      end
    end

    def build_app
      command = BuildCommandGenerator.generate
      FastlaneCore::CommandExecutor.execute(command: command,
                                            print_all: true,
                                            print_command: !Souyuz.config[:silent])
    end

    #
    # android build stuff to follow..
    #

    def apk_file
      build_path = Souyuz.project.options[:output_path]
      assembly_name = Souyuz.project.options[:assembly_name]

      build_apk_path = "#{build_path}/#{assembly_name}.apk"
      Souyuz.cache[:build_apk_path] = build_apk_path

      build_apk_path
    end

    def apksign_and_zipalign
      UI.success "Start signing process..."

      command = ZipalignCommandGenerator.generate
      FastlaneCore::CommandExecutor.execute(command: command,
                                            print_all: true,
                                            print_command: !Souyuz.config[:silent])

      command = ApkSignCommandGenerator.generate
      FastlaneCore::CommandExecutor.execute(command: command,
                                            print_all: false,
                                            print_command: !Souyuz.config[:silent])

      # move signed apk back to build apk path
      FileUtils.cp_r(
        Souyuz.cache[:signed_apk_path],
        Souyuz.cache[:build_apk_path],
        :remove_destination => true)

      UI.success "Successfully signed apk #{Souyuz.cache[:build_apk_path]}"
    end

    #
    # ios build stuff to follow..
    #

    def package_path
      build_path = Souyuz.project.options[:output_path]
      assembly_name = Souyuz.project.options[:assembly_name]

{'fraction_non_alphanumeric': 0.07755406413124534, 'fraction_numerical': 0.0, 'mean_word_length': 1.8418079096045197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3907804', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1096, 'n_words': 210}