Search in sources :

Example 1 with ClientLibraryJavaArtifact

use of com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact in project enunciate by stoicflame.

the class GWTJSONOverlayModule method packageArtifacts.

protected File packageArtifacts(File sourceDir) {
    File packageDir = getPackageDir();
    packageDir.mkdirs();
    try {
        String jarName = getJarName();
        File jarFile = new File(packageDir, jarName);
        if (!isUpToDateWithSources(jarFile)) {
            boolean anyFiles = this.enunciate.jar(jarFile, getManifest(), sourceDir);
            if (!anyFiles) {
                jarFile = null;
            }
        } else {
            info("Skipping creation of the GWT overlay source jar as everything appears up-to-date...");
        }
        ClientLibraryJavaArtifact artifactBundle = new ClientLibraryJavaArtifact(getName(), "gwt.json.overlay", "GWT JSON Overlay");
        artifactBundle.setGroupId(getGroupId());
        artifactBundle.setArtifactId(getArtifactId());
        artifactBundle.setVersion(getVersion());
        artifactBundle.setPlatform("Google Web Toolkit");
        // read in the description from file:
        artifactBundle.setDescription((String) context.getProperty(LIRBARY_DESCRIPTION_PROPERTY));
        FileArtifact sourcesJar = new FileArtifact(getName(), "gwt.json.overlay.sources", jarFile);
        sourcesJar.setDescription("The sources for the GWT JSON overlay.");
        sourcesJar.setPublic(false);
        sourcesJar.setArtifactType(ArtifactType.sources);
        artifactBundle.addArtifact(sourcesJar);
        this.enunciate.addArtifact(sourcesJar);
        this.enunciate.addArtifact(artifactBundle);
    } catch (IOException e) {
        throw new EnunciateException(e);
    }
    return packageDir;
}
Also used : ClientLibraryJavaArtifact(com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact) EnunciateException(com.webcohesion.enunciate.EnunciateException) FileArtifact(com.webcohesion.enunciate.artifacts.FileArtifact) IOException(java.io.IOException) File(java.io.File)

Example 2 with ClientLibraryJavaArtifact

use of com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact in project enunciate by stoicflame.

the class JavaJSONClientModule method packageArtifacts.

protected File packageArtifacts(File sourceDir, File compileDir) {
    File packageDir = getPackageDir();
    packageDir.mkdirs();
    try {
        String jarName = getJarName();
        File clientJarFile = null;
        if (!isDisableCompile()) {
            clientJarFile = new File(packageDir, jarName);
            if (!isUpToDateWithSources(clientJarFile)) {
                if (isBundleSourcesWithClasses()) {
                    boolean anyFiles = this.enunciate.jar(clientJarFile, getManifest(), sourceDir, compileDir);
                    if (!anyFiles) {
                        clientJarFile = null;
                    }
                } else {
                    boolean anyFiles = this.enunciate.jar(clientJarFile, getManifest(), compileDir);
                    if (!anyFiles) {
                        clientJarFile = null;
                    }
                }
            } else {
                info("Skipping creation of Java client jar as everything appears up-to-date...");
            }
        }
        File clientSourcesJarFile = null;
        if (!isBundleSourcesWithClasses()) {
            clientSourcesJarFile = new File(packageDir, jarName.replaceFirst("\\.jar", "-json-sources.jar"));
            if (!isUpToDateWithSources(clientSourcesJarFile)) {
                boolean anyFiles = this.enunciate.zip(clientSourcesJarFile, sourceDir);
                if (!anyFiles) {
                    clientSourcesJarFile = null;
                }
            } else {
                info("Skipping creation of the Java client source jar as everything appears up-to-date...");
            }
        }
        ClientLibraryJavaArtifact artifactBundle = new ClientLibraryJavaArtifact(getName(), "java.json.client.library", "Java JSON Client Library");
        artifactBundle.setGroupId(getGroupId());
        artifactBundle.setArtifactId(getArtifactId());
        artifactBundle.setVersion(getVersion());
        artifactBundle.setPlatform("Java (Version 5+)");
        // read in the description from file:
        artifactBundle.setDescription((String) context.getProperty(LIRBARY_DESCRIPTION_PROPERTY));
        if (clientJarFile != null) {
            FileArtifact binariesJar = new FileArtifact(getName(), "java.json.client.library.binaries", clientJarFile);
            binariesJar.setDescription("The binaries for the Java JSON client library.");
            binariesJar.setPublic(false);
            binariesJar.setArtifactType(ArtifactType.binaries);
            artifactBundle.addArtifact(binariesJar);
            this.enunciate.addArtifact(binariesJar);
        }
        if (clientSourcesJarFile != null) {
            FileArtifact sourcesJar = new FileArtifact(getName(), "java.json.client.library.sources", clientSourcesJarFile);
            sourcesJar.setDescription("The sources for the Java JSON client library.");
            sourcesJar.setPublic(false);
            sourcesJar.setArtifactType(ArtifactType.sources);
            artifactBundle.addArtifact(sourcesJar);
            this.enunciate.addArtifact(sourcesJar);
        }
        if (clientJarFile != null || clientSourcesJarFile != null) {
            this.enunciate.addArtifact(artifactBundle);
        }
    } catch (IOException e) {
        throw new EnunciateException(e);
    }
    return packageDir;
}
Also used : ClientLibraryJavaArtifact(com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact) EnunciateException(com.webcohesion.enunciate.EnunciateException) FileArtifact(com.webcohesion.enunciate.artifacts.FileArtifact)

