org.gradle.api.resources.TextResource Java Examples
The following examples show how to use
org.gradle.api.resources.TextResource.
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: NoHttpCheckstylePlugin.java From nohttp with Apache License 2.0 | 4 votes |
private void createCheckstyleTaskForProject(Configuration configuration) { Logger logger = this.logger; Project project = this.project; NoHttpExtension extension = this.extension; Checkstyle checkstyleTask = project .getTasks().create("checkstyleNohttp", Checkstyle.class); checkstyleTask.setDescription("Checks for illegal uses of http://"); checkstyleTask.getReports().all(new Action<SingleFileReport>() { @Override public void execute(final SingleFileReport report) { String reportFileName = report.getDestination().getName(); report.setDestination(project.getExtensions().getByType(ReportingExtension.class) .getBaseDirectory() .dir(checkstyleTask.getName()) .map(reportDir -> reportDir.file(reportFileName).getAsFile()) ); } }); ConventionMapping taskMapping = checkstyleTask.getConventionMapping(); taskMapping.map("classpath", new Callable<FileCollection>() { @Override public FileCollection call() throws Exception { return configuration; } }); taskMapping.map("source", new Callable<FileTree>() { @Override public FileTree call() throws Exception { return extension.getSource(); } }); boolean configureConfigLoc = configureConfigDirectory(checkstyleTask); taskMapping.map("configProperties", new Callable<Map<String, Object>>() { @Override public Map<String, Object> call() throws Exception { Map<String, Object> configProperties = new HashMap<>(); File allowlistFile = extension.getAllowlistFile(); if (allowlistFile != null) { logger.debug("Using allowlist at {}", allowlistFile); String allowlistPath = project.relativePath(allowlistFile); configProperties.put("nohttp.checkstyle.allowlistFileName", allowlistPath); } if (configureConfigLoc) { configProperties.put("config_loc", project.relativePath(getConfigLocation())); } return configProperties; } }); taskMapping.map("config", new Callable<TextResource>() { @Override public TextResource call() throws Exception { File configLoc = getConfigLocation(); File defaultCheckstyleFile = new File(configLoc, "checkstyle.xml"); if (defaultCheckstyleFile.exists()) { logger.debug("Found default checkstyle configuration, so configuring checkstyleTask to use it"); return project.getResources().getText().fromFile(defaultCheckstyleFile); } logger.debug("No checkstyle configuration provided, so using the default."); URL resource = getClass().getResource( "/io/spring/nohttp/checkstyle/default-nohttp-checkstyle.xml"); return project.getResources().getText().fromUri(resource); } }); }
Example #2
Source File: DefaultTextResourceFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public TextResource fromString(String string) { return new StringBackedTextResource(tempFileProvider, string); }
Example #3
Source File: DefaultTextResourceFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public TextResource fromFile(Object file, String charset) { return new FileCollectionBackedTextResource(tempFileProvider, fileOperations.files(file), Charset.forName(charset)); }
Example #4
Source File: DefaultTextResourceFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public TextResource fromArchiveEntry(Object archive, String entryPath, String charset) { return new FileCollectionBackedArchiveTextResource(fileOperations, tempFileProvider, fileOperations.files(archive), entryPath, Charset.forName(charset)); }
Example #5
Source File: DefaultTextResourceFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public TextResource fromArchiveEntry(Object archive, String entryPath) { return fromArchiveEntry(archive, entryPath, Charset.defaultCharset().name()); }
Example #6
Source File: GoogleServicesTask.java From play-services-plugins with Apache License 2.0 | 4 votes |
@Input @Optional public TextResource getPackageNameXOR2() { return packageNameXOR2; }
Example #7
Source File: GoogleServicesTask.java From play-services-plugins with Apache License 2.0 | 4 votes |
public void setPackageNameXOR2(TextResource packageNameXOR2) { this.packageNameXOR2 = packageNameXOR2; }
Example #8
Source File: DefaultTextResourceFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public TextResource fromString(String string) { return new StringBackedTextResource(tempFileProvider, string); }
Example #9
Source File: DefaultTextResourceFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public TextResource fromFile(Object file, String charset) { return new FileCollectionBackedTextResource(tempFileProvider, fileOperations.files(file), Charset.forName(charset)); }
Example #10
Source File: DefaultTextResourceFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public TextResource fromArchiveEntry(Object archive, String entryPath, String charset) { return new FileCollectionBackedArchiveTextResource(fileOperations, tempFileProvider, fileOperations.files(archive), entryPath, Charset.forName(charset)); }
Example #11
Source File: DefaultTextResourceFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public TextResource fromArchiveEntry(Object archive, String entryPath) { return fromArchiveEntry(archive, entryPath, Charset.defaultCharset().name()); }
Example #12
Source File: DefaultTextResourceFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 2 votes |
public TextResource fromFile(Object file) { return fromFile(file, Charset.defaultCharset().name()); }
Example #13
Source File: DefaultTextResourceFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 2 votes |
public TextResource fromFile(Object file) { return fromFile(file, Charset.defaultCharset().name()); }