<commit_before>package lime.tools.helpers;


import haxe.io.Path;
import lime.project.Platform;
import lime.tools.helpers.PathHelper;
import lime.tools.helpers.ProcessHelper;
import lime.project.Haxelib;
import lime.project.HXProject;
import sys.io.Process;
import sys.FileSystem;


class IOSHelper {


	private static var initialized = false;


	public static function build (project:HXProject, workingDirectory:String, additionalArguments:Array<String> = null):Void {

		initialize (project);

		var platformName = "iphoneos";

		if (project.targetFlags.exists ("simulator")) {

			platformName = "iphonesimulator";

		}

		var configuration = "Release";

		if (project.debug) {

			configuration = "Debug";

		}

		var iphoneVersion = project.environment.get ("IPHONE_VER");
		var commands = [ "build", "-configuration", configuration, "PLATFORM_NAME=" + platformName, "SDKROOT=" + platformName + iphoneVersion ];

		if (project.targetFlags.exists ("simulator")) {

			if (project.targetFlags.exists ("i386")) {

				commands.push ("-arch");
				commands.push ("i386");

			} else {

				commands.push ("-arch");
				commands.push ("x86_64");

			}

		} else if (project.targetFlags.exists ("armv7")) {

			commands.push ("-arch");
			commands.push ("armv7");

		} else if (project.targetFlags.exists ("armv7s")) {

			commands.push ("-arch");
			commands.push ("armv7s");

		} else if (project.targetFlags.exists ("arm64")) {

			commands.push ("-arch");
			commands.push ("arm64");

		}

		commands.push ("-project");
		commands.push (project.app.file + ".xcodeproj");

		if (project.targetFlags.exists("archive")) {
			commands.push ("archive");
			commands.push ("-scheme");
			commands.push (project.app.file);
			commands.push ("-archivePath");
			commands.push (PathHelper.combine("build", PathHelper.combine(configuration + "-" + platformName, project.app.file)));
		}

		if (additionalArguments != null) {

			commands = commands.concat (additionalArguments);

		}

		ProcessHelper.runCommand (workingDirectory, "xcodebuild", commands);

	}<commit_msg>Don't pass 'build' buildaction when running an ios archive<commit_after>package lime.tools.helpers;


import haxe.io.Path;
import lime.project.Platform;
import lime.tools.helpers.PathHelper;
import lime.tools.helpers.ProcessHelper;
import lime.project.Haxelib;
import lime.project.HXProject;
import sys.io.Process;
import sys.FileSystem;


class IOSHelper {


	private static var initialized = false;


	public static function build (project:HXProject, workingDirectory:String, additionalArguments:Array<String> = null):Void {

		initialize (project);

		var commands = getXCodeArgs(project);

		if (project.targetFlags.exists("archive")) {

			var configuration = project.environment.get ("CONFIGURATION");
			var platformName = project.environment.get ("PLATFORM_NAME");

			commands.push ("archive");
			commands.push ("-scheme");
			commands.push (project.app.file);
			commands.push ("-archivePath");
			commands.push (PathHelper.combine("build", PathHelper.combine(configuration + "-" + platformName, project.app.file)));
		}
		else {
			commands.push("build");
		}

		if (additionalArguments != null) {

			commands = commands.concat (additionalArguments);

		}

		ProcessHelper.runCommand (workingDirectory, "xcodebuild", commands);

	}

	private static function getXCodeArgs(project:HXProject):Array<String> {
		var platformName = "iphoneos";

		var iphoneVersion = project.environment.get ("IPHONE_VER");

		if (project.targetFlags.exists ("simulator")) {

			platformName = "iphonesimulator";

		}

		var configuration = "Release";

		if (project.debug) {

			configuration = "Debug";

		}

		project.setenv ("PLATFORM_NAME", platformName);
		project.setenv ("CONFIGURATION", configuration);

		// setting CONFIGURATION and PLATFORM_NAME in project.environment doesn't set them for xcodebuild so also pass via command line
		var commands = [ "-configuration", configuration, "PLATFORM_NAME=" + platformName, "SDKROOT=" + platformName + iphoneVersion ];

		if (project.targetFlags.exists ("simulator")) {

			if (project.targetFlags.exists ("i386")) {

				commands.push ("-arch");
				commands.push ("i386");

			} else {

				commands.push ("-arch");
				commands.push ("x86_64");

			}

		} else if (project.targetFlags.exists ("armv7")) {

			commands.push ("-arch");
			commands.push ("armv7");

		} else if (project.targetFlags.exists ("armv7s")) {

			commands.push ("-arch");
			commands.push ("armv7s");

		} else if (project.targetFlags.exists ("arm64")) {

			commands.push ("-arch");
			commands.push ("arm64");

		}

		commands.push ("-project");
		commands.push (project.app.file + ".xcodeproj");

		return commands;
	}
{'fraction_non_alphanumeric': 0.14807733163373699, 'fraction_numerical': 0.0076481835564053535, 'mean_word_length': 4.260335195530726, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '2739504', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1406, 'n_words': 315}