public override bool Execute() { Log.LogDebugMessage("Assemblies: {0}", Assemblies.Length); Log.LogDebugMessage("SupportedAbis: {0}", SupportedAbis); Log.LogDebugMessage("AutoDeps: {0}", AutoDeps); NdkUtil.Init(AndroidNdkDirectory); try { if (String.IsNullOrEmpty(AndroidNdkDirectory)) { Log.LogCodedError("XA5101", "Could not locate Android NDK. Please make sure to configure path to NDK in SDK Locations or set via /p:AndroidNdkDirectory in the MSBuild/xbuild argument."); return(false); } return(DoExecute()); } catch (XamarinAndroidException e) { Log.LogCodedError(string.Format("XA{0:0000}", e.Code), e.MessageWithoutCode); if (MonoAndroidHelper.LogInternalExceptions) { Log.LogMessage(e.ToString()); } } catch (Exception ex) { Log.LogErrorFromException(ex); } return(!Log.HasLoggedErrors); }
public override bool RunTask() { if (EnableLLVM && !NdkUtil.Init(LogCodedError, AndroidNdkDirectory)) { return(false); } return(base.RunTask()); }
public override bool RunTask() { // NdkUtil must always be initialized - once per thread if (!NdkUtil.Init(LogCodedError, AndroidNdkDirectory)) { return(false); } return(base.RunTask()); }
public async override System.Threading.Tasks.Task RunTaskAsync() { // NdkUtil must always be initialized - once per thread if (!NdkUtil.Init(LogCodedError, AndroidNdkDirectory)) { LogDebugMessage("Failed to initialize NdkUtil"); return; } bool hasValidAotMode = GetAndroidAotMode(AndroidAotMode, out AotMode); if (!hasValidAotMode) { LogCodedError("XA3002", Properties.Resources.XA3002, AndroidAotMode); return; } if (AotMode == AotMode.Interp) { LogDebugMessage("Interpreter AOT mode enabled"); return; } TryGetSequencePointsMode(AndroidSequencePointsMode, out sequencePointsMode); var nativeLibs = new List <string> (); await this.WhenAllWithLock(GetAotConfigs(), (config, lockObject) => { if (!config.Valid) { Cancel(); return; } if (!RunAotCompiler(config.AssembliesPath, config.AotCompiler, config.AotOptions, config.AssemblyPath, config.ResponseFile)) { LogCodedError("XA3001", Properties.Resources.XA3001, Path.GetFileName(config.AssemblyPath)); Cancel(); return; } File.Delete(config.ResponseFile); lock (lockObject) nativeLibs.Add(config.OutputFile); } ); NativeLibrariesReferences = nativeLibs.ToArray(); LogDebugMessage("Aot Outputs:"); LogDebugTaskItems(" NativeLibrariesReferences: ", NativeLibrariesReferences); }
public override bool Execute() { NdkUtil.Init(AndroidNdkDirectory); try { return(DoExecute()); } catch (Exception e) { Log.LogCodedError("XA3001", "{0}", e); return(false); } }
public override bool RunTask() { if (EnableLLVM && !NdkUtil.Init(Log, AndroidNdkDirectory)) { return(false); } try { return(DoExecute()); } catch (Exception e) { Log.LogCodedError("XA3001", "{0}", e); return(false); } }
public override bool RunTask () { if (!NdkUtil.Init (Log, AndroidNdkDirectory)) return false; try { return DoExecute (); } catch (XamarinAndroidException e) { Log.LogCodedError (string.Format ("XA{0:0000}", e.Code), e.MessageWithoutCode); if (MonoAndroidHelper.LogInternalExceptions) Log.LogMessage (e.ToString ()); } catch (Exception ex) { Log.LogErrorFromException (ex); } return !Log.HasLoggedErrors; }
public override bool Execute() { Log.LogDebugMessage("Assemblies: {0}", Assemblies.Length); Log.LogDebugMessage("SupportedAbis: {0}", SupportedAbis); Log.LogDebugMessage("AutoDeps: {0}", AutoDeps); if (!NdkUtil.Init(Log, AndroidNdkDirectory)) { return(false); } try { return(DoExecute()); } catch (XamarinAndroidException e) { Log.LogCodedError(string.Format("XA{0:0000}", e.Code), e.MessageWithoutCode); if (MonoAndroidHelper.LogInternalExceptions) { Log.LogMessage(e.ToString()); } } catch (Exception ex) { Log.LogErrorFromException(ex); } return(!Log.HasLoggedErrors); }
private void AddNativeLibraries(ArchiveFileList files, string [] supportedAbis) { var frameworkLibs = FrameworkNativeLibraries.Select(v => new LibInfo { Path = v.ItemSpec, Link = v.GetMetadata("Link"), Abi = GetNativeLibraryAbi(v), ArchiveFileName = GetArchiveFileName(v) }); AddNativeLibraries(files, supportedAbis, frameworkLibs); var libs = NativeLibraries.Concat(BundleNativeLibraries ?? Enumerable.Empty <ITaskItem> ()) .Where(v => IncludeNativeLibrary(v)) .Select(v => new LibInfo { Path = v.ItemSpec, Link = v.GetMetadata("Link"), Abi = GetNativeLibraryAbi(v), ArchiveFileName = GetArchiveFileName(v) } ); AddNativeLibraries(files, supportedAbis, libs); if (String.IsNullOrWhiteSpace(CheckedBuild)) { return; } string mode = CheckedBuild; string sanitizerName; if (String.Compare("asan", mode, StringComparison.Ordinal) == 0) { sanitizerName = "asan"; } else if (String.Compare("ubsan", mode, StringComparison.Ordinal) == 0) { sanitizerName = "ubsan_standalone"; } else { LogSanitizerWarning($"Unknown checked build mode '{CheckedBuild}'"); return; } if (!IncludeWrapSh) { LogSanitizerError("Checked builds require the wrapper script to be packaged. Please set the `$(AndroidIncludeWrapSh)` MSBuild property to `true` in your project."); return; } if (!libs.Any(info => IsWrapperScript(info.Path, info.Link))) { LogSanitizerError($"Checked builds require the wrapper script to be packaged. Please add `wrap.sh` appropriate for the {CheckedBuild} checker to your project."); return; } NdkUtil.Init(AndroidNdkDirectory); string clangDir = NdkUtil.GetClangDeviceLibraryPath(AndroidNdkDirectory); if (String.IsNullOrEmpty(clangDir)) { LogSanitizerError($"Unable to find the clang compiler directory. Is NDK installed?"); return; } foreach (string abi in supportedAbis) { string clangAbi = MonoAndroidHelper.MapAndroidAbiToClang(abi); if (String.IsNullOrEmpty(clangAbi)) { LogSanitizerError($"Unable to map Android ABI {abi} to clang ABI"); return; } string sanitizerLib = $"libclang_rt.{sanitizerName}-{clangAbi}-android.so"; string sanitizerLibPath = Path.Combine(clangDir, sanitizerLib); if (!File.Exists(sanitizerLibPath)) { LogSanitizerError($"Unable to find sanitizer runtime for the {CheckedBuild} checker at {sanitizerLibPath}"); return; } AddNativeLibrary(files, sanitizerLibPath, abi, sanitizerLib); } }