/** * Propagate recompilation through the dependency chains. Avoid re-tainting packages that have * already been compiled. */ public void taintPackagesDependingOnChangedPackages( Set<String> pkgs, Set<String> recentlyCompiled) { for (Package pkg : prev.packages().values()) { for (String dep : pkg.dependencies()) { if (pkgs.contains(dep) && !recentlyCompiled.contains(pkg.name())) { taintPackage(pkg.name(), " its depending on " + dep); } } } }
/** If artifacts have gone missing, force a recompile of the packages they belong to. */ public void taintPackagesThatMissArtifacts() { for (Package pkg : prev.packages().values()) { for (File f : pkg.artifacts().values()) { if (!f.exists()) { // Hmm, the artifact on disk does not exist! Someone has removed it.... // Lets rebuild the package. taintPackage(pkg.name(), "" + f + " is missing."); } } } }
/** * Checks if an XQuery component is already installed as part of another package. * * @param comp component * @param name component's package * @return result * @throws QueryException query exception */ private boolean isInstalled(final Component comp, final byte[] name) throws QueryException { // get packages in which the module's namespace is found final TokenSet pkgs = repo.nsDict().get(comp.uri); if (pkgs == null) return false; for (final byte[] nextPkg : pkgs) { if (nextPkg != null && !eq(Package.name(nextPkg), name)) { // installed package is a different one, not just a different version // of the current one final String pkgDir = string(repo.pkgDict().get(nextPkg)); final IO pkgDesc = new IOFile(repo.path(pkgDir), DESCRIPTOR); final Package pkg = new PkgParser(repo, input).parse(pkgDesc); for (final Component nextComp : pkg.comps) { if (nextComp.name().equals(comp.name())) return true; } } } return false; }