/** * @brief initialization WITHOUT Visual Studio services available. */ public CTestAdapterPackage() { if (null != Instance) { /// @todo give some error here! } Instance = this; // main DTE object this._dte = (DTE)Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(DTE)); // basic solution events this._log = new CTestAdapterLog(); this._sol = new SolutionEventListener(Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider); this._sol.SolutionLoaded += this.SolutionLoaded; this._sol.SolutionUnloaded += this.SolutionUnloaded; // cmake cache & cmake test file this._config = new CTestAdapterConfig(); this._cmakeCache = new CMakeCache(this._log); this._cMakeCacheWatcher = new CMakeCacheWatcher(this._log); this._cMakeCacheWatcher.CacheFileChanged += this.OnCMakeCacheChanged; // test container discovery and management this._containerManager = new TestContainerManager(this, this._log); this._activeConfigurationTimer = new System.Timers.Timer(CTestAdapterPackage.ConfigurationTimerIntervalMs); this._activeConfigurationTimer.Elapsed += this.UpdateActiveConfiguration; this._containerManager.TestContainersChanged += this.OnTestContainersChanged; this.SetValidRelease(); }
public static CTestAdapterConfig ReadFromCache(string dir) { if (!Directory.Exists(dir)) { return(null); } ILog log = null; var pkg = CTestAdapterPackage.Instance; if (null != pkg) { log = pkg.Logger; } var cache = new CMakeCache(log); cache.LoadCMakeCache(Path.Combine(dir, Constants.CMakeCacheFilename)); if (!cache.IsLoaded) { return(null); } var cfg = new CTestAdapterConfig { // unfortunately we cannot set the active configuration here, // a fallback will be used when parsing CMakeConfigurationTypes = cache[Constants.CMakeCacheKey_CofigurationTypes], CTestExecutable = cache[Constants.CMakeCacheKey_CTestCommand], CacheDir = cache[Constants.CMakeCacheKey_CacheFileDir] }; return(cfg); }