Search in sources :

Example 1 with ManifestInternal

use of org.gradle.api.java.archives.internal.ManifestInternal in project gradle by gradle.

the class Jar method computeManifest.

private ManifestInternal computeManifest() {
    Manifest manifest = getManifest();
    if (manifest == null) {
        manifest = new DefaultManifest(null);
    }
    ManifestInternal manifestInternal;
    if (manifest instanceof ManifestInternal) {
        manifestInternal = (ManifestInternal) manifest;
    } else {
        manifestInternal = new CustomManifestInternalWrapper(manifest);
    }
    manifestInternal.setContentCharset(manifestContentCharset);
    return manifestInternal;
}
Also used : DefaultManifest(org.gradle.api.java.archives.internal.DefaultManifest) CustomManifestInternalWrapper(org.gradle.api.java.archives.internal.CustomManifestInternalWrapper) ManifestInternal(org.gradle.api.java.archives.internal.ManifestInternal) DefaultManifest(org.gradle.api.java.archives.internal.DefaultManifest) Manifest(org.gradle.api.java.archives.Manifest)

Example 2 with ManifestInternal

use of org.gradle.api.java.archives.internal.ManifestInternal in project gradle by gradle.

the class Jar method manifestFileTree.

private FileTreeInternal manifestFileTree() {
    final Cached<ManifestInternal> manifest = Cached.of(this::computeManifest);
    final OutputChangeListener outputChangeListener = outputChangeListener();
    return fileCollectionFactory().generated(getTemporaryDirFactory(), "MANIFEST.MF", action(file -> outputChangeListener.beforeOutputChange(ImmutableList.of(file.getAbsolutePath()))), action(outputStream -> manifest.get().writeTo(outputStream)));
}
Also used : Action(org.gradle.api.Action) DefaultManifest(org.gradle.api.java.archives.internal.DefaultManifest) Closure(groovy.lang.Closure) Cached(org.gradle.internal.serialization.Cached) OutputChangeListener(org.gradle.internal.execution.OutputChangeListener) SerializableLambdas.action(org.gradle.api.internal.lambdas.SerializableLambdas.action) CopySpec(org.gradle.api.file.CopySpec) DisableCachingByDefault(org.gradle.work.DisableCachingByDefault) CustomManifestInternalWrapper(org.gradle.api.java.archives.internal.CustomManifestInternalWrapper) ConfigureUtil(org.gradle.util.internal.ConfigureUtil) ImmutableList(com.google.common.collect.ImmutableList) Charset(java.nio.charset.Charset) FileCollectionFactory(org.gradle.api.internal.file.FileCollectionFactory) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) FileTreeInternal(org.gradle.api.internal.file.FileTreeInternal) FileCopyDetails(org.gradle.api.file.FileCopyDetails) Manifest(org.gradle.api.java.archives.Manifest) ManifestInternal(org.gradle.api.java.archives.internal.ManifestInternal) Input(org.gradle.api.tasks.Input) InvalidUserDataException(org.gradle.api.InvalidUserDataException) Zip(org.gradle.api.tasks.bundling.Zip) Internal(org.gradle.api.tasks.Internal) CopySpecInternal(org.gradle.api.internal.file.copy.CopySpecInternal) ManifestInternal(org.gradle.api.java.archives.internal.ManifestInternal) OutputChangeListener(org.gradle.internal.execution.OutputChangeListener)

Aggregations

Manifest (org.gradle.api.java.archives.Manifest)2 CustomManifestInternalWrapper (org.gradle.api.java.archives.internal.CustomManifestInternalWrapper)2 DefaultManifest (org.gradle.api.java.archives.internal.DefaultManifest)2 ManifestInternal (org.gradle.api.java.archives.internal.ManifestInternal)2 ImmutableList (com.google.common.collect.ImmutableList)1 Closure (groovy.lang.Closure)1 Charset (java.nio.charset.Charset)1 Action (org.gradle.api.Action)1 InvalidUserDataException (org.gradle.api.InvalidUserDataException)1 CopySpec (org.gradle.api.file.CopySpec)1 FileCopyDetails (org.gradle.api.file.FileCopyDetails)1 FileCollectionFactory (org.gradle.api.internal.file.FileCollectionFactory)1 FileTreeInternal (org.gradle.api.internal.file.FileTreeInternal)1 CopySpecInternal (org.gradle.api.internal.file.copy.CopySpecInternal)1 SerializableLambdas.action (org.gradle.api.internal.lambdas.SerializableLambdas.action)1 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)1 Input (org.gradle.api.tasks.Input)1 Internal (org.gradle.api.tasks.Internal)1 Zip (org.gradle.api.tasks.bundling.Zip)1 OutputChangeListener (org.gradle.internal.execution.OutputChangeListener)1