Esempio n. 1
0
 public DeployService(IFileSystem fileSystem, ITemplateResolver resolver, ITargetParser targetParser, ExecutionContext executionContext)
 {
     this.fileSystem       = fileSystem;
     this.resolver         = resolver;
     this.targetParser     = targetParser;
     this.executionContext = executionContext;
 }
Esempio n. 2
0
 public GetTargetsCommand(ITransactionFactory transactionFactory, IExceptionHandler exceptionHandler, ExecutionContext executionContext, ICommandResultVisualizer commandResultVisualizer, IEntityFactory entityFactory, ITargetParser targetParser, ISdkRepository sdkRepository, IUserInterface userInterface) : base(transactionFactory, exceptionHandler, executionContext, commandResultVisualizer, true)
 {
     this.entityFactory = entityFactory;
     this.targetParser  = targetParser;
     this.sdkRepository = sdkRepository;
     this.userInterface = userInterface;
 }
Esempio n. 3
0
 public Builder(IUserInterface userInterface, ISdkRepository sdkRepository,
                IBuildExecuter buildExecuter, ILibraryBuilderExecuter libraryBuilderExecuter, ITargetParser targetParser, IFileSystem fileSystem)
 {
     this.userInterface          = userInterface;
     this.sdkRepository          = sdkRepository;
     this.buildExecuter          = buildExecuter;
     this.libraryBuilderExecuter = libraryBuilderExecuter;
     this.targetParser           = targetParser;
     this.fileSystem             = fileSystem;
 }
Esempio n. 4
0
 public RootEntityContentProvider(ITemplateRepository templateRepository, ITemplateIdentifierRepository identifierRepository, IFileSystem fileSystem, IParser parser, ExecutionContext executionContext, ITargetParser targetParser, ISdkRepository sdkRepository, IBuildInformationService informationService)
 {
     this.templateRepository   = templateRepository;
     this.identifierRepository = identifierRepository;
     this.fileSystem           = fileSystem;
     this.parser             = parser;
     this.executionContext   = executionContext;
     this.targetParser       = targetParser;
     this.sdkRepository      = sdkRepository;
     this.informationService = informationService;
 }
Esempio n. 5
0
 public ProjectPropertiesProvider(ITargetParser targetParser, ISdkRepository sdkRepository, IFileSystem fileSystem)
 {
     this.targetParser  = targetParser;
     this.sdkRepository = sdkRepository;
     this.fileSystem    = fileSystem;
 }
