org.gradle.api.tasks.bundling.AbstractArchiveTask Java Examples

The following examples show how to use org.gradle.api.tasks.bundling.AbstractArchiveTask. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MavenArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public NotationParser<Object, MavenArtifact> create() {
    FileNotationParser fileNotationParser = new FileNotationParser(fileResolver);
    ArchiveTaskNotationParser archiveTaskNotationParser = new ArchiveTaskNotationParser();
    PublishArtifactNotationParser publishArtifactNotationParser = new PublishArtifactNotationParser();

    NotationParser<Object, MavenArtifact> sourceNotationParser = NotationParserBuilder
            .toType(MavenArtifact.class)
            .fromType(AbstractArchiveTask.class, archiveTaskNotationParser)
            .fromType(PublishArtifact.class, publishArtifactNotationParser)
            .converter(fileNotationParser)
            .toComposite();

    MavenArtifactMapNotationParser mavenArtifactMapNotationParser = new MavenArtifactMapNotationParser(sourceNotationParser);

    NotationParserBuilder<MavenArtifact> parserBuilder = NotationParserBuilder
            .toType(MavenArtifact.class)
            .fromType(AbstractArchiveTask.class, archiveTaskNotationParser)
            .fromType(PublishArtifact.class, publishArtifactNotationParser)
            .parser(mavenArtifactMapNotationParser)
            .converter(fileNotationParser);

    return parserBuilder.toComposite();
}
 
Example #2
Source File: ReproducePlugin.java    From skara with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void apply(Project project) {
    project.afterEvaluate((p) -> {
        for (var entry : project.getAllTasks(true).entrySet()) {
            for (var task : entry.getValue()) {
                if (task instanceof AbstractArchiveTask) {
                    var archiveTask = (AbstractArchiveTask) task;
                    archiveTask.setPreserveFileTimestamps(false);
                    archiveTask.setReproducibleFileOrder(true);
                }
            }
        }
    });

    project.getTasks().create("reproduce", ReproduceTask.class, (task) -> {
        task.setDockerfile("Dockerfile");
    });
}
 
Example #3
Source File: MavenArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public NotationParser<Object, MavenArtifact> create() {
    FileNotationParser fileNotationParser = new FileNotationParser(fileResolver);
    ArchiveTaskNotationParser archiveTaskNotationParser = new ArchiveTaskNotationParser();
    PublishArtifactNotationParser publishArtifactNotationParser = new PublishArtifactNotationParser();

    NotationParser<Object, MavenArtifact> sourceNotationParser = NotationParserBuilder
            .toType(MavenArtifact.class)
            .fromType(AbstractArchiveTask.class, archiveTaskNotationParser)
            .fromType(PublishArtifact.class, publishArtifactNotationParser)
            .converter(fileNotationParser)
            .toComposite();

    MavenArtifactMapNotationParser mavenArtifactMapNotationParser = new MavenArtifactMapNotationParser(sourceNotationParser);

    NotationParserBuilder<MavenArtifact> parserBuilder = NotationParserBuilder
            .toType(MavenArtifact.class)
            .fromType(AbstractArchiveTask.class, archiveTaskNotationParser)
            .fromType(PublishArtifact.class, publishArtifactNotationParser)
            .parser(mavenArtifactMapNotationParser)
            .converter(fileNotationParser);

    return parserBuilder.toComposite();
}
 
Example #4
Source File: BasePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void configureArchiveDefaults(final Project project, final BasePluginConvention pluginConvention) {
    project.getTasks().withType(AbstractArchiveTask.class, new Action<AbstractArchiveTask>() {
        public void execute(AbstractArchiveTask task) {
            ConventionMapping taskConventionMapping = task.getConventionMapping();

            Callable<File> destinationDir;
            if (task instanceof Jar) {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getLibsDir();
                    }
                };
            } else {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getDistsDir();
                    }
                };
            }
            taskConventionMapping.map("destinationDir", destinationDir);

            taskConventionMapping.map("version", new Callable<String>() {
                public String call() throws Exception {
                    return project.getVersion() == Project.DEFAULT_VERSION ? null : project.getVersion().toString();
                }
            });

            taskConventionMapping.map("baseName", new Callable<String>() {
                public String call() throws Exception {
                    return pluginConvention.getArchivesBaseName();
                }
            });
        }
    });
}
 
Example #5
Source File: IvyArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected IvyArtifact parseType(AbstractArchiveTask archiveTask) {
    DefaultIvyArtifact ivyArtifact = createDefaultIvyArtifact(
            archiveTask.getArchivePath(), archiveTask.getExtension(), archiveTask.getExtension(), archiveTask.getClassifier());
    ivyArtifact.builtBy(archiveTask);
    return ivyArtifact;
}
 
