<commit_before>/**
 * Phresco Commons
 *
 * Copyright (C) 1999-2013 Photon Infotech Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.photon.phresco.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.google.common.collect.Lists;

public class IosSdkUtil {

	private static final String SDK = "-sdk";
	private static final String XCODEBUILD_SHOWSDKS = "xcodebuild -showsdks";
	
	// types to be passed
	public enum MacSdkType { macosx, iphoneos, iphonesimulator };

	public static List<String> getMacSdks(MacSdkType type)  throws IOException {
		List<String> sdks = new ArrayList<String>();
		try {
			Process p=Runtime.getRuntime().exec(XCODEBUILD_SHOWSDKS);
			p.waitFor();
			BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
			// List of sdks
			sdks = new ArrayList<String>();
			String text = "";
			String aux = "";
			while ((aux = reader.readLine()) != null) {
				if (aux.contains(SDK)) {
					String searchableString = aux;
					String keyword = SDK;
					int ind = searchableString.indexOf(keyword);
					String sdk = searchableString.substring(ind + 5);
					if (sdk.contains(type.toString())) {
						  sdks.add(sdk);
					}
				}
				text += aux;
			}
		} catch(Exception e) {
			return sdks;
		}
		return Lists.reverse(sdks);
	}

	public static List<String> getMacSdksVersions(MacSdkType type)  throws IOException {
		List<String> sdks = null;
		try {
			Process p=Runtime.getRuntime().exec(XCODEBUILD_SHOWSDKS);
			p.waitFor();
			BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
			// List of sdks
			sdks = new ArrayList<String>();
			String text = "";
			String aux = "";
			while ((aux = reader.readLine()) != null) {
				if (aux.contains(SDK)) {
					String searchableString = aux;
					String keyword = SDK;
					int ind = searchableString.indexOf(keyword);
					String sdk = searchableString.substring(ind + 5);
					if (sdk.contains(type.toString())) {
						Pattern pattern = Pattern.compile("[0-9]+.[0-9]*|[0-9]+");
						Matcher m = pattern.matcher(sdk);
						while (m.find()) {
						  sdks.add(m.group());
						}
					}
				}
				text += aux;
			}
		} catch(Exception e) {
			return sdks;
		}
		return sdks;
	}
}<commit_msg> artf656264: In Deploy popup higher order version should be displayed for simulator versions-iphone<commit_after>/**
 * Phresco Commons
 *
 * Copyright (C) 1999-2013 Photon Infotech Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.photon.phresco.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class IosSdkUtil {

	private static final String SDK = "-sdk";
	private static final String XCODEBUILD_SHOWSDKS = "xcodebuild -showsdks";
	
	// types to be passed
	public enum MacSdkType { macosx, iphoneos, iphonesimulator };

	public static List<String> getMacSdks(MacSdkType type)  throws IOException {
		List<String> sdks = new ArrayList<String>();
		try {
			Process p=Runtime.getRuntime().exec(XCODEBUILD_SHOWSDKS);
			p.waitFor();
			BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
			// List of sdks
			sdks = new ArrayList<String>();
			String text = "";
			String aux = "";
			while ((aux = reader.readLine()) != null) {
				if (aux.contains(SDK)) {
					String searchableString = aux;
					String keyword = SDK;
					int ind = searchableString.indexOf(keyword);
					String sdk = searchableString.substring(ind + 5);
					if (sdk.contains(type.toString())) {
						  sdks.add(sdk);
					}
				}
				text += aux;
			}
			Collections.reverse(sdks);
		} catch(Exception e) {
			return sdks;
		}
		return sdks;
	}

	public static List<String> getMacSdksVersions(MacSdkType type)  throws IOException {
		List<String> sdks = null;
		try {
			Process p=Runtime.getRuntime().exec(XCODEBUILD_SHOWSDKS);
			p.waitFor();
			BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
			// List of sdks
			sdks = new ArrayList<String>();
			String text = "";
			String aux = "";
			while ((aux = reader.readLine()) != null) {
				if (aux.contains(SDK)) {
					String searchableString = aux;
					String keyword = SDK;
					int ind = searchableString.indexOf(keyword);
					String sdk = searchableString.substring(ind + 5);
					if (sdk.contains(type.toString())) {
						Pattern pattern = Pattern.compile("[0-9]+.[0-9]*|[0-9]+");
						Matcher m = pattern.matcher(sdk);
						while (m.find()) {
						  sdks.add(m.group());
						}
					}
				}
				text += aux;
			}
			Collections.reverse(sdks);
		} catch(Exception e) {
			return sdks;
		}
		return sdks;
	}
}
{'fraction_non_alphanumeric': 0.12003338898163605, 'fraction_numerical': 0.007679465776293823, 'mean_word_length': 3.4675615212527964, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5007711', 'n_tokens_mistral': 2180, 'n_tokens_neox': 1830, 'n_words': 527}