示例#1
0
        /// <inheritdoc/>
        public PlatformDetectorResult Detect(RepositoryContext context)
        {
            PlatformDetectorResult detectionResult;

            try
            {
                detectionResult = _detector.Detect(new DetectorContext
                {
                    SourceRepo = new Detector.LocalSourceRepo(context.SourceRepo.RootPath),
                });
            }
            catch (FailedToParseFileException ex)
            {
                // Make sure to log exception which might contain the exact exception details from the parser which
                // we can look up in appinsights and tell user if required.
                _logger.LogError(ex, ex.Message);

                throw new InvalidUsageException(ex.Message);
            }

            if (detectionResult == null)
            {
                return(null);
            }

            ResolveVersions(context, detectionResult);
            return(detectionResult);
        }
示例#2
0
        /// <inheritdoc/>
        public PlatformDetectorResult Detect(RepositoryContext context)
        {
            var detectionResult = _detector.Detect(new DetectorContext
            {
                SourceRepo = new Detector.LocalSourceRepo(context.SourceRepo.RootPath),
            });

            if (detectionResult == null)
            {
                return(null);
            }

            var version = ResolveVersion(detectionResult.PlatformVersion);

            detectionResult.PlatformVersion = version;
            return(detectionResult);
        }