本文整理了Java中org.gradle.api.artifacts.Configuration.getSingleFile()
方法的一些代码示例,展示了Configuration.getSingleFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getSingleFile()
方法的具体详情如下:
包路径:org.gradle.api.artifacts.Configuration
类名称:Configuration
方法名:getSingleFile
暂无
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-css-builder
@Override
public File call() throws Exception {
return portalCommonCSSConfiguration.getSingleFile();
}
代码示例来源:origin: com.android.tools.build/gradle-core
@Nullable
private File computeMappingFile() {
if (testedMappingFile != null && testedMappingFile.isFile()) {
return testedMappingFile;
} else if (testMappingConfiguration != null && testMappingConfiguration.getSingleFile().isFile()) {
return testMappingConfiguration.getSingleFile();
}
return null;
}
}
代码示例来源:origin: com.android.tools.build/gradle-core
private List<FilterDataPersistence.Record> loadMetadata() {
File metadataFile = testedMetadata.getSingleFile();
FilterDataPersistence persistence = new FilterDataPersistence();
List<FilterDataPersistence.Record> filterDatas;
try {
return persistence.load(new FileReader(metadataFile));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.amazon.device.tools.build/gradle-core
private List<FilterDataPersistence.Record> loadMetadata() {
File metadataFile = testedMetadata.getSingleFile();
FilterDataPersistence persistence = new FilterDataPersistence();
List<FilterDataPersistence.Record> filterDatas;
try {
return persistence.load(new FileReader(metadataFile));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.amazon.device.tools.build/gradle-core
@Override
@TaskAction
public void proguard() throws ParseException, IOException {
if (logger.isEnabled(LogLevel.INFO)) {
logger.info("test module mapping file " + mappingConfiguration.getSingleFile());
for (Object file : variantConfiguration.getPackagedJars()) {
logger.info("test module proguard input " + file);
}
for (Object file : variantConfiguration.getProvidedOnlyJars()) {
logger.info("test module proguard library " + file);
}
}
if (mappingConfiguration.getSingleFile().isFile()) {
applymapping(mappingConfiguration.getSingleFile());
}
super.proguard();
}
}
代码示例来源:origin: com.android.tools.build/gradle-core
@Override
@TaskAction
public void proguard() throws ParseException, IOException {
if (logger.isEnabled(LogLevel.INFO)) {
logger.info("test module mapping file " + mappingConfiguration.getSingleFile());
for (Object file : variantConfiguration.getAllPackagedJars()) {
logger.info("test module proguard input " + file);
}
for (Object file : variantConfiguration.getProvidedOnlyJars()) {
logger.info("test module proguard library " + file);
}
}
if (mappingConfiguration.getSingleFile().isFile()) {
applymapping(mappingConfiguration.getSingleFile());
}
super.proguard();
}
}
代码示例来源:origin: gradle.plugin.org.wildfly.build/wildfly-gradle-tools
@Override
public File getArtifactFile(Artifact artifact) {
final Dependency dependency = asGradleDependency( artifact );
final DependencyAdaptor da = new DependencyAdaptor( artifact );
final Optional<File> local = attemptLocalResolution( da );
if ( local.isPresent() ) {
return local.get();
}
else {
return createTemporaryConfiguration( dependency, artifact.toString() ).getSingleFile();
}
}
代码示例来源:origin: linkedin/pygradle
if (!Paths.get(project.getProjectDir().getAbsolutePath(), "resource").toFile().exists()) {
project.getLogger().lifecycle("Making the Symlink: {}{}resource --> {}",
project.getProjectDir(), File.separatorChar, String.valueOf(resourceConf.getSingleFile()));
FileSystemUtils.makeSymLinkUnchecked(resourceConf.getSingleFile(), new File(project.getProjectDir(), "resource"));
代码示例来源:origin: gradle.plugin.com.lazan/gradle-maven-transform
@Override
public ModelSource resolveModel(String groupId, String artifactId, String version) throws UnresolvableModelException {
String configName = String.format("pomTransform%s", UUID.randomUUID());
Configuration config = getProject().getConfigurations().create(configName);
config.setTransitive(false);
String depNotation = String.format("%s:%s:%s@pom", groupId, artifactId, version);
org.gradle.api.artifacts.Dependency dependency = getProject().getDependencies().create(depNotation);
config.getDependencies().add(dependency);
File pomXml = config.getSingleFile();
return new ModelSource() {
@Override
public InputStream getInputStream() throws IOException {
return new FileInputStream(pomXml);
}
@Override
public String getLocation() {
return pomXml.getAbsolutePath();
}
};
}
代码示例来源:origin: gradle.plugin.com.linkedin.pygradle/pygradle-plugin
if (!Paths.get(project.getProjectDir().getAbsolutePath(), "resource").toFile().exists()) {
project.getLogger().lifecycle("Making the Symlink: {}{}resource --> {}",
project.getProjectDir(), File.separatorChar, String.valueOf(resourceConf.getSingleFile()));
FileSystemUtils.makeSymLinkUnchecked(resourceConf.getSingleFile(), new File(project.getProjectDir(), "resource"));
代码示例来源:origin: gradle.plugin.com.palantir.python/gradle-miniconda-plugin
@Override
public void execute(Project project) {
MinicondaExtension miniconda = project.getExtensions().getByType(MinicondaExtension.class);
miniconda.validate();
addMinicondaInstallerDependency(project, miniconda);
bootstrapPython.configureAfterEvaluate(miniconda, configuration.getSingleFile(), os);
configureRootCondaEnv.configureAfterEvaluate(miniconda);
setupPython.configureAfterEvaluate(miniconda);
setupCondaBuild.configureAfterEvaluate(miniconda);
condaBuildCheck.configureAfterEvaluate(miniconda);
condaBuild.configureAfterEvaluate(miniconda);
}
代码示例来源:origin: palantir/gradle-baseline
@Override
public void execute(Task task) {
if (configuration.getFiles().size() != 1) {
throw new IllegalArgumentException("Expected to find exactly one config dependency in the "
+ "'baseline' configuration, found: " + configuration.getFiles());
}
rootProject.copy(copySpec -> {
copySpec.from(rootProject.zipTree(configuration.getSingleFile()));
copySpec.into(BaselineConfig.this.getConfigDir());
copySpec.exclude("**/scalastyle_config.xml");
copySpec.setIncludeEmptyDirs(false);
});
if (rootProject
.getAllprojects()
.stream()
.anyMatch(p -> p.getPluginManager().hasPlugin("scala") && p
.getPluginManager()
.hasPlugin("com.palantir.baseline-scalastyle"))) {
// Matches intellij scala plugin settings per
// https://github.com/JetBrains/intellij-scala/blob/baaa7c1dabe5222c4bca7c4dd8d80890ad2a8c6b/scala/scala-impl/src/org/jetbrains/plugins/scala/codeInspection/scalastyle/ScalastyleCodeInspection.scala#L19
rootProject.copy(copySpec -> {
copySpec.from(rootProject
.zipTree(configuration.getSingleFile())
.filter(file -> file.getName().equals("scalastyle_config.xml")));
copySpec.into(rootProject.getRootDir().toPath().resolve("project"));
copySpec.setIncludeEmptyDirs(false);
});
}
}
}
代码示例来源:origin: io.freefair.gradle/war-plugin
private void configureOverlay(WarOverlay overlay, ExternalDependency dependency) {
War warTask = overlay.getWarTask();
String capitalizedWarTaskName = StringGroovyMethods.capitalize((CharSequence) warTask.getName());
String capitalizedOverlayName = StringGroovyMethods.capitalize((CharSequence) overlay.getName());
dependency.setTransitive(false);
Configuration configuration = project.getConfigurations().create(overlay.getConfigurationName());
configuration.setDescription(String.format("Contents of the overlay '%s' for the task '%s'.", overlay.getName(), warTask.getName()));
configuration.getDependencies().add(dependency);
File destinationDir = new File(project.getBuildDir(), String.format("overlays/%s/%s", warTask.getName(), overlay.getName()));
Action<CopySpec> extractOverlay = copySpec -> {
copySpec.into(destinationDir);
copySpec.from((Callable<FileTree>) () -> project.zipTree(configuration.getSingleFile()));
};
Sync extractOverlayTask = project.getTasks().create(String.format("extract%s%sOverlay", capitalizedOverlayName, capitalizedWarTaskName), Sync.class, extractOverlay);
overlay.getWarCopySpec().from(extractOverlayTask);
if (overlay.isEnableCompilation()) {
if (!destinationDir.exists() || isEmpty(destinationDir)) {
project.sync(extractOverlay);
}
project.getTasks().getByName(CLEAN_TASK_NAME).finalizedBy(extractOverlayTask);
ConfigurableFileCollection classes = project.files(new File(destinationDir, "WEB-INF/classes"))
.builtBy(extractOverlayTask);
project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);
project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);
FileTree libs = project.files(extractOverlayTask).builtBy(extractOverlayTask).getAsFileTree()
.matching(patternFilterable -> patternFilterable.include("WEB-INF/lib/**"));
project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
}
}
内容来源于网络,如有侵权,请联系作者删除!