Esempio n. 6
0
        public static Dictionary <Target, IEnumerable <VirtualFile> > ParseExternalLibraries(IEnumerable <string> rawExternalLibraries, ITargetParser targetParser,
                                                                                             IFileSystem fileSystem, IEnumerable <Target> targetBase)
        {
            Dictionary <Target, IEnumerable <VirtualFile> > externalLibs = new Dictionary <Target, IEnumerable <VirtualFile> >();

            foreach (string externalLibrariesItem in rawExternalLibraries)
            {
                ParseExternalLibrary(externalLibrariesItem);
            }
            return(externalLibs);

            void ParseExternalLibrary(string externalLibrariesItem)
            {
                List <string> elements = new List <string>();

                Match match = LibrariesDecoder.Match(externalLibrariesItem);

                while (match.Success)
                {
                    elements.Add(match.Groups["element"].Value);

                    match = match.NextMatch();
                }
                if (elements.Count == 0)
                {
                    throw new FormattableException("Could not parse external libraries input." +
                                                   "Expected pattern is [<target>,[<version>,]]\"Path/To/ExternalLib.so\"");
                }

                if (elements.Count == 1)
                {
                    //no targetspecific external libraries allowed in this case
                    if (rawExternalLibraries.Count() > 1)
                    {
                        throw new WrongCombinedExternalLibrariesException();
                    }

                    addElementToLibs(elements[0]);

                    return;
                }

                //check if first element is file
                if (fileSystem.FileExists(elements[0]))
                {
                    //all elements are files
                    //no targetspecific external libraries allowed in this case
                    if (rawExternalLibraries.Count() > 1)
                    {
                        throw new WrongCombinedExternalLibrariesException();
                    }

                    foreach (string element in elements)
                    {
                        addElementToLibs(element);
                    }
                    return;
                }

                //check if second element is file
                if (fileSystem.FileExists(elements[1]))
                {
                    //second element is file,
                    //try to parse first element as target
                    try
                    {
                        Target target = targetParser.ParseTarget(elements[0], null, targetBase);
                        elements.RemoveAt(0);

                        List <VirtualFile> libs = new List <VirtualFile>();
                        foreach (string element in elements)
                        {
                            if (!fileSystem.FileExists(element))
                            {
                                throw new LibraryNotFoundException(element);
                            }
                            libs.Add(fileSystem.GetFile(element));
                        }
                        if (externalLibs.ContainsKey(target))
                        {
                            throw new FormattableException($"For the target {target.GetLongFullName()} external libraries are specified twice.");
                        }
                        externalLibs.Add(target, libs);
                        return;
                    }
                    catch (TargetNameNotFoundException e)
                    {
                        throw new MalformedExternalLibrariesOptionException(elements[0], "target", e.Message);
                    }
                }

                //assume that second element is version

                try
                {
                    Target target = targetParser.ParseTarget(elements[0], elements[1], targetBase);
                    elements.RemoveAt(1);
                    elements.RemoveAt(0);

                    List <VirtualFile> libs = new List <VirtualFile>();
                    foreach (string element in elements)
                    {
                        if (!fileSystem.FileExists(element))
                        {
                            throw new LibraryNotFoundException(element);
                        }
                        libs.Add(fileSystem.GetFile(element));
                    }
                    if (externalLibs.ContainsKey(target))
                    {
                        throw new FormattableException($"For the target {target.GetLongFullName()} external libraries are specified twice.");
                    }
                    externalLibs.Add(target, libs);
                    return;
                }
                catch (TargetNameNotFoundException e)
                {
                    throw new MalformedExternalLibrariesOptionException(elements[0], "target", e.Message);
                }
                catch (TargetVersionNotFoundException e)
                {
                    throw new MalformedExternalLibrariesOptionException(elements[1],
                                                                        $"version for target{elements[0]}", e.Message);
                }


                void addElementToLibs(string element)
                {
                    if (!fileSystem.FileExists(element))
                    {
                        throw new LibraryNotFoundException(element);
                    }
                    foreach (Target t in targetBase)
                    {
                        List <VirtualFile> libse = new List <VirtualFile>();
                        libse.Add(fileSystem.GetFile(element));
                        if (externalLibs.ContainsKey(t))
                        {
                            throw new FormattableException($"For the target {t.GetLongFullName()} external libraries are specified twice.");
                        }
                        externalLibs.Add(t, libse);
                    }
                }
            }
        }
Esempio n. 7
0
 public GetCompilerSpecificationsCommand(ITransactionFactory transactionFactory, IExceptionHandler exceptionHandler, ExecutionContext executionContext, ICommandResultVisualizer commandResultVisualizer, IEntityFactory entityFactory, ITargetParser targetParser, ISdkRepository sdkRepository) : base(transactionFactory, exceptionHandler, executionContext, commandResultVisualizer, true)
 {
     this.entityFactory = entityFactory;
     this.targetParser  = targetParser;
     this.sdkRepository = sdkRepository;
 }
Esempio n. 8
0
 public UpdateTargetsCommand(ITransactionFactory transactionFactory, IExceptionHandler exceptionHandler, ExecutionContext executionContext, ICommandResultVisualizer commandResultVisualizer, IEntityFactory entityFactory, ITargetParser targetParser) : base(transactionFactory, exceptionHandler, executionContext, commandResultVisualizer)
 {
     this.entityFactory = entityFactory;
     this.targetParser  = targetParser;
 }