mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-157986 Gradle: filtering in processResources using org.apache.tools.ant.filters.EscapeUnicode filter not working
This commit is contained in:
+18
@@ -215,6 +215,24 @@ public class GradleResourceFilteringTest extends GradleCompilingTestCase {
|
||||
assertCopied("build/resources/main/dir/file.txt", "some text myPropValue another text");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEscapeUnicodeFilter() throws Exception {
|
||||
createProjectSubFile(
|
||||
"src/main/resources/dir/file.txt", "some text テキスト");
|
||||
importProject(
|
||||
"apply plugin: 'java'\n" +
|
||||
"\n" +
|
||||
"import org.apache.tools.ant.filters.*\n" +
|
||||
"processResources {\n" +
|
||||
" filter (EscapeUnicode)\n" +
|
||||
"}"
|
||||
);
|
||||
assertModules("project", "project_main", "project_test");
|
||||
compileModules("project_main");
|
||||
|
||||
assertCopied("build/resources/main/dir/file.txt", "some text \\u30c6\\u30ad\\u30b9\\u30c8");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFiltersChain() throws Exception {
|
||||
createProjectSubFile(
|
||||
|
||||
+13
-10
@@ -463,23 +463,26 @@ class ExternalProjectBuilderImpl implements ModelBuilderService {
|
||||
|
||||
if(copyActions) {
|
||||
copyActions.each { Action<? super FileCopyDetails> action ->
|
||||
if (action.hasProperty('val$filterType') && action.hasProperty('val$properties')) {
|
||||
if (action.hasProperty('val$filterType')) {
|
||||
//noinspection GrUnresolvedAccess
|
||||
def filterType = (action?.val$filterType as Class).name
|
||||
def filter = [filterType: filterType] as DefaultExternalFilter
|
||||
//noinspection GrUnresolvedAccess
|
||||
def props = action?.val$properties
|
||||
if (props) {
|
||||
if ('org.apache.tools.ant.filters.ExpandProperties'.equals(filterType) && props['project']) {
|
||||
if (props['project']) filter.propertiesAsJsonMap = new GsonBuilder().create().toJson(props['project'].properties);
|
||||
}
|
||||
else {
|
||||
filter.propertiesAsJsonMap = new GsonBuilder().create().toJson(props);
|
||||
|
||||
if(action.hasProperty('val$properties')) {
|
||||
//noinspection GrUnresolvedAccess
|
||||
def props = action?.val$properties
|
||||
if (props) {
|
||||
if ('org.apache.tools.ant.filters.ExpandProperties' == filterType && props['project']) {
|
||||
if (props['project']) filter.propertiesAsJsonMap = new GsonBuilder().create().toJson(props['project'].properties);
|
||||
}
|
||||
else {
|
||||
filter.propertiesAsJsonMap = new GsonBuilder().create().toJson(props);
|
||||
}
|
||||
}
|
||||
}
|
||||
filterReaders << filter
|
||||
}
|
||||
else if (action.class.simpleName.equals('RenamingCopyAction') && action.hasProperty('transformer')) {
|
||||
else if (action.class.simpleName == 'RenamingCopyAction' && action.hasProperty('transformer')) {
|
||||
//noinspection GrUnresolvedAccess
|
||||
if (action.transformer.hasProperty('matcher') && action?.transformer?.hasProperty('replacement')) {
|
||||
//noinspection GrUnresolvedAccess
|
||||
|
||||
Reference in New Issue
Block a user