Package com.redhat.ceylon.cmr.api

Examples of com.redhat.ceylon.cmr.api.ArtifactContext


            String version = module.getVersion();
            if (module != ModuleSpec.DEFAULT_MODULE && !module.isVersioned()) {
                version = checkModuleVersionsOrShowSuggestions(getRepositoryManager(), module.getName(), null, ModuleQuery.Type.SRC, null, null);
            }
            msg("retrieving.module", module).newline();
            ArtifactContext allArtifacts = new ArtifactContext(module.getName(), version, ArtifactContext.SRC, ArtifactContext.RESOURCES, ArtifactContext.DOCS, ArtifactContext.SCRIPTS_ZIPPED);
            List<ArtifactResult> results = getRepositoryManager().getArtifactResults(allArtifacts);
            if (results == null) {
                String err = getModuleNotFoundErrorMessage(getRepositoryManager(), module.getName(), module.getVersion());
                errorAppend(err);
                errorNewline();
View Full Code Here


        for (ModuleSpec module : modules) {
            if (module != ModuleSpec.DEFAULT_MODULE && !module.isVersioned()) {
                String version = checkModuleVersionsOrShowSuggestions(getRepositoryManager(), module.getName(), null, ModuleQuery.Type.ALL, null, null);
                module = new ModuleSpec(module.getName(), version);
            }
            ArtifactContext ac = new ArtifactContext(module.getName(), module.getVersion(), artifactsArray);
            ac.setIgnoreDependencies(!withDependencies);
            ac.setForceOperation(true);
            acs.add(ac);
        }
       
        // Now do the actual copying
        final boolean logArtifacts = verbose != null && (verbose.contains("all") || verbose.contains("files"));
        ModuleCopycat copier = new ModuleCopycat(getRepositoryManager(), getOutputRepositoryManager(), log, new ModuleCopycat.CopycatFeedback() {
            @Override
            public boolean beforeCopyModule(ArtifactContext ac, int count, int max) throws IOException {
                String module = ModuleUtil.makeModuleName(ac.getName(), ac.getVersion());
                msg("copying.module", module, count+1, max).flush();
                if (logArtifacts) {
                    newline().flush();
                }
                return true;
            }
            @Override
            public void afterCopyModule(ArtifactContext ac, int count, int max, boolean copied) throws IOException {
                if (!logArtifacts) {
                    append(" ").msg((copied) ? "copying.ok" : "copying.skipped").newline().flush();
                }
            }
            @Override
            public boolean beforeCopyArtifact(ArtifactContext ac, File archive, int count, int max) throws IOException {
                if (logArtifacts) {
                    append("    ").msg("copying.artifact", archive.getName(), count+1, max).flush();
                }
                return true;
            }
            @Override
            public void afterCopyArtifact(ArtifactContext ac, File archive, int count, int max, boolean copied) throws IOException {
                if (logArtifacts) {
                    append(" ").msg((copied) ? "copying.ok" : "copying.skipped").newline().flush();
                }
            }
            @Override
            public void notFound(ArtifactContext ac) throws IOException {
                String err = getModuleNotFoundErrorMessage(getRepositoryManager(), ac.getName(), ac.getVersion());
                errorAppend(err);
                errorNewline();
            }
        });
        copier.copyModules(acs);
View Full Code Here

    // Publish the JAR to the specified or default output repository
    public void publish() {
        RepositoryManager outputRepository = getOutputRepositoryManager();

        ArtifactContext context = new ArtifactContext(module.getName(), module.getVersion(), ArtifactContext.JAR);
        context.setForceOperation(true);
        ArtifactContext descriptorContext = null;
        if (descriptor != null) {
            if (descriptor.toString().toLowerCase().endsWith(".xml")) {
                descriptorContext = new ArtifactContext(module.getName(), module.getVersion(), ArtifactContext.MODULE_XML);
            } else if (descriptor.toString().toLowerCase().endsWith(".properties")) {
                descriptorContext = new ArtifactContext(module.getName(), module.getVersion(), ArtifactContext.MODULE_PROPERTIES);
            }
            descriptorContext.setForceOperation(true);
        }
        try{
            File jarFile = applyCwd(this.jarFile);
            outputRepository.putArtifact(context, jarFile);
            signArtifact(context, jarFile);
View Full Code Here

                        } else {
                            msg("info.ok");
                        }
                    }
                } else {
                    ArtifactContext context = new ArtifactContext(name, dep.getVersion(), ArtifactContext.CAR, ArtifactContext.JAR);
                    File artifact = getRepositoryManager().getArtifact(context);
                    if (artifact != null && artifact.exists()) {
                        try {
                            Set<String> importedClasses = JarUtils.gatherClassnamesFromJar(artifact);
                            if (removeMatchingClasses(externalClasses, importedClasses)) {
View Full Code Here

    public void addOutputModuleToClassPath(Module module){
        RepositoryManager repositoryManager = fileManager.getOutputRepositoryManager();
        ArtifactResult artifact = null;
        try {
            ArtifactContext ctx = new ArtifactContext(module.getNameAsString(), module.getVersion(), ArtifactContext.CAR, ArtifactContext.JAR);
            artifact = repositoryManager.getArtifactResult(ctx);
        } catch (InvalidArchiveException e) {
            log.error("ceylon", "Module car " + e.getPath()
                    +" obtained from repository " + e.getRepository()
                    +" has an invalid SHA1 signature: you need to remove it and rebuild the archive, since it"
View Full Code Here

        }
        dir.mkdirs();

        // download a required jar
        RepositoryManager repoManager = CeylonUtils.repoManager().buildManager();
        File undertowCoreModule = repoManager.getArtifact(new ArtifactContext("io.undertow.core", "1.0.0.Beta20", ".jar"));
        File languageModule = repoManager.getArtifact(new ArtifactContext(AbstractModelLoader.CEYLON_LANGUAGE, TypeChecker.LANGUAGE_MODULE_VERSION, ".car"));

        // fire up the java compiler
        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
        assertNotNull("Missing Java compiler, this test is probably being run with a JRE instead of a JDK!", compiler);
        List<String> options = Arrays.asList("-sourcepath", "../ceylon-sdk/source", "-d", dir.getAbsolutePath(),
View Full Code Here

        private TaskListener taskListener;

        public ProgressiveJar(RepositoryManager repoManager, Module module, Log log, Options options, CeyloncFileManager ceyloncFileManager, TaskListener taskListener) throws IOException{
            this.options = options;
            this.repoManager = repoManager;
            this.carContext = new ArtifactContext(module.getNameAsString(), module.getVersion(), ArtifactContext.CAR);
            this.cmrLog = new JavacLogger(options, Log.instance(ceyloncFileManager.getContext()));
            this.srcCreator = CeylonUtils.makeSourceArtifactCreator(
                    repoManager,
                    ceyloncFileManager.getLocation(StandardLocation.SOURCE_PATH),
                    module.getNameAsString(), module.getVersion(),
View Full Code Here

            }
        }
    }

    private void addOutputModuleToClassPath(Module module) {
        ArtifactContext ctx = new ArtifactContext(module.getNameAsString(), module.getVersion(), ArtifactContext.CAR);
        ArtifactResult result = outputRepositoryManager.getArtifactResult(ctx);
        if(result != null)
            getModelLoader().addModuleToClassPath(module, result);
    }
View Full Code Here

        dependencies.remove(module.getIdentifier());
        unloadModuleLocal(module);
    }

    protected ArtifactResult findArtifact(ModuleIdentifier mi) {
        final ArtifactContext context = new ArtifactContext(mi.getName(), mi.getSlot(), ArtifactContext.CAR, ArtifactContext.JAR);
        return repository.getArtifactResult(context);
    }
View Full Code Here

                }
            }
            // already resolved and same version, we're good
            return;
        }
        ArtifactContext artifactContext = new ArtifactContext(name, version, ArtifactContext.CAR, ArtifactContext.JAR);
        ArtifactResult result = repositoryManager.getArtifactResult(artifactContext);
        if(!optional
                && (result == null || result.artifact() == null || !result.artifact().exists())){
            throw new RuntimeException("Missing module: "+ModuleUtil.makeModuleName(name, version));
        }
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.cmr.api.ArtifactContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.