Hi, I have a proposal to improve the portability of Gradle build scripts.
BACKGROUND: Currently, Gradle reads a build script file using a system default file encoding. (`return IOUtils.toString(inputStream)`) - Code: https://github.com/nobuoka/gradle/blob/2d826b213293995f60ca80891094ca201acd8cf7/subprojects/core/src/main/groovy/org/gradle/api/internal/resource/UriResource.java#L60 - Document of `IOUtils.toString`: http://commons.apache.org/proper/commons-io/javadocs/api-2.4/org/apache/commons/io/IOUtils.html#toString%28java.io.InputStream%29 The fact that a build script file is read using system default file encoding decreases portability of a Gradle build script. For example, in case that there is a project that has Gradle build script written in UTF-8 encoding, the project will be built successfully on a Linux system (default file encoding is UTF-8), but will not be built successfully on a Windows system (default file encoding is not UTF-8). In the past, this issue was topic on Gradle Forums. - http://forums.gradle.org/gradle/topics/is_there_a_way_to_tell_gradle_to_read_gradle_build_scripts_using_a_specified_encoding Written on the topic, the workaround to avoid this problem is set `-Dfile.encoding=UTF-8` in the `GRADLE_OPTS` env var. However, setting `-Dfile.encoding=UTF-8' has a side effect (for instance, the encoding of console output may be chenged), which won't be wanted. Therefore, the other way to set an encoding of a Gradle build script is needed. PROPOSAL: I propose that we add new property `buildFileEncoding` to `ProjectDescriptor` class, and let Gradle read a build script file with an encoding which is set on that property. I wrote such a code, please see: - https://github.com/nobuoka/gradle/compare/feature;build_file_encoding;proposal (it has no test.) If this change is applyed, we will be able to set an encoding of a Gradle build script in settings.gradle file: === example // settings.gradle rootProject.buildFileName = "otherName.gradle" // we can set a name of a build file rootProject.buildFileEncoding = "UTF-8" // we will be able to set a encoding of a build file === Thanks, -- NOBUOKA Yu, https://github.com/nobuoka --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email