protected override string GenerateCommandLineCommands() { var cmd = new CommandLineBuilder(); cmd.AppendFileNameIfNotNull(ApiXmlInput); if (OnlyRunXmlAdjuster) { cmd.AppendSwitch("--only-xml-adjuster"); } cmd.AppendSwitchIfNotNull("--xml-adjuster-output=", XmlAdjusterOutput); cmd.AppendSwitchIfNotNull("--codegen-target=", CodegenTarget); cmd.AppendSwitchIfNotNull("--csdir=", OutputDirectory); cmd.AppendSwitchIfNotNull("--enumdir=", EnumDirectory); cmd.AppendSwitchIfNotNull("--enummetadata=", EnumMetadataDirectory); cmd.AppendSwitchIfNotNull("--assembly=", AssemblyName); if (!NoStdlib) { string fxpath = MonoAndroidFrameworkDirectories.Split(';').First(p => new DirectoryInfo(p).GetFiles("mscorlib.dll").Any()); cmd.AppendSwitchIfNotNull("--ref=", Path.Combine(Path.GetFullPath(fxpath), "mscorlib.dll")); } if (ReferencedManagedLibraries != null) { foreach (var lib in ReferencedManagedLibraries) { cmd.AppendSwitchIfNotNull("--ref=", Path.GetFullPath(lib.ItemSpec)); } } if (AnnotationsZipFiles != null) { foreach (var zip in AnnotationsZipFiles) { cmd.AppendSwitchIfNotNull("--annotations=", Path.GetFullPath(zip.ItemSpec)); } } foreach (var tf in transform_files) { cmd.AppendSwitchIfNotNull(string.Format("--{0}=", tf.Item2), tf.Item1); } cmd.AppendSwitchIfNotNull("--api-level=", AndroidApiLevel); cmd.AppendSwitchIfNotNull("--type-map-report=", TypeMappingReportFile); cmd.AppendSwitch("--global"); cmd.AppendSwitch("--public"); if (UseShortFileNames) { cmd.AppendSwitch("--use-short-file-names"); } return(cmd.ToString()); }
protected override string GenerateCommandLineCommands() { var cmd = GetCommandLineBuilder(); string responseFile = Path.Combine(OutputDirectory, "generator.rsp"); Log.LogDebugMessage("[Generator] response file: {0}", responseFile); using (var sw = new StreamWriter(responseFile, append: false, encoding: MonoAndroidHelper.UTF8withoutBOM)) { if (OnlyRunXmlAdjuster) { WriteLine(sw, "--only-xml-adjuster"); } if (!string.IsNullOrEmpty(XmlAdjusterOutput)) { WriteLine(sw, $"--xml-adjuster-output=\"{XmlAdjusterOutput}\""); } if (!string.IsNullOrEmpty(CodegenTarget)) { WriteLine(sw, $"--codegen-target={CodegenTarget}"); } if (!string.IsNullOrEmpty(OutputDirectory)) { WriteLine(sw, $"--csdir=\"{OutputDirectory}\""); } if (!string.IsNullOrEmpty(EnumDirectory)) { WriteLine(sw, $"--enumdir=\"{EnumDirectory}\""); } if (!string.IsNullOrEmpty(EnumMetadataDirectory)) { WriteLine(sw, $"--enummetadata=\"{EnumMetadataDirectory}\""); } if (!string.IsNullOrEmpty(AssemblyName)) { WriteLine(sw, $"--assembly={AssemblyName}"); } if (!NoStdlib) { string fxpath = MonoAndroidFrameworkDirectories.Split(';').First(p => new DirectoryInfo(p).GetFiles("mscorlib.dll").Any()); WriteLine(sw, $"--ref=\"{Path.Combine (Path.GetFullPath (fxpath), "mscorlib.dll")}\""); } if (ReferencedManagedLibraries != null) { foreach (var lib in ReferencedManagedLibraries) { WriteLine(sw, $"--ref=\"{Path.GetFullPath (lib.ItemSpec)}\""); } } if (AnnotationsZipFiles != null) { foreach (var zip in AnnotationsZipFiles) { WriteLine(sw, $"--annotations=\"{Path.GetFullPath (zip.ItemSpec)}\""); } } foreach (var tf in transform_files) { WriteLine(sw, $"\"--{tf.Item2}={tf.Item1}\""); } if (!string.IsNullOrEmpty(AndroidApiLevel)) { WriteLine(sw, $"--api-level={AndroidApiLevel}"); } if (!string.IsNullOrEmpty(TypeMappingReportFile)) { WriteLine(sw, $"--type-map-report=\"{TypeMappingReportFile}\""); } WriteLine(sw, "--global"); WriteLine(sw, "--public"); if (UseShortFileNames) { WriteLine(sw, "--use-short-file-names"); } if (SupportsCSharp8) { var features = new List <string> (); if (EnableInterfaceMembersPreview) { features.Add("interface-constants"); features.Add("default-interface-methods"); } if (string.Equals(Nullable, "enable", StringComparison.OrdinalIgnoreCase)) { features.Add("nullable-reference-types"); } if (features.Any()) { WriteLine(sw, $"--lang-features={string.Join (",", features)}"); } } if (!string.IsNullOrEmpty(JavadocVerbosity)) { WriteLine(sw, $"\"--doc-comment-verbosity={JavadocVerbosity}\""); } if (JavadocXml != null) { foreach (var xml in JavadocXml) { WriteLine(sw, $"\"--with-javadoc-xml={Path.GetFullPath (xml.ItemSpec)}\""); } } } cmd.AppendSwitch(ApiXmlInput); cmd.AppendSwitch($"@{responseFile}"); return(cmd.ToString()); }