Beispiel #1
0
        async Task <bool> ExecuteOSSpecific(Context context, NuGetRunner nuget)
        {
            Log.StatusLine();
            var make = new MakeRunner(context)
            {
                NoParallelJobs = true
            };

            bool result = await make.Run(
                logTag : "xamarin-android-tools",
                workingDirectory : Path.Combine(Configurables.Paths.ExternalDir, "xamarin-android-tools"),
                arguments : new List <string> {
                "prepare",
                $"CONFIGURATION={context.Configuration}",
            }
                );

            if (!result)
            {
                return(false);
            }

            string javaInteropDir = context.Properties.GetRequiredValue(KnownProperties.JavaInteropFullPath);

            Log.StatusLine();
            result = await make.Run(
                logTag : "java-interop-prepare",
                workingDirectory : javaInteropDir,
                arguments : new List <string> {
                "prepare",
                $"CONFIGURATION={context.Configuration}",
                $"JAVA_HOME={context.OS.JavaHome}",
                $"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}",
            }
                );

            if (!result)
            {
                return(false);
            }

            Log.StatusLine();
            result = await make.Run(
                logTag : "java-interop-props",
                workingDirectory : javaInteropDir,
                arguments : new List <string> {
                $"bin/Build{context.Configuration}/JdkInfo.props",
                $"CONFIGURATION={context.Configuration}",
                $"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}",
            }
                );

            return(result);
        }
Beispiel #2
0
        async Task <bool> ExecuteOSSpecific(Context context)
        {
            Log.StatusLine();
            var make = new MakeRunner(context)
            {
                NoParallelJobs = true
            };

            return(await make.Run(
                       logTag : "xamarin-android-tools",
                       workingDirectory : Path.Combine(Configurables.Paths.ExternalDir, "xamarin-android-tools"),
                       arguments : new List <string> {
                "prepare",
                $"CONFIGURATION={context.Configuration}",
            }
                       ));
        }
        async Task <bool> ExecuteOSSpecific(Context context)
        {
            string javaInteropDir = context.Properties.GetRequiredValue(KnownProperties.JavaInteropFullPath);
            var    dotnetPath     = context.Properties.GetRequiredValue(KnownProperties.DotNetPreviewPath);
            var    dotnetTool     = Path.Combine(dotnetPath, "dotnet");

            Log.StatusLine();
            var make = new MakeRunner(context)
            {
                NoParallelJobs = true
            };
            var result = await make.Run(
                logTag : "java-interop-prepare",
                workingDirectory : javaInteropDir,
                arguments : new List <string> {
                "prepare",
                "V=1",
                $"CONFIGURATION={context.Configuration}",
                $"JI_JAVA_HOME={context.OS.JavaHome}",
                $"JAVA_HOME={context.OS.JavaHome}",
                $"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}",
                $"DOTNET_TOOL_PATH={dotnetTool}"
            }
                );

            if (!result)
            {
                return(false);
            }

            Log.StatusLine();
            result = await make.Run(
                logTag : "java-interop-props",
                workingDirectory : javaInteropDir,
                arguments : new List <string> {
                $"bin/Build{context.Configuration}/JdkInfo.props",
                $"CONFIGURATION={context.Configuration}",
                $"JI_MAX_JDK={Configurables.Defaults.MaxJDKVersion}",
                $"DOTNET_TOOL_PATH={dotnetTool}"
            }
                );

            return(result);
        }
        async Task <bool> BuildRuntimes(Context context, List <string> makeArguments)
        {
            var make = new MakeRunner(context);

            bool result = await make.Run(
                logTag : "mono-runtimes",
                workingDirectory : GetWorkingDirectory(context),
                arguments : makeArguments
                );

            if (!result)
            {
                return(false);
            }

            Utilities.SaveAbiChoice(context);

            return(true);
        }
        List <string> PrepareMakeArguments(Context context, string workingDirectory, List <Runtime> runtimes)
        {
            string toolchainsPrefix = Path.Combine(GetProperty(KnownProperties.AndroidToolchainDirectory), "toolchains");

            var ret = new List <string> {
                "DISABLE_IOS=1",
                "DISABLE_MAC=1",
                $"CONFIGURATION={Configurables.Defaults.MonoSdksConfiguration}",
                "IGNORE_PROVISION_MXE=false",
                "IGNORE_PROVISION_ANDROID=true",
                $"ANDROID_CMAKE_VERSION={GetProperty (KnownProperties.AndroidCmakeVersionPath)}",
                $"ANDROID_NDK_VERSION=r{BuildAndroidPlatforms.AndroidNdkVersion}",
                $"ANDROID_SDK_VERSION_armeabi-v7a={GetMinimumApi (AbiNames.TargetJit.AndroidArmV7a)}",
                $"ANDROID_SDK_VERSION_arm64-v8a={GetMinimumApi (AbiNames.TargetJit.AndroidArmV8a)}",
                $"ANDROID_SDK_VERSION_x86={GetMinimumApi (AbiNames.TargetJit.AndroidX86)}",
                $"ANDROID_SDK_VERSION_x86_64={GetMinimumApi (AbiNames.TargetJit.AndroidX86_64)}",
                $"ANDROID_TOOLCHAIN_DIR={GetProperty (KnownProperties.AndroidToolchainDirectory)}",
                $"ANDROID_TOOLCHAIN_CACHE_DIR={GetProperty (KnownProperties.AndroidToolchainCacheDirectory)}",
                $"ANDROID_TOOLCHAIN_PREFIX={toolchainsPrefix}",
                $"MXE_PREFIX_DIR={GetProperty (KnownProperties.AndroidToolchainDirectory)}",
                $"MXE_SRC={Configurables.Paths.MxeSourceDir}"
            };

            runtimeBuildMakeOptions = new List <string> (ret);
            runtimeBuildMakeTargets = new List <string> ();

            List <string> standardArgs = null;
            var           make         = new MakeRunner(context);

            make.GetStandardArguments(ref standardArgs, workingDirectory);
            if (standardArgs != null && standardArgs.Count > 0)
            {
                runtimeBuildMakeOptions.AddRange(standardArgs);
            }

            AddHostTargets(runtimes.Where(r => r is MonoHostRuntime));
            AddPackageTargets(runtimes.Where(r => r is MonoJitRuntime));
            AddPackageTargets(runtimes.Where(r => r is MonoCrossRuntime));
            ret.Add("package-android-bcl");
            AddTargets("provision-llvm", runtimes.Where(r => r is LlvmRuntime));

            return(ret);

            void AddHostTargets(IEnumerable <Runtime> items)
            {
                AddTargets("package-android-host", items);
            }

            void AddPackageTargets(IEnumerable <Runtime> items)
            {
                AddTargets("package-android", items);
            }

            void AddTargets(string prefix, IEnumerable <Runtime> items)
            {
                foreach (Runtime runtime in items)
                {
                    string target = $"{prefix}-{runtime.Name}";
                    ret.Add(target);
                    runtimeBuildMakeTargets.Add(target);
                }
            }

            string GetProperty(string name)
            {
                return(context.Properties.GetRequiredValue(name));
            }

            string GetMinimumApi(string name)
            {
                return(BuildAndroidPlatforms.NdkMinimumAPI [name].ToString());
            }
        }