Esempio n. 1
0
        public void Execute(Entity dataModel, ChangeObservable observable)
        {
            int exitCode = builder.Execute(dataModel);

            if (exitCode != 0)
            {
                throw new FormattableException("Deploying library failed!");
            }
        }
Esempio n. 2
0
        public int BuildLibraryForProject(Entity project, ChangeObservable observable,
                                          string metaFilesDirectory, string libraryLocation, string outputDirectory,
                                          Guid libraryGuid, IEnumerable <string> targets,
                                          IEnumerable <string> externalLibraries, string buildType)
        {
            userInterface.WriteInformation("Starting library generation...");

            ProjectEntity projectEntity = ProjectEntity.Decorate(project);
            IEnumerable <(Target, string)> targetsSet;

            if (!targets.Any())
            {
                TargetsResult ts = targetParser.Targets(projectEntity, false);
                if (!ts.ValidTargets.Any())
                {
                    throw new FormattableException
                              ("Please use --target to specify for which targets the library shall be generated.");
                }
                else
                {
                    HashSet <(Target, string)> targetsHashSet = new HashSet <(Target, string)>();
                    foreach (Target target in ts.ValidTargets)
                    {
                        targetsHashSet.Add((target, null));
                    }
                    targetsSet = targetsHashSet;
                }
            }
            else
            {
                targetsSet = targetParser.GetSpecificTargets(targets, false);
            }

            Dictionary <Target, IEnumerable <VirtualFile> > externalLibs =
                ExternalLibrariesParser.ParseExternalLibraries(externalLibraries, targetParser,
                                                               fileSystem, targetsSet.Select(t => t.Item1));

            int result = libraryBuilderExecuter.Execute(projectEntity, metaFilesDirectory, libraryLocation,
                                                        outputDirectory, observable, userInterface, libraryGuid, targetsSet, externalLibs, buildType);

            if (result == 0)
            {
                userInterface.WriteInformation("Successfully generated library!");
            }
            return(result);
        }