Example 3 with ClientLibraryJavaArtifact

use of com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact in project enunciate by stoicflame.

the class DocsModule method copyDocumentationArtifacts.

protected List<Download> copyDocumentationArtifacts(Set<Artifact> artifacts, File outputDir) throws IOException {
    ArrayList<Download> downloads = new ArrayList<Download>();
    for (Artifact artifact : artifacts) {
        debug("Exporting %s to directory %s.", artifact.getId(), outputDir);
        artifact.exportTo(outputDir, this.enunciate);
        if (artifact instanceof SpecifiedArtifact && !((SpecifiedArtifact) artifact).isShowLink()) {
            continue;
        }
        Download download = new Download();
        download.setSlug("artifact_" + artifact.getId().replace('.', '_'));
        download.setName(artifact.getName());
        download.setDescription(artifact.getDescription());
        download.setCreated(artifact.getCreated());
        if (artifact instanceof ClientLibraryJavaArtifact) {
            download.setGroupId(((ClientLibraryJavaArtifact) artifact).getGroupId());
            download.setArtifactId(((ClientLibraryJavaArtifact) artifact).getArtifactId());
            download.setVersion(((ClientLibraryJavaArtifact) artifact).getVersion());
        }
        Collection<? extends Artifact> childArtifacts = (artifact instanceof ClientLibraryArtifact) ? ((ClientLibraryArtifact) artifact).getArtifacts() : (artifact instanceof SpecifiedArtifact) ? Arrays.asList(((SpecifiedArtifact) artifact).getFile()) : Arrays.asList(artifact);
        ArrayList<DownloadFile> downloadFiles = new ArrayList<DownloadFile>();
        for (Artifact childArtifact : childArtifacts) {
            DownloadFile downloadFile = new DownloadFile();
            downloadFile.setDescription(childArtifact.getDescription());
            downloadFile.setName(childArtifact.getName());
            downloadFile.setSize(getDisplaySize(childArtifact.getSize()));
            downloadFiles.add(downloadFile);
        }
        download.setFiles(downloadFiles);
        downloads.add(download);
    }
    return downloads;
}
Also used : ClientLibraryJavaArtifact(com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact) ClientLibraryArtifact(com.webcohesion.enunciate.artifacts.ClientLibraryArtifact) FileArtifact(com.webcohesion.enunciate.artifacts.FileArtifact) ClientLibraryJavaArtifact(com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact) Artifact(com.webcohesion.enunciate.artifacts.Artifact) ClientLibraryArtifact(com.webcohesion.enunciate.artifacts.ClientLibraryArtifact)

Example 4 with ClientLibraryJavaArtifact