Example #6
Source File: MavenArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected MavenArtifact parseType(AbstractArchiveTask archiveTask) {
    DefaultMavenArtifact artifact = instantiator.newInstance(
            DefaultMavenArtifact.class,
            archiveTask.getArchivePath(), archiveTask.getExtension(), archiveTask.getClassifier());
    artifact.builtBy(archiveTask);
    return artifact;
}
 
Example #7
Source File: BasePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void configureArchiveDefaults(final Project project, final BasePluginConvention pluginConvention) {
    project.getTasks().withType(AbstractArchiveTask.class, new Action<AbstractArchiveTask>() {
        public void execute(AbstractArchiveTask task) {
            ConventionMapping taskConventionMapping = task.getConventionMapping();

            Callable<File> destinationDir;
            if (task instanceof Jar) {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getLibsDir();
                    }
                };
            } else {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getDistsDir();
                    }
                };
            }
            taskConventionMapping.map("destinationDir", destinationDir);

            taskConventionMapping.map("version", new Callable<String>() {
                public String call() throws Exception {
                    return project.getVersion() == Project.DEFAULT_VERSION ? null : project.getVersion().toString();
                }
            });

            taskConventionMapping.map("baseName", new Callable<String>() {
                public String call() throws Exception {
                    return pluginConvention.getArchivesBaseName();
                }
            });
        }
    });
}
 
Example #8
Source File: IvyArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected IvyArtifact parseType(AbstractArchiveTask archiveTask) {
    DefaultIvyArtifact ivyArtifact = createDefaultIvyArtifact(
            archiveTask.getArchivePath(), archiveTask.getExtension(), archiveTask.getExtension(), archiveTask.getClassifier());
    ivyArtifact.builtBy(archiveTask);
    return ivyArtifact;
}
 
Example #9
Source File: MavenArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void convert(AbstractArchiveTask archiveTask, NotationConvertResult<? super MavenArtifact> result) throws TypeConversionException {
    DefaultMavenArtifact artifact = instantiator.newInstance(
            DefaultMavenArtifact.class,
            archiveTask.getArchivePath(), archiveTask.getExtension(), archiveTask.getClassifier());
    artifact.builtBy(archiveTask);
    result.converted(artifact);
}
 
Example #10
Source File: SourceContextPlugin.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
private void configureArchiveTask(AbstractArchiveTask archiveTask) {
  if (archiveTask == null) {
    return;
  }
  archiveTask.dependsOn("_createSourceContext");
  archiveTask.from(extension.getOutputDirectory(), copySpec -> copySpec.into("WEB-INF/classes"));
}
 
Example #11
Source File: BasePlugin.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private void configureArchiveDefaults(final Project project, final BasePluginConvention pluginConvention) {
    project.getTasks().withType(AbstractArchiveTask.class, new Action<AbstractArchiveTask>() {
        public void execute(AbstractArchiveTask task) {
            ConventionMapping taskConventionMapping = task.getConventionMapping();

            Callable<File> destinationDir;
            if (task instanceof Jar) {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getLibsDir();
                    }
                };
            } else {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getDistsDir();
                    }
                };
            }
            taskConventionMapping.map("destinationDir", destinationDir);

            taskConventionMapping.map("version", new Callable<String>() {
                public String call() throws Exception {
                    return project.getVersion() == Project.DEFAULT_VERSION ? null : project.getVersion().toString();
                }
            });

            taskConventionMapping.map("baseName", new Callable<String>() {
                public String call() throws Exception {
                    return pluginConvention.getArchivesBaseName();
                }
            });
        }
    });
}
 
Example #12
Source File: BasePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void configureArchiveDefaults(final Project project, final BasePluginConvention pluginConvention) {
    project.getTasks().withType(AbstractArchiveTask.class, new Action<AbstractArchiveTask>() {
        public void execute(AbstractArchiveTask task) {
            ConventionMapping taskConventionMapping = task.getConventionMapping();

            Callable<File> destinationDir;
            if (task instanceof Jar) {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getLibsDir();
                    }
                };
            } else {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getDistsDir();
                    }
                };
            }
            taskConventionMapping.map("destinationDir", destinationDir);

            taskConventionMapping.map("version", new Callable<String>() {
                public String call() throws Exception {
                    return project.getVersion() == Project.DEFAULT_VERSION ? null : project.getVersion().toString();
                }
            });

            taskConventionMapping.map("baseName", new Callable<String>() {
                public String call() throws Exception {
                    return pluginConvention.getArchivesBaseName();
                }
            });
        }
    });
}
 
