public void AppendFileNamesIfNotNull(ITaskItem[] fileItems, string delimiter) { ErrorUtilities.VerifyThrowArgumentNull(delimiter, "delimiter"); if ((fileItems != null) && (fileItems.Length > 0)) { for (int i = 0; i < fileItems.Length; i++) { if (fileItems[i] != null) { this.VerifyThrowNoEmbeddedDoubleQuotes(string.Empty, fileItems[i].ItemSpec); } } this.AppendSpaceIfNotEmpty(); for (int j = 0; j < fileItems.Length; j++) { if (j != 0) { this.AppendTextUnquoted(delimiter); } if (fileItems[j] != null) { this.AppendFileNameWithQuoting(fileItems[j].ItemSpec); } } } }
public override bool Execute() { string pdbxmlFile = Path.ChangeExtension(AssemblyName.ItemSpec, ".pdb.xml"); _pddxmlFile = new TaskItem(pdbxmlFile); xwriter = new XmlTextWriter(pdbxmlFile, null); xwriter.Formatting = Formatting.Indented; //Log.LogMessage("Get symbol reader for file {0}", Path.ChangeExtension(AssemblyName.ItemSpec, ".pdb")); ISymbolReader reader = SymUtil.GetSymbolReaderForFile(AssemblyName.ItemSpec, null); //Log.LogMessage("Load assembly"); m_assembly = System.Reflection.Assembly.LoadFrom(AssemblyName.ItemSpec); // Begin writing XML. xwriter.WriteStartDocument(); xwriter.WriteComment("This is an XML file representing the PDB for '" + AssemblyName.ItemSpec + "'"); xwriter.WriteStartElement("Types"); // Record what input file these symbols are for. xwriter.WriteAttributeString("file", AssemblyName.ItemSpec); //WriteDocList(reader); WriteTypesAndDocs(reader); xwriter.WriteEndElement(); // "Symbols"; xwriter.Close(); return !Log.HasLoggedErrors; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="RegFree"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public RegFree() { Dlls = new ITaskItem[0]; Fragments = new ITaskItem[0]; AsIs = new ITaskItem[0]; NoTypeLib = new ITaskItem[0]; }
public override bool Execute() { var inputsGroupedByConfigFile = new Dictionary<string, List<WorkItem>>(); OutputFiles = new ITaskItem[InputFiles.Length]; for (int i = 0; i < InputFiles.Length; i++) { string infileLocal = InputFiles[i].ItemSpec; OutputFiles[i] = new TaskItem(Path.ChangeExtension(infileLocal, ExecutablesCommon.GeneratedFileExtension)); string infile = Path.GetFullPath(infileLocal); string outfile = Path.ChangeExtension(infile, ExecutablesCommon.GeneratedFileExtension); string configFile = ExecutablesCommon.FindConfigFilePath(infile) ?? ""; List<WorkItem> l; if (!inputsGroupedByConfigFile.TryGetValue(configFile, out l)) inputsGroupedByConfigFile[configFile] = l = new List<WorkItem>(); l.Add(new WorkItem() { InFile = infile, OutFile = outfile, Namespace = FindNamespace(InputFiles[i]) }); } bool success = true; foreach (var kvp in inputsGroupedByConfigFile) { ExecutablesCommon.ProcessWorkItemsInSeparateAppDomain(kvp.Key, kvp.Value, (item, ex) => { if (ex is TemplateErrorException) { Log.LogError(null, null, null, item.InFile, 0, 0, 0, 0, ex.Message); success = false; } else { Log.LogErrorFromException(ex, true, true, item.InFile); success = false; } return true; }); } return success; }
public static void CopyMetadataTo(this ITaskItem source, ITaskItem destination, string prefix) { foreach (string key in source.CloneCustomMetadata().Keys.OfType<string>()) { destination.SetMetadata(String.Concat(prefix, key), source.GetMetadata(key)); } }
public UpdateAssemblyInfo() { CompileFiles = new ITaskItem[] { }; logger = new TaskLogger(this); Logger.WriteInfo = this.LogInfo; Logger.WriteWarning = this.LogWarning; }
/// <summary> /// /// </summary> /// <param name="destinationItem"></param> public void CopyMetadataTo(ITaskItem destinationItem) { foreach (string metaKey in metaData.Keys) { destinationItem.SetMetadata(metaKey, metaData[metaKey]); } }
private void CheckIfSourceNeedsCompilation(ConcurrentQueue<ITaskItem> sourcesNeedingCompilationList, bool allOutputFilesExist, ITaskItem source) { if (!this.tlogAvailable || (this.outputFileGroup == null)) { source.SetMetadata("_trackerCompileReason", "Tracking_SourceWillBeCompiledAsNoTrackingLog"); sourcesNeedingCompilationList.Enqueue(source); } else if (!this.useMinimalRebuildOptimization && !allOutputFilesExist) { source.SetMetadata("_trackerCompileReason", "Tracking_SourceOutputsNotAvailable"); sourcesNeedingCompilationList.Enqueue(source); } else if (!this.IsUpToDate(source)) { if (string.IsNullOrEmpty(source.GetMetadata("_trackerCompileReason"))) { source.SetMetadata("_trackerCompileReason", "Tracking_SourceWillBeCompiled"); } sourcesNeedingCompilationList.Enqueue(source); } else if (!this.useMinimalRebuildOptimization && (this.outputNewestTime == DateTime.MinValue)) { source.SetMetadata("_trackerCompileReason", "Tracking_SourceNotInTrackingLog"); sourcesNeedingCompilationList.Enqueue(source); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected override string GenerateCommandLineFromProps (ITaskItem source) { // // Build a command-line based on parsing switches from the registered property sheet, and any additional flags. // try { if (source == null) { throw new ArgumentNullException (); } StringBuilder builder = new StringBuilder (PathUtils.CommandLineLength); builder.Append (m_parsedProperties.Parse (source)); builder.Append (" -c "); // compile the C/C++ file return builder.ToString (); } catch (Exception e) { Log.LogErrorFromException (e, true); } return string.Empty; }
static string GetTarget(ITaskItem x) { var target = x.GetMetadata("TargetPath"); if (Path.GetFileName(x.ItemSpec) == Path.GetFileName(target)) target = Path.GetDirectoryName(target); return target; }
private IEnumerable<ITaskItem> ResolvePackage(ITaskItem package) { string id = package.ItemSpec; string version = package.GetMetadata("Version"); Log.LogMessage(MessageImportance.Normal, "Resolving Package Reference {0} {1}...", id, version); // Initial version just searches a machine-level repository var localFs = new PhysicalFileSystem(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NuGet", "Lib")); var defaultResolver = new DefaultPackagePathResolver(localFs); var machineRepo = new LocalPackageRepository(defaultResolver, localFs); var buildRepo = new BuildPackageRepository(); var remoteRepo = new DataServicePackageRepository(new Uri("https://nuget.org/api/v2")); var project = new BuildProjectSystem(ProjectDirectory, new FrameworkName(TargetFramework), CurrentReferences); var manager = new PackageManager(remoteRepo, defaultResolver, localFs, machineRepo); var projectManager = new ProjectManager(remoteRepo, defaultResolver, project, buildRepo); // Install the package var ver = new SemanticVersion(version); manager.PackageInstalling += manager_PackageInstalling; manager.InstallPackage(id, ver); projectManager.AddPackageReference(id, ver); return project.OutputReferences.Select(item => { var name = AssemblyName.GetAssemblyName(item); return new TaskItem(name.FullName, new Dictionary<string, string>() { {"HintPath", item }, {"Private", "true"} }); }); }
public override bool Execute() { try { string authors; using (var fs = new FileStream (AuthorsFile.GetMetadata ("FullPath"), FileMode.Open)) { using (var sr = new StreamReader (fs)) { var authorsStrBuilder = new StringBuilder (); while (!sr.EndOfStream) { var line = sr.ReadLine ().Trim (); if (!string.IsNullOrWhiteSpace (line)) authorsStrBuilder.Append ("\"" + line + "\", "); } authors = authorsStrBuilder.ToString (); } } Output = new TaskItem (authors); } catch (Exception ex) { Log.LogErrorFromException (ex); return false; } return true; }
public string Parse(ITaskItem taskItem, bool fullOutputName, string outputExtension) { CommandLineBuilder builder = new CommandLineBuilder(); foreach (string name in taskItem.MetadataNames) { string value = taskItem.GetMetadata(name); if (outputExtension != null && name == "OutputFile") { value = Path.ChangeExtension(value, outputExtension); } if (fullOutputName && name == "ObjectFileName") { if ((File.GetAttributes(value) & FileAttributes.Directory) != 0) { value = Path.Combine(value, Path.GetFileName(taskItem.ItemSpec)); value = Path.ChangeExtension(value, ".obj"); } } AppendArgumentForProperty(builder, name, value); } string result = builder.ToString(); result = result.Replace('\\', '/'); // posix paths return result; }
protected ITaskItem ConvertPackageElement(ITaskItem project, PackageReference packageReference) { var id = packageReference.Id; var version = packageReference.Version; var targetFramework = packageReference.TargetFramework; var isDevelopmentDependency = packageReference.IsDevelopmentDependency; var requireReinstallation = packageReference.RequireReinstallation; var versionConstraint = packageReference.VersionConstraint; var item = new TaskItem(id); project.CopyMetadataTo(item); var packageDirectoryPath = GetPackageDirectoryPath(project.GetMetadata("FullPath"), id, version); item.SetMetadata("PackageDirectoryPath", packageDirectoryPath); item.SetMetadata("ProjectPath", project.GetMetadata("FullPath")); item.SetMetadata("IsDevelopmentDependency", isDevelopmentDependency.ToString()); item.SetMetadata("RequireReinstallation", requireReinstallation.ToString()); if (version != null) item.SetMetadata(Metadata.Version, version.ToString()); if (targetFramework != null) item.SetMetadata(Metadata.TargetFramework, targetFramework.GetShortFrameworkName()); if (versionConstraint != null) item.SetMetadata("VersionConstraint", versionConstraint.ToString()); return item; }
static string GetLinkPath (ITaskItem file, string path) { string link = file.GetMetadata ("Link"); if (!string.IsNullOrEmpty (link)) { return link; } string projectDir; var definingProject = file.GetMetadata ("DefiningProjectFullPath"); if (!string.IsNullOrEmpty (definingProject)) { projectDir = Path.GetDirectoryName (definingProject); } else { projectDir = Environment.CurrentDirectory; } projectDir = Path.GetFullPath (projectDir); if (projectDir [projectDir.Length - 1] != Path.DirectorySeparatorChar) { projectDir += Path.DirectorySeparatorChar; } if (path.StartsWith (projectDir, StringComparison.Ordinal)) { link = path.Substring (projectDir.Length); } else { link = Path.GetFileName (path); } return link; }
private bool RemoveDirectory(ITaskItem directory, bool logUnauthorizedError, out bool unauthorizedAccess) { bool flag = true; unauthorizedAccess = false; try { Directory.Delete(directory.ItemSpec, true); } catch (UnauthorizedAccessException exception) { flag = false; if (logUnauthorizedError) { base.Log.LogErrorWithCodeFromResources("RemoveDir.Error", new object[] { directory, exception.Message }); } unauthorizedAccess = true; } catch (Exception exception2) { if (Microsoft.Build.Shared.ExceptionHandling.NotExpectedException(exception2)) { throw; } base.Log.LogErrorWithCodeFromResources("RemoveDir.Error", new object[] { directory.ItemSpec, exception2.Message }); flag = false; } return flag; }
private static ITaskItem[] ExpandWildcards(ITaskItem[] expand) { if (expand == null) { return null; } ArrayList list = new ArrayList(); foreach (ITaskItem item in expand) { if (Microsoft.Build.Shared.FileMatcher.HasWildcards(item.ItemSpec)) { foreach (string str in Microsoft.Build.Shared.FileMatcher.GetFiles(null, item.ItemSpec)) { TaskItem item2 = new TaskItem(item) { ItemSpec = str }; Microsoft.Build.Shared.FileMatcher.Result result = Microsoft.Build.Shared.FileMatcher.FileMatch(item.ItemSpec, str); if ((result.isLegalFileSpec && result.isMatch) && ((result.wildcardDirectoryPart != null) && (result.wildcardDirectoryPart.Length > 0))) { item2.SetMetadata("RecursiveDir", result.wildcardDirectoryPart); } list.Add(item2); } } else { list.Add(item); } } return (ITaskItem[]) list.ToArray(typeof(ITaskItem)); }
// ========================================================================================= // Constructors // ========================================================================================= /// <summary> /// Initializes a new instance of the <see cref="DocCompiler"/> class. /// </summary> public DocCompiler() { this.workingDirectory = null; this.helpCompiler = null; this.helpFile = null; this.tableOfContents = null; }
public override bool Execute() { try { syncEventName = new TaskItem(Guid.NewGuid().ToString()); handle = new EventWaitHandle(false, EventResetMode.ManualReset, syncEventName.ItemSpec); handle.Reset(); threadLock = GetLock(lockName); new Thread(new ThreadStart(AsyncExecute)).Start(); while (m_AsyncThreadState == ThreadState.NOT_STARTED) { Thread.Sleep(500); } return true; } catch (Exception e) { try { Log.LogErrorFromException(e); } catch { } return false; } }
private string ComputeNeutralXlfName(ITaskItem neutralResouce) { var filename = neutralResouce.GetMetadata("Filename"); var xlfRootPath = LocalizationUtils.ComputeXlfRootPath(neutralResouce); return Path.Combine(xlfRootPath, filename + ".xlf"); }
public void Setup() { ccu = new CodeCompileUnit(); mocks = new MockRepository(); engine = Engine.GlobalEngine; engine.BinPath = @"C:\Program Files (x86)\MSBuild"; project = new Project(); buildEngine = mocks.DynamicMock<MockBuildEngine>(project); logger = new NullLogger(); parserService = mocks.DynamicMock<ISiteTreeGeneratorService>(); naming = mocks.DynamicMock<INamingService>(); sourceStorage = mocks.DynamicMock<IParsedSourceStorageService>(); source = mocks.DynamicMock<ISourceGenerator>(); typeResolver = mocks.DynamicMock<ITypeResolver>(); treeService = mocks.DynamicMock<ITreeCreationService>(); viewSourceMapper = mocks.DynamicMock<IViewSourceMapper>(); generator = mocks.DynamicMock<IGenerator>(); task = new GenerateMonoRailSiteTreeTask(logger, parserService, naming, source, sourceStorage, typeResolver, treeService, viewSourceMapper, generator); item = mocks.DynamicMock<ITaskItem>(); parsedSource = mocks.DynamicMock<IParser>(); }
public static string GetVirtualProjectPath(string projectDir, ITaskItem item) { var link = item.GetMetadata ("Link"); // Note: if the Link metadata exists, then it will be the equivalent of the ProjectVirtualPath if (!string.IsNullOrEmpty (link)) { if (Path.DirectorySeparatorChar != '\\') return link.Replace ('\\', '/'); return link; } // HACK: This is for Visual Studio iOS projects if (!Directory.Exists (projectDir)) return item.ItemSpec; var definingProjectFullPath = item.GetMetadata ("DefiningProjectFullPath"); var path = item.GetMetadata ("FullPath"); string baseDir; if (!string.IsNullOrEmpty (definingProjectFullPath)) { baseDir = Path.GetDirectoryName (definingProjectFullPath); } else { baseDir = projectDir; } baseDir = PathUtils.ResolveSymbolicLink (baseDir); path = PathUtils.ResolveSymbolicLink (path); return PathUtils.AbsoluteToRelative (baseDir, path); }
internal string FlattenFilePaths(ITaskItem[] items, char delimeter, bool withQuotes) { var sb = new StringBuilder(); bool haveStarted = false; foreach (var item in items) { if (haveStarted) { sb.Append(delimeter); } string filePath = TrimBaseFromFilePath(item.ItemSpec); if (filePath.Contains(" ") || withQuotes) { sb.Append('"'); sb.Append(filePath); sb.Append('"'); } else { sb.Append(filePath); } haveStarted = true; } return sb.ToString(); }
private bool ProcessFile(ITaskItem item) { var result = true; LogItemInformation(item); try { var itemPath = GetItemPath(item); var resultPath = GetItemOutputPath(itemPath); if (OutputExists(itemPath, resultPath)) { Log.LogMessage("Exists: {0} -> {1}", itemPath, resultPath); return true; } Log.LogMessage("Compiling: {0} -> {1}", itemPath, resultPath); result = DoCompile(itemPath, resultPath); } catch (Exception ex) { result = false; Log.LogError(ex.ToString()); //Log.LogErrorFromException(ex); } return result; }
public ValidationPattern(ITaskItem item, TaskLoggingHelper log) { string idRegex = item.GetMetadata("IdentityRegex"); if (string.IsNullOrEmpty(idRegex)) { // Temporarily support reading the regex from the Include/ItemSpec for backwards compatibility // when the IdentityRegex isn't specified. This can be removed once all consumers are using IdentityRegex. idRegex = item.ItemSpec; } _idPattern = new Regex(idRegex); _expectedVersion = item.GetMetadata("ExpectedVersion"); _expectedPrerelease = item.GetMetadata("ExpectedPrerelease"); _log = log; if (string.IsNullOrWhiteSpace(_expectedVersion)) { if (string.IsNullOrWhiteSpace(_expectedPrerelease)) { _log.LogError( "Can't find ExpectedVersion or ExpectedPrerelease metadata on item {0}", item.ItemSpec); } } else if (!string.IsNullOrWhiteSpace(_expectedPrerelease)) { _log.LogError( "Both ExpectedVersion and ExpectedPrerelease metadata found on item {0}, but only one permitted", item.ItemSpec); } }
public override bool Execute() { var basePath = GetBasePath(); var sourceFileInfos = new List<FileInfo>(); foreach (var sourceFile in SourceFiles) { string path = Path.Combine(basePath.FullName, "T4TS", sourceFile.ItemSpec); sourceFileInfos.Add(new FileInfo(path)); } this.Log.LogMessage("Building template from {0} files:", sourceFileInfos.Count); foreach (var fi in sourceFileInfos) this.Log.LogMessage(" - " + fi.FullName); var t4tsContent = TemplateBuilder.BuildT4TSFromSourceFiles(sourceFileInfos); var outputDir = GetOutputDir(); var t4tsFile = new FileInfo(Path.Combine(outputDir.FullName, "T4TS.tt")); File.WriteAllText(t4tsFile.FullName, t4tsContent); LogFileWrite(t4tsFile); var templateSettingsFile = new FileInfo(Path.Combine(outputDir.FullName, "T4TS.tt.settings.t4")); File.WriteAllText(templateSettingsFile.FullName, Resources.TemplateSettings); LogFileWrite(templateSettingsFile); TemplateOutputFile = new TaskItem(t4tsFile.FullName); return true; }
public BuildProjectSystem(string root, FrameworkName targetFramework, ITaskItem[] currentReferences) : base(root) { _targetFramework = targetFramework; _currentReferences = currentReferences; OutputReferences = new List<string>(); }
internal void AppendSwitchIfNotNull(string switchName, ITaskItem[] parameters, string[] metadataNames, bool[] treatAsFlags) { Microsoft.Build.Shared.ErrorUtilities.VerifyThrow((treatAsFlags == null) || (metadataNames.Length == treatAsFlags.Length), "metadataNames and treatAsFlags should have the same length."); if (parameters != null) { foreach (ITaskItem item in parameters) { base.AppendSwitchIfNotNull(switchName, item.ItemSpec); if (metadataNames != null) { for (int i = 0; i < metadataNames.Length; i++) { string metadata = item.GetMetadata(metadataNames[i]); if ((metadata != null) && (metadata.Length > 0)) { if ((treatAsFlags == null) || !treatAsFlags[i]) { base.CommandLine.Append(','); base.AppendTextWithQuoting(metadata); } else if (MetadataConversionUtilities.TryConvertItemMetadataToBool(item, metadataNames[i])) { base.CommandLine.Append(','); base.AppendTextWithQuoting(metadataNames[i]); } } else if ((treatAsFlags == null) || !treatAsFlags[i]) { break; } } } } } }
public override bool Execute() { string path = System.IO.Path.GetTempFileName(); TempFilePath = new TaskItem(path); return true; }
public static void LogTaskProperty(this TaskLoggingHelper log, string propertyName, ITaskItem item) { if (item != null) log.LogMessage (TaskPropertyImportance, " {0}: {1}", propertyName, item.ItemSpec); else log.LogMessage (TaskPropertyImportance, " {0}: ", propertyName); }
private bool Execute(bool isStatic) { if (SuggestedRedirects == null || SuggestedRedirects.Length == 0) { Log.LogMessageFromResources("GenerateBindingRedirects.NoSuggestedRedirects"); OutputAppConfigFile = null; return(true); } var redirects = ParseSuggestedRedirects(); var doc = LoadAppConfig(AppConfigFile); if (doc == null) { return(false); } XElement runtimeNode = doc.Root .Nodes() .OfType <XElement>() .FirstOrDefault(e => e.Name.LocalName == "runtime"); if (runtimeNode == null) { runtimeNode = new XElement("runtime"); doc.Root.Add(runtimeNode); } else { UpdateExistingBindingRedirects(runtimeNode, redirects); } var ns = XNamespace.Get("urn:schemas-microsoft-com:asm.v1"); var redirectNodes = from redirect in redirects select new XElement( ns + "assemblyBinding", new XElement( ns + "dependentAssembly", new XElement( ns + "assemblyIdentity", new XAttribute("name", redirect.Key.Name), new XAttribute("publicKeyToken", ResolveAssemblyReference.ByteArrayToString(redirect.Key.GetPublicKeyToken())), new XAttribute("culture", String.IsNullOrEmpty(redirect.Key.CultureName) ? "neutral" : redirect.Key.CultureName)), new XElement( ns + "bindingRedirect", new XAttribute("oldVersion", "0.0.0.0-" + redirect.Value), new XAttribute("newVersion", redirect.Value)))); runtimeNode.Add(redirectNodes); var writeOutput = true; if (FileSystems.Default.FileExists(OutputAppConfigFile.ItemSpec)) { try { var outputDoc = LoadAppConfig(OutputAppConfigFile); if (outputDoc.ToString() == doc.ToString()) { writeOutput = false; } } catch (System.Xml.XmlException) { writeOutput = true; } } if (AppConfigFile != null) { AppConfigFile.CopyMetadataTo(OutputAppConfigFile); } else { OutputAppConfigFile.SetMetadata(ItemMetadataNames.targetPath, TargetName); } if (!isStatic && writeOutput) { using (var stream = FileUtilities.OpenWrite(OutputAppConfigFile.ItemSpec, false)) { doc.Save(stream); } } return(!Log.HasLoggedErrors); }
/// <summary> /// Async version of BuildProjectFilesInParallel. /// </summary> /// <param name="projectFileNames">The list of projects to build</param> /// <param name="targetNames">The set of targets to build</param> /// <param name="globalProperties">The global properties to use for each project</param> /// <param name="undefineProperties">The list of global properties to undefine</param> /// <param name="toolsVersion">The tools versions to use</param> /// <param name="returnTargetOutputs">Should the target outputs be returned in teh BuildEngineResult</param> /// <param name="skipNonexistentTargets">If set, skip targets that are not defined in the projects to be built.</param> /// <returns>A Task returning a structure containing the result of the build, success or failure and the list of target outputs per project</returns> private async Task <BuildEngineResult> BuildProjectFilesInParallelAsync(string[] projectFileNames, string[] targetNames, IDictionary[] globalProperties, IList <String>[] undefineProperties, string[] toolsVersion, bool returnTargetOutputs, bool skipNonexistentTargets = false) { ErrorUtilities.VerifyThrowArgumentNull(projectFileNames, "projectFileNames"); ErrorUtilities.VerifyThrowArgumentNull(globalProperties, "globalProperties"); VerifyActiveProxy(); List <IDictionary <string, ITaskItem[]> > targetOutputsPerProject = null; #if FEATURE_FILE_TRACKER using (FullTracking.Suspend()) #endif { bool overallSuccess = true; if (projectFileNames.Length == 1 && projectFileNames[0] == null && globalProperties[0] == null && (undefineProperties == null || undefineProperties[0] == null) && toolsVersion[0] == null) { // This is really a legacy CallTarget invocation ITargetResult[] results = await _targetBuilderCallback.LegacyCallTarget(targetNames, ContinueOnError, _taskLocation); if (returnTargetOutputs) { targetOutputsPerProject = new List <IDictionary <string, ITaskItem[]> >(1) { new Dictionary <string, ITaskItem[]>(StringComparer.OrdinalIgnoreCase) }; } for (int i = 0; i < targetNames.Length; i++) { targetOutputsPerProject[0][targetNames[i]] = results[i].Items; if (results[i].ResultCode == TargetResultCode.Failure) { overallSuccess = false; } } } else { // UNDONE: (Refactor) Investigate making this a ReadOnly collection of some sort. PropertyDictionary <ProjectPropertyInstance>[] propertyDictionaries = new PropertyDictionary <ProjectPropertyInstance> [projectFileNames.Length]; for (int i = 0; i < projectFileNames.Length; i++) { // Copy in the original project's global properties propertyDictionaries[i] = new PropertyDictionary <ProjectPropertyInstance>(_requestEntry.RequestConfiguration.Project.GlobalPropertiesDictionary); // Now add/replace any which may have been specified. if (globalProperties[i] != null) { foreach (DictionaryEntry entry in globalProperties[i]) { propertyDictionaries[i].Set(ProjectPropertyInstance.Create(entry.Key as string, entry.Value as string, _taskLocation)); } } // Finally, remove any which were requested to be removed. if (undefineProperties?[i] != null) { foreach (string property in undefineProperties[i]) { propertyDictionaries[i].Remove(property); } } } IRequestBuilderCallback builderCallback = _requestEntry.Builder as IRequestBuilderCallback; BuildResult[] results = await builderCallback.BuildProjects( projectFileNames, propertyDictionaries, toolsVersion ?? Array.Empty <string>(), targetNames ?? Array.Empty <string>(), waitForResults : true, skipNonexistentTargets : skipNonexistentTargets); // Even if one of the projects fails to build and therefore has no outputs, it should still have an entry in the results array (albeit with an empty list in it) ErrorUtilities.VerifyThrow(results.Length == projectFileNames.Length, "{0}!={1}.", results.Length, projectFileNames.Length); if (returnTargetOutputs) { targetOutputsPerProject = new List <IDictionary <string, ITaskItem[]> >(results.Length); } // Now walk through the results, and report that subset which was asked for. for (int i = 0; i < results.Length; i++) { if (targetOutputsPerProject != null) { targetOutputsPerProject.Add(new Dictionary <string, ITaskItem[]>(StringComparer.OrdinalIgnoreCase)); } foreach (KeyValuePair <string, TargetResult> resultEntry in results[i].ResultsByTarget) { if (targetOutputsPerProject != null) { // We need to clone the task items because if we did not then we would be passing live references // out to the caller of the msbuild callback and any modifications they make to those items // would appear in the results cache. ITaskItem[] clonedTaskItem = new ITaskItem[resultEntry.Value.Items.Length]; for (int j = 0; j < resultEntry.Value.Items.Length; j++) { clonedTaskItem[j] = ((TaskItem)resultEntry.Value.Items[j]).DeepClone(); } targetOutputsPerProject[i][resultEntry.Key] = clonedTaskItem; } } if (results[i].OverallResult == BuildResultCode.Failure) { overallSuccess = false; } if (!string.IsNullOrEmpty(results[i].SchedulerInducedError)) { LoggingContext.LogErrorFromText( subcategoryResourceName: null, errorCode: null, helpKeyword: null, file: new BuildEventFileInfo(ProjectFileOfTaskNode, LineNumberOfTaskNode, ColumnNumberOfTaskNode), message: results[i].SchedulerInducedError); } } ErrorUtilities.VerifyThrow(results.Length == projectFileNames.Length || overallSuccess == false, "The number of results returned {0} cannot be less than the number of project files {1} unless one of the results indicated failure.", results.Length, projectFileNames.Length); } return(new BuildEngineResult(overallSuccess, targetOutputsPerProject)); } }
IEnumerable <ITaskItem> GetCodesignedFiles(ITaskItem item) { var codesignedFiles = new List <ITaskItem> (); if (Directory.Exists(item.ItemSpec)) { var codeSignaturePath = Path.Combine(item.ItemSpec, CodeSignatureDirName); if (!Directory.Exists(codeSignaturePath)) { return(codesignedFiles); } codesignedFiles.AddRange(Directory.EnumerateFiles(codeSignaturePath).Select(x => new TaskItem(x))); var extension = Path.GetExtension(item.ItemSpec); if (extension == ".app" || extension == ".appex") { var executableName = Path.GetFileName(item.ItemSpec); var manifestPath = Path.Combine(item.ItemSpec, "Info.plist"); if (File.Exists(manifestPath)) { var bundleExecutable = PDictionary.FromFile(manifestPath).GetCFBundleExecutable(); if (!string.IsNullOrEmpty(bundleExecutable)) { executableName = bundleExecutable; } } var basePath = item.ItemSpec; if (Directory.Exists(Path.Combine(basePath, MacOSDirName))) { basePath = Path.Combine(basePath, MacOSDirName); } var executablePath = Path.Combine(basePath, executableName); if (File.Exists(executablePath)) { codesignedFiles.Add(new TaskItem(executablePath)); } } } else if (File.Exists(item.ItemSpec)) { codesignedFiles.Add(item); var dirName = Path.GetDirectoryName(item.ItemSpec); if (Path.GetExtension(dirName) == ".framework") { codesignedFiles.AddRange(Directory.EnumerateFiles(Path.Combine(dirName, CodeSignatureDirName)).Select(x => new TaskItem(x))); } } return(codesignedFiles); }
IList <string> GenerateCommandLineArguments(ITaskItem item) { var args = new List <string> (); args.Add("-v"); args.Add("--force"); if (IsAppExtension) { args.Add("--deep"); } if (UseHardenedRuntime) { args.Add("-o runtime"); } if (UseSecureTimestamp) { args.Add("--timestamp"); } else { args.Add("--timestamp=none"); } args.Add("--sign"); args.Add(SigningKey); if (!string.IsNullOrEmpty(Keychain)) { args.Add("--keychain"); args.Add(Path.GetFullPath(Keychain)); } if (!string.IsNullOrEmpty(ResourceRules)) { args.Add("--resource-rules"); args.Add(Path.GetFullPath(ResourceRules)); } if (!string.IsNullOrEmpty(Entitlements)) { args.Add("--entitlements"); args.Add(Path.GetFullPath(Entitlements)); } if (DisableTimestamp) { args.Add("--timestamp=none"); } if (!string.IsNullOrEmpty(ExtraArgs)) { args.Add(ExtraArgs); } args.Add(Path.GetFullPath(item.ItemSpec)); return(args); }
string GetOutputPath(ITaskItem item) { return(Path.Combine(StampPath, item.ItemSpec)); }
public MSBuildTaskItem(ITaskItem taskItem) { _taskItem = taskItem; }
private DependencyContext BuildDependencyContextWithReferenceAssemblies(bool useCompilationOptions) { string mainProjectName = "simple.dependencies"; LockFile lockFile = TestLockFiles.GetLockFile(mainProjectName); SingleProjectInfo mainProject = SingleProjectInfo.Create( "/usr/Path", mainProjectName, ".dll", "1.0.0", new ITaskItem[] { }); ITaskItem[] referencePaths = new ITaskItem[] { new MockTaskItem( "/usr/Path/System.NotConflicting.dll", new Dictionary <string, string> { { "CopyLocal", "false" }, { "FusionName", "System.NotConflicting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" }, { "Version", "" }, }), new MockTaskItem( "/usr/Path/System.Collections.NonGeneric.dll", new Dictionary <string, string> { { "CopyLocal", "false" }, { "FusionName", "System.Collections.NonGeneric, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" }, { "Version", "" }, }), new MockTaskItem( "/usr/Path/System.Collections.NonGeneric.Reference.dll", new Dictionary <string, string> { { "CopyLocal", "false" }, { "FusionName", "System.Collections.NonGeneric.Reference, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" }, { "Version", "" }, }), }; ProjectContext projectContext = lockFile.CreateProjectContext( FrameworkConstants.CommonFrameworks.NetCoreApp10, runtime: null, platformLibraryName: Constants.DefaultPlatformLibrary, runtimeFrameworks: null, isSelfContained: false); CompilationOptions compilationOptions = useCompilationOptions ? CreateCompilationOptions() : null; DependencyContext dependencyContext = new DependencyContextBuilder(mainProject, projectContext, includeRuntimeFileVersions: false) .WithReferenceAssemblies(ReferenceInfo.CreateReferenceInfos(referencePaths)) .WithCompilationOptions(compilationOptions) .Build(); // ensure the DependencyContext can be written out successfully - it has no duplicate dependency names Save(dependencyContext); return(dependencyContext); }
public bool ShouldCreateOutputFile(ITaskItem item) => false;
public bool ShouldCopyToBuildServer(ITaskItem item) => false;
/// <summary> /// Generates the Framework Xml element for NuGet specification /// </summary> /// <param name="defaultNamespace">The xml namespace</param> /// <param name="taskItem">The Task item read from the project file</param> /// <returns>Framework XElement</returns> private static XElement GenerateFrameworkAssemblyXElement(XNamespace defaultNamespace, ITaskItem taskItem) { var frameworkAssembly = new XElement(defaultNamespace + "frameworkAssembly "); frameworkAssembly.Add(new XAttribute("assemblyName", taskItem.ItemSpec)); if (!string.IsNullOrWhiteSpace(taskItem.GetMetadata("version"))) { frameworkAssembly.Add(new XAttribute("version", taskItem.GetMetadata("version"))); } return(frameworkAssembly); }
private string ToString(ITaskItem i) { return(i.ItemSpec + string.Join(";", i.CloneCustomMetadata().Keys.OfType <string>().Select(k => i.GetMetadata(k)))); }
public KnownFrameworkReference(ITaskItem item) { _item = item; TargetFramework = NuGetFramework.Parse(item.GetMetadata("TargetFramework")); }
public TaskItemOutputStreamSource(ITaskItem taskItem) : base(taskItem.ItemSpec) { }
/// <summary> /// Generates the dependency Xml element for NuGet specification /// </summary> /// <param name="defaultNamespace">The xml namespace</param> /// <param name="taskItem">The Task item read from the project file</param> /// <returns>Dependency XElement</returns> private static XElement GenerateDependencyElement(XNamespace defaultNamespace, ITaskItem taskItem) { var dependency = new XElement(defaultNamespace + "dependency"); dependency.Add(new XAttribute("id", taskItem.ItemSpec)); var version = taskItem.GetMetadata("version"); if (!string.IsNullOrWhiteSpace(version)) { if (!IsValidVersionNumber(version)) { throw new Exception(string.Format(CultureInfo.CurrentCulture, "Invalid version {0} specified for dependency {1}", version, taskItem.ItemSpec)); } dependency.Add(new XAttribute("version", version)); } return(dependency); }
public int GetHashCode(ITaskItem obj) { return(GetHashCode(new FileInfo(obj.ItemSpec))); }
public TaskItemOutputStreamSource(ITaskItem taskItem, string name) : base(taskItem.ItemSpec, name) { }
public static string GetMetadata(this ITaskItem taskItem, string metadataName, string defaultValue) { var metadataValue = taskItem.GetMetadata(metadataName); return(string.IsNullOrEmpty(metadataValue) ? defaultValue : metadataValue); }
private void OnScriptFileGenerated(ITaskItem scriptItem, CompilerOptions options, bool copyReferences) { _scripts.Add(scriptItem); Func <string, bool, string> getScriptFile = delegate(string reference, bool debug) { string scriptFile = Path.ChangeExtension(reference, debug ? ".debug.js" : ".js"); if (File.Exists(scriptFile)) { return(scriptFile); } string fileName = Path.GetFileName(scriptFile); if ((fileName.Length > 7) && fileName.StartsWith("Script.", StringComparison.OrdinalIgnoreCase)) { fileName = fileName.Substring(7); scriptFile = Path.Combine(Path.GetDirectoryName(scriptFile), fileName); if (File.Exists(scriptFile)) { return(scriptFile); } } return(null); }; Action <string, string> safeCopyFile = delegate(string sourceFilePath, string targetFilePath) { try { if (File.Exists(targetFilePath)) { // If the file already exists, make sure it is not read-only, so // it can be overrwritten. File.SetAttributes(targetFilePath, FileAttributes.Normal); } File.Copy(sourceFilePath, targetFilePath, /* overwrite */ true); // Copy the file, and then make sure it is not read-only (for example, if the // source file for a referenced script is read-only). File.SetAttributes(targetFilePath, FileAttributes.Normal); } catch (Exception e) { Log.LogError("Unable to copy referenced script '" + sourceFilePath + "' as '" + targetFilePath + "' (" + e.Message + ")"); _hasErrors = true; } }; string projectName = (_projectPath != null) ? Path.GetFileNameWithoutExtension(_projectPath) : String.Empty; string scriptFileName = Path.GetFileName(scriptItem.ItemSpec); string scriptPath = Path.GetFullPath(scriptItem.ItemSpec); string scriptFolder = Path.GetDirectoryName(scriptItem.ItemSpec); Log.LogMessage(MessageImportance.High, "{0} -> {1} ({2})", projectName, scriptFileName, scriptPath); if (copyReferences) { foreach (string reference in options.References) { string releaseScriptFile = getScriptFile(reference, /* debug */ false); if (releaseScriptFile != null) { string path = Path.Combine(scriptFolder, Path.GetFileName(releaseScriptFile)); safeCopyFile(releaseScriptFile, path); } string debugScriptFile = getScriptFile(reference, /* debug */ true); if (debugScriptFile != null) { string path = Path.Combine(scriptFolder, Path.GetFileName(debugScriptFile)); safeCopyFile(debugScriptFile, path); } } } string deploymentPath = DeploymentPath; if (DeploymentPath.Length != 0) { string deployedScriptPath = Path.Combine(deploymentPath, scriptFileName); safeCopyFile(scriptPath, deployedScriptPath); if (copyReferences) { foreach (string reference in options.References) { string releaseScriptFile = getScriptFile(reference, /* debug */ false); if (releaseScriptFile != null) { string path = Path.Combine(deploymentPath, Path.GetFileName(releaseScriptFile)); safeCopyFile(releaseScriptFile, path); } string debugScriptFile = getScriptFile(reference, /* debug */ true); if (debugScriptFile != null) { string path = Path.Combine(deploymentPath, Path.GetFileName(debugScriptFile)); safeCopyFile(debugScriptFile, path); } } } } }
public PrimaryReference(ITaskItem item, string parent_copy_local) { TaskItem = item; ParentCopyLocal = parent_copy_local; }
public bool Equals(ITaskItem x, ITaskItem y) { return(Equals(new FileInfo(x.ItemSpec), new FileInfo(y.ItemSpec))); }
public static void Transform(IRunnerLogger logger, string outputDisplayName, string resourceName, XNode xml, ITaskItem outputFile) { var xmlTransform = new System.Xml.Xsl.XslCompiledTransform(); using (var writer = XmlWriter.Create(outputFile.GetMetadata("FullPath"), new XmlWriterSettings { Indent = true })) using (var xsltReader = XmlReader.Create(typeof(xunit).Assembly.GetManifestResourceStream("Xunit.Runner.MSBuild." + resourceName))) using (var xmlReader = xml.CreateReader()) { xmlTransform.Load(xsltReader); xmlTransform.Transform(xmlReader, writer); } }
public static string GetTargetSubdirectory(this ITaskItem taskItem) { return(taskItem.GetMetadata(Metadata.TargetSubdirectory) ?? string.Empty); }
public static string GetFullPath(this ITaskItem item) { return item.GetMetadata("FullPath"); }
// Use @search_paths to resolve the reference ResolvedReference ResolveReference(ITaskItem item, IEnumerable <string> search_paths, bool set_copy_local) { ResolvedReference resolved = null; bool specific_version; assembly_resolver.ResetSearchLogger(); if (!TryGetSpecificVersionValue(item, out specific_version)) { return(null); } var spath_index = 0; foreach (string spath in search_paths) { if (string.IsNullOrEmpty(spath)) { continue; } assembly_resolver.LogSearchMessage("For searchpath {0}", spath); // The first value of search_paths can be the parent assembly directory. // In that case the value would be treated as a directory. // This code checks if we should treat the value as a TargetFramework assembly. // Doing so avoids CopyLocal beeing set to true. if (spath_index++ == 0 && targetFrameworkDirectories != null) { foreach (string fpath in targetFrameworkDirectories) { if (string.IsNullOrEmpty(fpath)) { continue; } if (String.Compare( Path.GetFullPath(spath).TrimEnd(Path.DirectorySeparatorChar), Path.GetFullPath(fpath).TrimEnd(Path.DirectorySeparatorChar), StringComparison.InvariantCulture) != 0) { continue; } resolved = assembly_resolver.FindInTargetFramework(item, fpath, specific_version); break; } if (resolved != null) { break; } } if (String.Compare(spath, "{HintPathFromItem}") == 0) { resolved = assembly_resolver.ResolveHintPathReference(item, specific_version); } else if (String.Compare(spath, "{TargetFrameworkDirectory}") == 0) { if (targetFrameworkDirectories == null) { continue; } foreach (string fpath in targetFrameworkDirectories) { resolved = assembly_resolver.FindInTargetFramework(item, fpath, specific_version); if (resolved != null) { break; } } } else if (String.Compare(spath, "{GAC}") == 0) { resolved = assembly_resolver.ResolveGacReference(item, specific_version); } else if (String.Compare(spath, "{RawFileName}") == 0) { //FIXME: identify assembly names, as extract the name, and try with that? AssemblyName aname; if (assembly_resolver.TryGetAssemblyNameFromFile(item.ItemSpec, out aname)) { resolved = assembly_resolver.GetResolvedReference(item, item.ItemSpec, aname, true, SearchPath.RawFileName); } } else if (String.Compare(spath, "{CandidateAssemblyFiles}") == 0) { assembly_resolver.LogSearchMessage( "Warning: {{CandidateAssemblyFiles}} not supported currently"); } else if (String.Compare(spath, "{PkgConfig}") == 0) { resolved = assembly_resolver.ResolvePkgConfigReference(item, specific_version); } else { resolved = assembly_resolver.FindInDirectory( item, spath, allowedAssemblyExtensions ?? default_assembly_extensions, specific_version); } if (resolved != null) { break; } } if (resolved != null && set_copy_local) { SetCopyLocal(resolved.TaskItem, resolved.CopyLocal.ToString()); } return(resolved); }
public void CopyMetadataTo(ITaskItem destinationItem) { throw new NotImplementedException(); }
public TaskItemPackageDependency(ITaskItem item) : base(item.ItemSpec, TryParseVersionRange(item.GetMetadata("Version"))) { Item = item; TargetFramework = NuGetFramework.Parse(item.GetMetadata(nameof(TargetFramework))); AssemblyVersion = GetAssemblyVersion(item); }
public override bool Execute() { var intermediate = Path.Combine(IntermediateOutputPath, ToolName); var intermediateBundleDir = Path.Combine(intermediate, "bundle"); var manifest = new TaskItem(Path.Combine(intermediate, "asset-manifest.plist")); var bundleResources = new List <ITaskItem> (); var outputManifests = new List <ITaskItem> (); var catalogs = new List <ITaskItem> (); var unique = new HashSet <string> (); string bundleIdentifier = null; var knownSpecs = new HashSet <string> (); var specs = new PArray(); int rc; Log.LogTaskName("ACTool"); Log.LogTaskProperty("AppManifest", AppManifest); Log.LogTaskProperty("DeviceModel", DeviceModel); Log.LogTaskProperty("DeviceOSVersion", DeviceOSVersion); Log.LogTaskProperty("ImageAssets", ImageAssets); Log.LogTaskProperty("IntermediateOutputPath", IntermediateOutputPath); Log.LogTaskProperty("IsWatchApp", IsWatchApp); Log.LogTaskProperty("OptimizePNGs", OptimizePNGs); Log.LogTaskProperty("OutputPath", OutputPath); Log.LogTaskProperty("ProjectDir", ProjectDir); Log.LogTaskProperty("ResourcePrefix", ResourcePrefix); Log.LogTaskProperty("SdkBinPath", SdkBinPath); Log.LogTaskProperty("SdkPlatform", SdkPlatform); Log.LogTaskProperty("SdkVersion", SdkVersion); switch (SdkPlatform) { case "iPhoneSimulator": case "iPhoneOS": case "MacOSX": case "WatchSimulator": case "WatchOS": case "AppleTVSimulator": case "AppleTVOS": break; default: Log.LogError("Unrecognized platform: {0}", SdkPlatform); return(false); } if (AppManifest != null) { try { plist = PDictionary.FromFile(AppManifest.ItemSpec); } catch (Exception ex) { Log.LogError(null, null, null, AppManifest.ItemSpec, 0, 0, 0, 0, "{0}", ex.Message); return(false); } bundleIdentifier = plist.GetCFBundleIdentifier(); } foreach (var asset in ImageAssets) { var vpath = BundleResource.GetVirtualProjectPath(ProjectDir, asset); if (Path.GetFileName(vpath) != "Contents.json") { continue; } // get the parent (which will typically be .appiconset, .launchimage, .imageset, .iconset, etc) var catalog = Path.GetDirectoryName(vpath); // keep walking up the directory structure until we get to the .xcassets directory while (!string.IsNullOrEmpty(catalog) && Path.GetExtension(catalog) != ".xcassets") { catalog = Path.GetDirectoryName(catalog); } if (string.IsNullOrEmpty(catalog)) { Log.LogWarning(null, null, null, asset.ItemSpec, 0, 0, 0, 0, "Asset not part of an asset catalog: {0}", asset.ItemSpec); continue; } if (unique.Add(catalog)) { catalogs.Add(new TaskItem(catalog)); } if (AppleSdkSettings.XcodeVersion.Major >= 7 && !string.IsNullOrEmpty(bundleIdentifier) && SdkPlatform != "WatchSimulator") { var text = File.ReadAllText(asset.ItemSpec); if (string.IsNullOrEmpty(text)) { continue; } var json = JsonConvert.DeserializeObject(text) as JObject; if (json == null) { continue; } var properties = json.Property("properties"); if (properties == null) { continue; } var resourceTags = properties.Value.ToObject <JObject> ().Property("on-demand-resource-tags"); if (resourceTags == null || resourceTags.Value.Type != JTokenType.Array) { continue; } var tagArray = resourceTags.Value.ToObject <JArray> (); var tags = new HashSet <string> (); string hash; foreach (var tag in tagArray.Select(token => token.ToObject <string> ())) { tags.Add(tag); } var tagList = tags.ToList(); tagList.Sort(); var path = AssetPackUtils.GetAssetPackDirectory(intermediate, bundleIdentifier, tagList, out hash); if (knownSpecs.Add(hash)) { var assetpack = new PDictionary(); var ptags = new PArray(); Directory.CreateDirectory(path); for (int i = 0; i < tags.Count; i++) { ptags.Add(new PString(tagList[i])); } assetpack.Add("bundle-id", new PString(string.Format("{0}.asset-pack-{1}", bundleIdentifier, hash))); assetpack.Add("bundle-path", new PString(Path.GetFullPath(path))); assetpack.Add("tags", ptags); specs.Add(assetpack); } } } if (catalogs.Count == 0) { // There are no (supported?) asset catalogs return(true); } partialAppManifest = new TaskItem(Path.Combine(intermediate, "partial-info.plist")); if (specs.Count > 0) { outputSpecs = Path.Combine(intermediate, "output-specifications.plist"); specs.Save(outputSpecs, true); } var output = new TaskItem(intermediateBundleDir); Directory.CreateDirectory(intermediateBundleDir); // Note: Compile() will set the PartialAppManifest property if it is used... if ((rc = Compile(catalogs.ToArray(), output, manifest)) != 0) { if (File.Exists(manifest.ItemSpec)) { try { var log = PDictionary.FromFile(manifest.ItemSpec); LogWarningsAndErrors(log, catalogs[0]); } catch (FormatException) { Log.LogError("actool exited with code {0}", rc); } File.Delete(manifest.ItemSpec); } return(false); } if (PartialAppManifest != null && !File.Exists(PartialAppManifest.GetMetadata("FullPath"))) { Log.LogError("Partial Info.plist file was not generated: {0}", PartialAppManifest.GetMetadata("FullPath")); } try { var manifestOutput = PDictionary.FromFile(manifest.ItemSpec); LogWarningsAndErrors(manifestOutput, catalogs[0]); bundleResources.AddRange(GetCompiledBundleResources(manifestOutput, intermediateBundleDir)); outputManifests.Add(manifest); } catch (Exception ex) { Log.LogError("Failed to load output manifest for {0} for the file {2}: {1}", ToolName, ex.Message, manifest.ItemSpec); } foreach (var assetpack in specs.OfType <PDictionary> ()) { var path = Path.Combine(assetpack.GetString("bundle-path").Value, "Info.plist"); var bundlePath = PathUtils.AbsoluteToRelative(intermediate, path); var outputPath = Path.Combine(OutputPath, bundlePath); var rpath = Path.Combine(intermediate, bundlePath); var dict = new PDictionary(); dict.SetCFBundleIdentifier(assetpack.GetString("bundle-id").Value); dict.Add("Tags", assetpack.GetArray("tags").Clone()); dict.Save(path, true, true); var item = new TaskItem(rpath); item.SetMetadata("LogicalName", bundlePath); item.SetMetadata("OutputPath", outputPath); item.SetMetadata("Optimize", "false"); bundleResources.Add(item); } BundleResources = bundleResources.ToArray(); OutputManifests = outputManifests.ToArray(); return(!Log.HasLoggedErrors); }
protected void AssertInvalidFilename(DetectInvalidResourceOutputFilenamesTask task, ITaskItem item) => Assert.Contains(task.InvalidItems ?? Enumerable.Empty <string>(), c => c == item.ItemSpec);
static bool InterfaceDefinitionChanged(ITaskItem interfaceDefinition, ITaskItem log) { return(!LogExists(log.ItemSpec) || File.GetLastWriteTimeUtc(log.ItemSpec) < File.GetLastWriteTimeUtc(interfaceDefinition.ItemSpec)); }
private async System.Threading.Tasks.Task <ITaskItem> Upload(IReleasesClient client, Release release, ITaskItem sourceItem) { var uploadedAsset = await client.UploadAsset(release, BuildAssetUpload(sourceItem)); return(TaskItemFor(release, uploadedAsset)); }