use of com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact in project enunciate by stoicflame.

the class JavaXMLClientModule method packageArtifacts.

protected File packageArtifacts(File sourceDir, File resourcesDir, File compileDir) {
    File packageDir = getPackageDir();
    packageDir.mkdirs();
    try {
        String jarName = getJarName();
        File clientJarFile = null;
        if (!isDisableCompile()) {
            clientJarFile = new File(packageDir, jarName);
            if (!isUpToDateWithSources(clientJarFile)) {
                if (isBundleSourcesWithClasses()) {
                    boolean anyFiles = this.enunciate.jar(clientJarFile, getManifest(), sourceDir, resourcesDir, compileDir);
                    if (!anyFiles) {
                        clientJarFile = null;
                    }
                } else {
                    boolean anyFiles = this.enunciate.jar(clientJarFile, getManifest(), resourcesDir, compileDir);
                    if (!anyFiles) {
                        clientJarFile = null;
                    }
                }
            } else {
                info("Skipping creation of Java client jar as everything appears up-to-date...");
            }
        }
        File clientSourcesJarFile = null;
        if (!isBundleSourcesWithClasses()) {
            clientSourcesJarFile = new File(packageDir, jarName.replaceFirst("\\.jar", "-xml-sources.jar"));
            if (!isUpToDateWithSources(clientSourcesJarFile)) {
                boolean anyFiles = this.enunciate.zip(clientSourcesJarFile, sourceDir, resourcesDir);
                if (!anyFiles) {
                    clientSourcesJarFile = null;
                }
            } else {
                info("Skipping creation of the Java client source jar as everything appears up-to-date...");
            }
        }
        ClientLibraryJavaArtifact artifactBundle = new ClientLibraryJavaArtifact(getName(), "java.xml.client.library", "Java XML Client Library");
        artifactBundle.setGroupId(getGroupId());
        artifactBundle.setArtifactId(getArtifactId());
        artifactBundle.setVersion(getVersion());
        artifactBundle.setPlatform("Java (Version 5+)");
        // read in the description from file:
        artifactBundle.setDescription((String) context.getProperty(LIRBARY_DESCRIPTION_PROPERTY));
        if (clientJarFile != null) {
            FileArtifact binariesJar = new FileArtifact(getName(), "java.xml.client.library.binaries", clientJarFile);
            binariesJar.setDescription("The binaries for the Java XML client library.");
            binariesJar.setPublic(false);
            binariesJar.setArtifactType(ArtifactType.binaries);
            artifactBundle.addArtifact(binariesJar);
            this.enunciate.addArtifact(binariesJar);
        }
        if (clientSourcesJarFile != null) {
            FileArtifact sourcesJar = new FileArtifact(getName(), "java.xml.client.library.sources", clientSourcesJarFile);
            sourcesJar.setDescription("The sources for the Java XML client library.");
            sourcesJar.setPublic(false);
            sourcesJar.setArtifactType(ArtifactType.sources);
            artifactBundle.addArtifact(sourcesJar);
            this.enunciate.addArtifact(sourcesJar);
        }
        if (clientJarFile != null || clientSourcesJarFile != null) {
            this.enunciate.addArtifact(artifactBundle);
        }
    } catch (IOException e) {
        throw new EnunciateException(e);
    }
    return packageDir;
}
Also used : ClientLibraryJavaArtifact(com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact) EnunciateException(com.webcohesion.enunciate.EnunciateException) FileArtifact(com.webcohesion.enunciate.artifacts.FileArtifact)

Aggregations

ClientLibraryJavaArtifact (com.webcohesion.enunciate.artifacts.ClientLibraryJavaArtifact)4 FileArtifact (com.webcohesion.enunciate.artifacts.FileArtifact)4 EnunciateException (com.webcohesion.enunciate.EnunciateException)3 Artifact (com.webcohesion.enunciate.artifacts.Artifact)1 ClientLibraryArtifact (com.webcohesion.enunciate.artifacts.ClientLibraryArtifact)1 File (java.io.File)1 IOException (java.io.IOException)1