Example #13
Source File: IvyArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected IvyArtifact parseType(AbstractArchiveTask archiveTask) {
    DefaultIvyArtifact ivyArtifact = createDefaultIvyArtifact(
            archiveTask.getArchivePath(), archiveTask.getExtension(), archiveTask.getExtension(), archiveTask.getClassifier());
    ivyArtifact.builtBy(archiveTask);
    return ivyArtifact;
}
 
Example #14
Source File: MavenArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void convert(AbstractArchiveTask archiveTask, NotationConvertResult<? super MavenArtifact> result) throws TypeConversionException {
    DefaultMavenArtifact artifact = instantiator.newInstance(
            DefaultMavenArtifact.class,
            archiveTask.getArchivePath(), archiveTask.getExtension(), archiveTask.getClassifier());
    artifact.builtBy(archiveTask);
    result.converted(artifact);
}
 
Example #15
Source File: MavenArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected MavenArtifact parseType(AbstractArchiveTask archiveTask) {
    DefaultMavenArtifact artifact = instantiator.newInstance(
            DefaultMavenArtifact.class,
            archiveTask.getArchivePath(), archiveTask.getExtension(), archiveTask.getClassifier());
    artifact.builtBy(archiveTask);
    return artifact;
}
 
Example #16
Source File: BasePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void configureArchiveDefaults(final Project project, final BasePluginConvention pluginConvention) {
    project.getTasks().withType(AbstractArchiveTask.class, new Action<AbstractArchiveTask>() {
        public void execute(AbstractArchiveTask task) {
            ConventionMapping taskConventionMapping = task.getConventionMapping();

            Callable<File> destinationDir;
            if (task instanceof Jar) {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getLibsDir();
                    }
                };
            } else {
                destinationDir = new Callable<File>() {
                    public File call() throws Exception {
                        return pluginConvention.getDistsDir();
                    }
                };
            }
            taskConventionMapping.map("destinationDir", destinationDir);

            taskConventionMapping.map("version", new Callable<String>() {
                public String call() throws Exception {
                    return project.getVersion() == Project.DEFAULT_VERSION ? null : project.getVersion().toString();
                }
            });

            taskConventionMapping.map("baseName", new Callable<String>() {
                public String call() throws Exception {
                    return pluginConvention.getArchivesBaseName();
                }
            });
        }
    });
}
 
Example #17
Source File: IvyArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected IvyArtifact parseType(AbstractArchiveTask archiveTask) {
    DefaultIvyArtifact ivyArtifact = createDefaultIvyArtifact(
            archiveTask.getArchivePath(), archiveTask.getExtension(), archiveTask.getExtension(), archiveTask.getClassifier());
    ivyArtifact.builtBy(archiveTask);
    return ivyArtifact;
}
 
Example #18
Source File: PublishArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected PublishArtifact parseType(AbstractArchiveTask notation) {
    return instantiator.newInstance(ArchivePublishArtifact.class, notation);
}
 
Example #19
Source File: ArchivePublishArtifact.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AbstractArchiveTask getArchiveTask() {
    return archiveTask;
}
 
Example #20
Source File: ArchivePublishArtifact.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ArchivePublishArtifact(AbstractArchiveTask archiveTask) {
    super(archiveTask);
    this.archiveTask = archiveTask;
}
 
Example #21
Source File: PublishArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArchiveTaskNotationParser() {
    super(AbstractArchiveTask.class);
}
 
Example #22
Source File: IvyArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArchiveTaskNotationParser() {
    super(AbstractArchiveTask.class);
}
 
Example #23
Source File: PublishArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected PublishArtifact parseType(AbstractArchiveTask notation) {
    return instantiator.newInstance(ArchivePublishArtifact.class, notation);
}
 
Example #24
Source File: PublishArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArchiveTaskNotationParser() {
    super(AbstractArchiveTask.class);
}
 
Example #25
Source File: PublishArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
protected PublishArtifact parseType(AbstractArchiveTask notation) {
    return instantiator.newInstance(ArchivePublishArtifact.class, notation);
}
 
Example #26
Source File: MavenArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArchiveTaskNotationParser() {
    super(AbstractArchiveTask.class);
}
 
Example #27
Source File: IvyArtifactNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArchiveTaskNotationParser() {
    super(AbstractArchiveTask.class);
}
 
Example #28
Source File: ArchivePublishArtifact.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AbstractArchiveTask getArchiveTask() {
    return archiveTask;
}
 
Example #29
Source File: ArchivePublishArtifact.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ArchivePublishArtifact(AbstractArchiveTask archiveTask) {
    super(archiveTask);
    this.archiveTask = archiveTask;
}
 
Example #30
Source File: IvyArtifactNotationParserFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ArchiveTaskNotationParser() {
    super(AbstractArchiveTask.class);
}