Mercurial > hg > icedrobot > ika
view src/org/icedrobot/ika/plugins/borg/ClonerTask.java @ 4:82de5424529c
Moved SCM Repository abstraction to different location.
author | Mario Torre <neugens.limasoftware@gmail.com> |
---|---|
date | Tue, 08 Mar 2011 00:20:49 +0100 |
parents | 91ff28c21e0b |
children |
line wrap: on
line source
/* * IKA - IcedRobot Kiosk Application * Copyright (C) 2011 IcedRobot team * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.icedrobot.ika.plugins.borg; import org.icedrobot.ika.plugins.scm.Repository; import org.icedrobot.ika.plugins.scm.HGRepository; import java.io.File; import java.util.Properties; import java.util.concurrent.CyclicBarrier; import java.util.logging.Level; import java.util.logging.Logger; import org.icedrobot.ika.plugins.IkaPluginException; /** * @author Mario Torre <neugens.limasoftware@gmail.com> */ class ClonerTask implements Runnable { private Repository repository; private CyclicBarrier barrier; public ClonerTask(Repository repository, CyclicBarrier barrier) { this.repository = repository; this.barrier = barrier; } @Override public void run() { try { // create the local path first, if it doesn't exist already // then start populating it with the Android code System.err.println("create local directory: " + repository); repository.createRoot(); // second, clone the main icedrobot repository System.err.println("cloning: " + repository.getRemotePath()); repository.makeClone(); Properties configs = new Properties(); configs.load(AndroidAssimilator.class.getResourceAsStream( AndroidAssimilator.ANDROID_SUBREPOS_CONFIGS)); String subrepos = configs.getProperty(repository.getName()); for (String repo : subrepos.split(",")) { Repository subRepository = repository.makeSubRepository(repo, repo, "icedrobot"); String sep = File.separator; Repository hgPatchQueue = new HGRepository(repo, subRepository.getFullPath(), ".git" + sep + "patches", repository.getBaseDirectory() + sep + "icedrobot" + sep + "projects" + sep + subRepository.getName() + sep + "patches"); hgPatchQueue.createRoot(); hgPatchQueue.makeClone(); subRepository.applyPatchQueue(); } // synchronise with other tasks barrier.await(); } catch (Throwable ex) { barrier.reset(); Logger.getLogger(ClonerTask.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); throw new IkaPluginException(ex.getMessage(), ex); } } }