private PackageIL CompileStdLib(AdamantCompiler compiler) { try { var sourceDir = Path.Combine(SolutionDirectory.Get(), @"stdlib\src"); var sourcePaths = Directory.EnumerateFiles(sourceDir, "*.ad", SearchOption.AllDirectories); var rootNamespace = FixedList <string> .Empty; var codeFiles = sourcePaths.Select(p => LoadCode(p, sourceDir, rootNamespace)) .ToList(); return(compiler.CompilePackage("adamant.stdlib", codeFiles, FixedDictionary <Name, PackageIL> .Empty)); } catch (FatalCompilationErrorException ex) { testOutput.WriteLine("Std Lib Compiler Errors:"); foreach (var diagnostic in ex.Diagnostics) { testOutput.WriteLine( $"{diagnostic.File.Reference}:{diagnostic.StartPosition.Line}:{diagnostic.StartPosition.Column} {diagnostic.Level} {diagnostic.ErrorCode}"); testOutput.WriteLine(diagnostic.Message); } Assert.True(false, "Compilation errors in standard library"); throw new UnreachableCodeException(); } }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); server = new TestWebServer.HttpServer(SolutionDirectory.Combine("files")); Task.Factory.StartNew(server.Start); ApplicationConfiguration.WebTimeout = 10000; }
public void Resources_start_with_BOM(string filename) { var projectDir = Path.Combine(SolutionDirectory.Get(), "Emit.C"); var codeFileBytes = File.ReadAllBytes(Path.Combine(projectDir, filename)); AssertStartsWithUtf8Bom(codeFileBytes); }
public void creates_a_new_directory_if_it_does_not_already_exist() { var solutionDirectory = new SolutionDirectory("foo"); var plan = TemplatePlan.CreateClean("solution"); solutionDirectory.Alter(plan); Directory.Exists("solution".AppendPath("foo")).ShouldBeTrue(); }
private static Package CompileStdLib(AdamantCompiler compiler) { var sourceDir = Path.Combine(SolutionDirectory.Get(), @"stdlib\src"); var sourcePaths = Directory.EnumerateFiles(sourceDir, "*.ad", SearchOption.AllDirectories); var rootNamespace = FixedList <string> .Empty; var codeFiles = sourcePaths.Select(p => LoadCode(p, sourceDir, rootNamespace)).ToList(); return(compiler.CompilePackage("adamant.stdlib", codeFiles, FixedDictionary <string, Package> .Empty)); }
public void create_a_deep_directory() { var solutionDirectory = new SolutionDirectory("foo/bar"); var plan = TemplatePlan.CreateClean("solution"); solutionDirectory.Alter(plan); Directory.Exists("solution".AppendPath("foo")).ShouldBeTrue(); Directory.Exists("solution".AppendPath("foo", "bar")).ShouldBeTrue(); }
public static TheoryData <TestCase> GetConformanceTestCases() { var testCases = new TheoryData <TestCase>(); var testsDirectory = Path.Combine(SolutionDirectory.Get(), "tests"); foreach (var fullPath in Directory.EnumerateFiles(testsDirectory, "*.ad", SearchOption.AllDirectories)) { var relativePath = Path.GetRelativePath(testsDirectory, fullPath); testCases.Add(new TestCase(fullPath, relativePath)); } return(testCases); }
private static PackageSigningRule GetRule() { var solutionDir = SolutionDirectory.GetSolutionRootDirectory(); var nugetExe = Path.Combine(solutionDir, "obj", "nuget.exe"); if (!File.Exists(nugetExe)) { throw new FileNotFoundException($"File {nugetExe} could not be found. Ensure build /t:Prepare is invoked from the root of this repository, before this test is executed."); } return(new PackageSigningRule(nugetExe)); }
public void does_not_cause_any_problems_when_the_directory_already_exists() { var solutionDirectory = new SolutionDirectory("foo"); var plan = TemplatePlan.CreateClean("solution"); Directory.CreateDirectory("solution".AppendPath("foo")); solutionDirectory.Alter(plan); Directory.Exists("solution".AppendPath("foo")).ShouldBeTrue(); }
/// <summary> /// </summary> private UserPreferences(IDictionary <string, string> replacementsDictionary) { _replacements = replacementsDictionary.Clone(); ProjectType = (ProjectType)Enum.Parse(typeof(ProjectType), _replacements[@"$wizarddata$"]); _solutionProjectSameDirectory = string.IsNullOrWhiteSpace(SolutionDirectory) || SolutionDirectory.Equals(DestinationDirectory, StringComparison.OrdinalIgnoreCase) || !SolutionDirectory.Equals(Path.GetDirectoryName(DestinationDirectory), StringComparison.OrdinalIgnoreCase); if (_solutionProjectSameDirectory) { SolutionDirectory = DestinationDirectory; } // Add replacements keys _replacements.AddKey(@"$targetname$"); _replacements.AddKey(@"$exportsdef$"); _replacements.AddKey(@"$msvcdirectory$"); _replacements.AddKey(@"$cmakeprojectname$"); _replacements.AddKey(@"$cmakepluginprojectdirname$"); _replacements.AddKey(@"$pluginname$"); _replacements.AddKey(@"$pluginversion$"); _replacements.AddKey(@"$pluginauthor$"); _replacements.AddKey(@"$pluginlogtag$"); _replacements.AddKey(@"$pluginurl$"); _replacements.AddKey(@"$pluginlibrary$"); _replacements.AddKey(@"$pluginlibclass$"); _replacements.AddKey(@"$pluginloadable$"); _replacements.AddKey(@"$pluginunloadable$"); _replacements.AddKey(@"$pluginprojectdirname$"); // Initialize replacements TargetName = SafeProjectName.Replace("_", string.Empty).ToLower() + ProjectType.Suffix(); ExportsDef = SafeProjectName.Replace("_", string.Empty).ToUpper() + @"_EXPORTS"; MsvcDirectory = Path.Combine(DestinationDirectory, @"msvc"); CMakeProjectName = SafeProjectName.Replace("_", string.Empty).ToLower(); PluginName = ProjectName; PluginVersion = @"1.0.0"; PluginAuthor = Environment.UserName; PluginLogTag = PluginName.ToUpper(); PluginUrl = "https://dev-cs.ru"; PluginLibrary = SafeProjectName.ToLower(); PluginLibClass = SafeProjectName.ToLower(); PluginLoadable = MetaPluginLoadTime.AnyTime.ToCppCode(); PluginUnloadable = MetaPluginLoadTime.AnyTime.ToCppCode(); PluginProjectDirName = SafeProjectName.ToLower(); }
public BuildProject(string solutionPath) { Name = Path.GetFileNameWithoutExtension(solutionPath); SolutionDirectory = Path.GetDirectoryName(solutionPath); Branch = Path.GetFileName(Path.GetDirectoryName(Path.GetDirectoryName(solutionPath))); Solution = new Solution(solutionPath); if (SolutionDirectory != null) { VcsRoot = SolutionDirectory.Contains("\\depot\\") ? '/' + Path.GetDirectoryName(SolutionDirectory).Substring(SolutionDirectory.IndexOf("\\depot\\")).Replace('\\', '/') : SolutionDirectory.Contains("\\projects\\") ? "//depot" + Path.GetDirectoryName(SolutionDirectory).Substring(SolutionDirectory.IndexOf("\\projects\\")).Replace('\\', '/') : null; } }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); var filesToServePath = SolutionDirectory.Combine("files"); ApplicationConfiguration.WebTimeout = 50000; AssemblyResources.ToFile(ResourceType.Platform, "git.zip", filesToServePath, new DefaultEnvironment()); AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", filesToServePath, new DefaultEnvironment()); AssemblyResources.ToFile(ResourceType.Platform, "git.zip.md5", filesToServePath, new DefaultEnvironment()); AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip.md5", filesToServePath, new DefaultEnvironment()); server = new TestWebServer.HttpServer(SolutionDirectory.Combine("files")); Task.Factory.StartNew(server.Start); }
internal string ResolveInstallPath() { if (!String.IsNullOrEmpty(OutputDirectory)) { // Use the OutputDirectory if specified. return(OutputDirectory); } // If the SolutionDir is specified, use the .nuget directory under it to determine the solution-level settings ISettings currentSettings = Settings; if (!String.IsNullOrEmpty(SolutionDirectory)) { var solutionSettingsFile = Path.Combine(SolutionDirectory.TrimEnd(Path.DirectorySeparatorChar), NuGetConstants.NuGetSolutionSettingsFolder); var fileSystem = CreateFileSystem(solutionSettingsFile); currentSettings = NuGet.Settings.LoadDefaultSettings( fileSystem, configFileName: null, machineWideSettings: MachineWideSettings); // Recreate the source provider and credential provider SourceProvider = PackageSourceBuilder.CreateSourceProvider(currentSettings); HttpClient.DefaultCredentialProvider = new SettingsCredentialProvider(new ConsoleCredentialProvider(Console), SourceProvider, Console); } string installPath = currentSettings.GetRepositoryPath(); if (!String.IsNullOrEmpty(installPath)) { // If a value is specified in config, use that. return(installPath); } if (!String.IsNullOrEmpty(SolutionDirectory)) { // For package restore scenarios, deduce the path of the packages directory from the solution directory. return(Path.Combine(SolutionDirectory, CommandLineConstants.PackagesDirectoryName)); } // Use the current directory as output. return(Directory.GetCurrentDirectory()); }
private void CalculateEffectiveSettings() { // If the SolutionDir is specified, use the .nuget directory under it to determine the solution-level settings if (!String.IsNullOrEmpty(SolutionDirectory)) { var path = Path.Combine(SolutionDirectory.TrimEnd(Path.DirectorySeparatorChar), NuGetConstants.NuGetSolutionSettingsFolder); var solutionSettingsFile = Path.GetFullPath(path); Settings = Configuration.Settings.LoadDefaultSettings( solutionSettingsFile, configFileName: null, machineWideSettings: MachineWideSettings); // Recreate the source provider and credential provider SourceProvider = PackageSourceBuilder.CreateSourceProvider(Settings); SetDefaultCredentialProvider(); } }
/// <summary> /// Called, when the solution directory changes /// </summary> private void SolutionDirectoryChangedCallback() { AppRegistry.SetValue(RegistryKeys.SolutionPath, SolutionPath); ProjectDirectories = new ObservableCollection <DirectoryInfo>( SolutionDirectory.GetFiles("*.csproj", SearchOption.AllDirectories) .Select(f => f.Directory) .ToList() ); string lastProjectUsed = AppRegistry.GetValue(RegistryKeys.SelectedProject); if (String.IsNullOrEmpty(lastProjectUsed)) { return; } SelectedProjectDirectory = ProjectDirectories.FirstOrDefault(dir => dir.FullName == lastProjectUsed); }
public void plan_for_directory() { var fileSystem = new FileSystem(); fileSystem.CreateDirectory("deep-root"); fileSystem.CleanDirectory("deep-root"); fileSystem.CreateDirectory("deep-root", "foo", "bar"); fileSystem.CreateDirectory("deep-root", "src"); fileSystem.CreateDirectory("deep-root", "packaging", "nuget"); var directories = SolutionDirectory.PlanForDirectory("deep-root"); directories.OrderBy(x => x.RelativePath).ShouldHaveTheSameElementsAs( new SolutionDirectory("foo"), new SolutionDirectory("foo/bar"), new SolutionDirectory("packaging"), new SolutionDirectory("packaging/nuget"), new SolutionDirectory("src") ); }
public void VerifyMacGitLfsBundle() { var environmentPath = NPath.CreateTempDirectory("integration-test-environment"); var gitLfsPath = environmentPath.Combine("git-lfs"); gitLfsPath.Exists().Should().BeFalse(); var inputZipFile = SolutionDirectory.Combine("PlatformResources", "mac", "git-lfs.zip"); var fastZip = new FastZip(); fastZip.ExtractZip(inputZipFile, environmentPath, null); gitLfsPath.Exists().Should().BeTrue(); var calculateMd5 = NPath.FileSystem.CalculateMD5(gitLfsPath); calculateMd5.ToLower().Should().Be(GitInstaller.MacGitLfsExecutableMD5.ToLower()); }
public void VerifyGitLfsBundle() { var environmentPath = NPath.CreateTempDirectory("integration-test-environment"); var gitLfsPath = environmentPath.Combine("git-lfs.exe"); gitLfsPath.Exists().Should().BeFalse(); var inputZipFile = SolutionDirectory.Combine("PlatformResources", "windows", "git-lfs.zip"); var fastZip = new FastZip(); fastZip.ExtractZip(inputZipFile, environmentPath, null); gitLfsPath.Exists().Should().BeTrue(); var calculateMd5 = NPath.FileSystem.CalculateMD5(gitLfsPath); Assert.IsTrue(string.Compare(calculateMd5, GitInstaller.WindowsGitLfsExecutableMD5, true) == 0); }
public Logic( IGraphProvider graphProvider, IBitmapProvider bitmapProvider, Log logger, Commands commands, ConnectionData connectionData) { GraphProvider = graphProvider; Bitmap = bitmapProvider.Bitmap; Logger = logger; Commands = commands; bitmapProvider.ShowBitmap(); graphProvider.ShowGraph(); _groundSprite = BitmapLoader.Load(SolutionDirectory.Get(@"Images\Shooter\Tiles\tile_05.png"), 16, 16); _waterSprite = BitmapLoader.Load(SolutionDirectory.Get(@"Images\Shooter\Tiles\tile_19.png"), 16, 16); _treeSprite = BitmapLoader.Load(SolutionDirectory.Get(@"Images\Shooter\Tiles\tile_183.png"), 16, 16); Commands.Login(connectionData.Host, connectionData.Port, connectionData.UserName, connectionData.Password); Logger.LogCommands = true; }
internal string ResolveInstallPath() { if (!String.IsNullOrEmpty(OutputDirectory)) { // Use the OutputDirectory if specified. return(OutputDirectory); } // If the SolutionDir is specified, use the .nuget directory under it to determine the solution-level settings ISettings currentSettings = _configSettings; if (!String.IsNullOrEmpty(SolutionDirectory)) { var solutionSettingsFile = Path.Combine(SolutionDirectory.TrimEnd(Path.DirectorySeparatorChar), NuGetConstants.NuGetSolutionSettingsFolder); var fileSystem = CreateFileSystem(solutionSettingsFile); currentSettings = Settings.LoadDefaultSettings(fileSystem); } string installPath = currentSettings.GetRepositoryPath(); if (!String.IsNullOrEmpty(installPath)) { // If a value is specified in config, use that. return(installPath); } if (!String.IsNullOrEmpty(SolutionDirectory)) { // For package restore scenarios, deduce the path of the packages directory from the solution directory. return(Path.Combine(SolutionDirectory, CommandLineConstants.PackagesDirectoryName)); } // Use the current directory as output. return(Directory.GetCurrentDirectory()); }
protected override string GenerateCommandLineCommands() => $"{SolutionDirectory.FullPath()} -include {ProjectName}";
protected override void configurePlan(string directory, TemplatePlan plan) { SolutionDirectory.PlanForDirectory(directory).Each(plan.Add); }
protected override void configurePlan(string directory, TemplatePlan plan) { GenericEnumerableExtensions.Each <SolutionDirectory>(SolutionDirectory.PlanForDirectory(directory), new Action <SolutionDirectory>(plan.Add)); }
public NetCoreTests() { _nugetCacheDir = SolutionDirectory.CreateDirectory(".packages"); }
public static string GetRuntimeDirectory() { return(Path.Combine(SolutionDirectory.Get(), "tests", "runtime")); }