private void syncProjectConfig() { if (syncProjectConfigHelper == null) { Attributes attributes = new Attributes(); try { attributes.loadFromXML(new FileInputStream("config.xml")); if (attributes.containsKey(BatchPack.KEY_ACCOUNT)) { attributes.loadFromXML( new FileInputStream( Files.convert2AbsolutePath(".", attributes.getProperty(BatchPack.KEY_ACCOUNT)))); } syncProjectConfigHelper = new SVNHelper( attributes.getProperty("projectConfigUrl"), attributes.getProperty("userName"), attributes.getProperty("password")); int version = records.getProjectVersion(PackRecords.CONFIG_PROJECT_ID); if (version != syncProjectConfigHelper.getProjectVersion()) { syncProjectConfigHelper.exportProject(new File("projects").getAbsolutePath()); syncProjectConfigHelper.setProjectUrl(attributes.getProperty("libProjectConfigUrl")); syncProjectConfigHelper.exportProject(new File("libProjects").getAbsolutePath()); } records.setProjectVersion( PackRecords.CONFIG_PROJECT_ID, syncProjectConfigHelper.getProjectVersion()); records.saveRecords(); System.out.println("import latest config ok"); } catch (Exception e) { e.printStackTrace(); } } }
public static void prepareProjectPanel(ProjectPanel panel) { BatchPack pack = panel.getProjectBatch(); if (pack.isLibrary() || pack.isDebugMode()) return; AndroidProject project = pack.getAttributes().getAndroidProject(); ArrayList<String> libPaths = PackManager.getRelativeLibraryPaths(project.projectPath); for (String libPath : libPaths) { String configer = Files.readTextFile(new File(project.projectPath, "project.properties"), true); String keyName = new File(libPath).getName(); String libraryPath = publicLibraries.get(keyName); if (libraryPath == null) { System.err.println("error: not found dependency library " + keyName); continue; } libraryPath = Files.convert2AbsolutePath("", libraryPath); try { String relativePath = Files.toRelativePath(new File(project.projectPath), new File(libraryPath)); configer = configer.replace(libPath, relativePath); Files.saveTextFile(new File(project.projectPath, "project.properties"), configer); } catch (IOException e) { e.printStackTrace(); } } }