@Before public void setUp() throws Exception { if (this.project == null) { System.setProperty("meghanada.test", "true"); this.projectRoot = new File("./").getCanonicalFile(); // this.projectRoot = new File("./").getCanonicalFile(); this.projectRootPath = this.projectRoot.getCanonicalPath(); this.project = new GradleProject(projectRoot); String tmpdir = System.getProperty("java.io.tmpdir"); File tmpParent = new File(tmpdir); if (!tmpParent.exists() && !tmpParent.mkdirs()) { log.warn("fail create tmpdir"); } final File tempDir = Files.createTempDir(); tempDir.deleteOnExit(); final String path = tempDir.getCanonicalPath(); System.setProperty(TEMP_PROJECT_SETTING_DIR, path); } }
@SuppressWarnings("CheckReturnValue") public static void setupProject(boolean useCache) throws Exception { if (useCache) { System.setProperty("meghanada.source.cache", "true"); } else { System.setProperty("meghanada.source.cache", "false"); } if (project == null) { final File tempDir = Files.createTempDir(); tempDir.deleteOnExit(); final String path = tempDir.getCanonicalPath(); System.setProperty(TEMP_PROJECT_SETTING_DIR, path); log.info("create database {}", path); // replace tmp File f = new File("./").getCanonicalFile(); Project newProject = new GradleProject(f); project = newProject.parseProject(f, f).mergeFromProjectConfig(); } Config config = Config.load(); if (useCache) { config.update("source-cache", true); } else { config.update("source-cache", false); } log.info("finish setupProject"); }
switch (targetFile) { case Project.GRADLE_PROJECT_FILE: project = new GradleProject(projectRoot); break; case Project.MVN_PROJECT_FILE: