<commit_before>/*
 * @(#)XamarinPlatform.groovy
 *
 * Copyright C.T.Co Ltd, 15/25 Jurkalnes Street, Riga LV-1046, Latvia. All rights reserved.
 */

package lv.ctco.scm.mobile.platform.xamarin;

import lv.ctco.scm.mobile.core.objects.Environment
import lv.ctco.scm.mobile.core.utils.LoggerUtil;
import lv.ctco.scm.mobile.core.utils.MultiTargetDetectorUtil
import lv.ctco.scm.mobile.platform.common.CommonTasks;
import lv.ctco.scm.mobile.platform.common.UIAutomationTask;

import org.gradle.api.Project;
import org.gradle.api.Task;

class XamarinPlatform {

    public static final String NAME = "xamarin";

    protected Project project;

    private String releaseVersionIos;
    private String releaseVersionAndroid;

    XamarinPlatform(Project project) {
        this.project = project;
    }

    /**
     * This is platform's entry point.
     *
     * It loads a solution file, performs automatic environment detection if required and then creates all tasks
     * required to build the project.
     *
     * @param extXios XamarinExtension instance from Gradle project.
     * @param extXand XandroidExtension instance from Gradle project.
     */
    void configure(XamarinExtension extXios, XandroidExtension extXand) {
        if (extXios.solutionFile == null) {
            throw new IOException("solutionFile for ctcoMobile.xamarin extension is not defined")
        }

        if (extXios.solutionFile.exists()) {
            LoggerUtil.info("Loading solution file $extXios.solutionFile")
            SolutionParser sp = new SolutionParser(extXios.solutionFile)
            Solution solution = sp.parse()

            if (!solution.containsProject(extXios.projectName)) {
                throw new IOException("Project "+extXios.projectName+" does not exist in solution "+extXios.solutionFile)<commit_msg>Fix for Xamarin sln auto-detection.<commit_after>/*
 * @(#)XamarinPlatform.groovy
 *
 * Copyright C.T.Co Ltd, 15/25 Jurkalnes Street, Riga LV-1046, Latvia. All rights reserved.
 */

package lv.ctco.scm.mobile.platform.xamarin;

import lv.ctco.scm.mobile.core.objects.Environment;
import lv.ctco.scm.mobile.core.utils.LoggerUtil;
import lv.ctco.scm.mobile.core.utils.MultiTargetDetectorUtil;
import lv.ctco.scm.mobile.platform.common.CommonTasks;
import lv.ctco.scm.mobile.platform.common.UIAutomationTask;

import org.apache.commons.io.FileUtils;

import org.gradle.api.Project;
import org.gradle.api.Task;

class XamarinPlatform {

    public static final String NAME = "xamarin";

    protected Project project;

    private String releaseVersionIos;
    private String releaseVersionAndroid;

    XamarinPlatform(Project project) {
        this.project = project;
    }

    /**
     * This is platform's entry point.
     *
     * It loads a solution file, performs automatic environment detection if required and then creates all tasks
     * required to build the project.
     *
     * @param extXios XamarinExtension instance from Gradle project.
     * @param extXand XandroidExtension instance from Gradle project.
     */
    void configure(XamarinExtension extXios, XandroidExtension extXand) {
        if (extXios.solutionFile == null) {
            if (XamarinUtil.getSlnCount(project.getProjectDir()) == 1) {
                String[] extensions = ["sln"];
                extXios.solutionFile = FileUtils.listFiles(project.projectDir, extensions, false)[0];
            } else {
                throw new IOException("solutionFile for ctcoMobile.xamarin extension is not defined")
            }
        }

        if (extXios.solutionFile.exists()) {
            LoggerUtil.info("Loading solution file $extXios.solutionFile")
            SolutionParser sp = new SolutionParser(extXios.solutionFile)
            Solution solution = sp.parse()

            if (!solution.containsProject(extXios.projectName)) {
                throw new IOException("Project "+extXios.projectName+" does not exist in solution "+extXios.solutionFile)
{'fraction_non_alphanumeric': 0.09283551967709384, 'fraction_numerical': 0.004540867810292634, 'mean_word_length': 3.160545645330535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1465939', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1126, 'n_words': 282}