diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index bbed1970a186..dcbf7834bcb3 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -190,7 +190,6 @@ fun Project.applyGroovyProjectConventions() { jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED") jvmArgs("--illegal-access=deny") } - } val compileGroovy by tasks.existing(GroovyCompile::class) diff --git a/buildSrc/subprojects/build/build.gradle.kts b/buildSrc/subprojects/build/build.gradle.kts index 0d864e1a6d23..e60abe0eb4c8 100644 --- a/buildSrc/subprojects/build/build.gradle.kts +++ b/buildSrc/subprojects/build/build.gradle.kts @@ -1,8 +1,9 @@ dependencies { api("com.google.guava:guava:26.0-jre") api("org.asciidoctor:asciidoctor-gradle-plugin:1.5.9.2") - implementation("org.asciidoctor:asciidoctorj:1.5.8.1") + implementation(project(":buildPlatform")) + implementation("org.asciidoctor:asciidoctorj:1.5.8.1") implementation("commons-lang:commons-lang:2.6") implementation("org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.16") implementation("com.github.javaparser:javaparser-core") diff --git a/buildSrc/subprojects/build/src/main/groovy/org/gradle/build/ReproduciblePropertiesWriter.groovy b/buildSrc/subprojects/build/src/main/groovy/org/gradle/build/ReproduciblePropertiesWriter.groovy index f2cca732b8bb..2e6a89bda7ee 100644 --- a/buildSrc/subprojects/build/src/main/groovy/org/gradle/build/ReproduciblePropertiesWriter.groovy +++ b/buildSrc/subprojects/build/src/main/groovy/org/gradle/build/ReproduciblePropertiesWriter.groovy @@ -13,38 +13,37 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.gradle.build +import com.google.common.base.Charsets +import org.gradle.internal.util.PropertiesUtils + class ReproduciblePropertiesWriter { /** * Writes {@link Map} of data as {@link Properties} to a file, but without including the timestamp comment. + * + * See {@link PropertiesUtils#store(java.util.Properties, java.io.File)}. */ static void store(Map data, File file, String comment = null) { - def properties = new Properties() - data.each { key, value -> - properties.put(key, value == null ? null : value.toString()) - } - store(properties, file, comment) + store(propertiesFrom(data), file, comment) } /** * Writes {@link Properties} to a file, but without including the timestamp comment. + * + * See {@link PropertiesUtils#store(java.util.Properties, java.io.File)}. */ static void store(Properties properties, File file, String comment = null) { - def sw = new StringWriter() - properties.store(sw, null) - String systemLineSeparator = System.lineSeparator() - String lineSeparator = "\n" // Use LF to have the same result on Windows and on Linux - def content = sw.toString().split(systemLineSeparator).findAll { !it.startsWith("#") }.join(lineSeparator) - file.parentFile.mkdirs() - file.withWriter("8859_1") { BufferedWriter bw -> - if (comment) { - bw.write("# ${comment}") - bw.write(lineSeparator) + PropertiesUtils.store(properties, file, comment, Charsets.ISO_8859_1, "\n") + } + + private static Properties propertiesFrom(Map data) { + new Properties().with { + data.forEach { key, value -> + put(key, value ?: value.toString()) } - bw.write(content) + it } } } diff --git a/buildSrc/subprojects/build/src/test/groovy/org/gradle/build/ReproduciblePropertiesWriterTest.groovy b/buildSrc/subprojects/build/src/test/groovy/org/gradle/build/ReproduciblePropertiesWriterTest.groovy deleted file mode 100644 index 3f2c9ccf7107..000000000000 --- a/buildSrc/subprojects/build/src/test/groovy/org/gradle/build/ReproduciblePropertiesWriterTest.groovy +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.gradle.build - -import org.junit.Rule -import org.junit.rules.TemporaryFolder -import spock.lang.Specification - -class ReproduciblePropertiesWriterTest extends Specification { - @Rule - public final TemporaryFolder tempProjectDir = new TemporaryFolder() - - def "newlines are all the same"() { - def propertiesFile = tempProjectDir.newFile() - when: - ReproduciblePropertiesWriter.store([some: 'effect'], propertiesFile, "Oh my") - - then: - assert propertiesFile.text == '# Oh my\nsome=effect' - } -} diff --git a/subprojects/wrapper/src/integTest/groovy/org/gradle/integtests/WrapperGenerationIntegrationTest.groovy b/subprojects/wrapper/src/integTest/groovy/org/gradle/integtests/WrapperGenerationIntegrationTest.groovy index 9fa1eed53de0..5ff02bee7b4c 100644 --- a/subprojects/wrapper/src/integTest/groovy/org/gradle/integtests/WrapperGenerationIntegrationTest.groovy +++ b/subprojects/wrapper/src/integTest/groovy/org/gradle/integtests/WrapperGenerationIntegrationTest.groovy @@ -71,7 +71,7 @@ class WrapperGenerationIntegrationTest extends AbstractIntegrationSpec { executer.inDirectory(file("second")).withTasks("wrapper").run() then: "the checksum should be constant (unless there are code changes)" - sha256(file("first/gradle/wrapper/gradle-wrapper.jar")).asHexString() == "372ef28e56755b074af00b3d1e615efc695ae881fedce8eb398c583d534bdf4" + sha256(file("first/gradle/wrapper/gradle-wrapper.jar")).asHexString() == "7b9a14d31f0cfbc1a5587e0d77d8a0a9baa8f1db4382d64406d53a7a6a5e5e01" and: file("first/gradle/wrapper/gradle-wrapper.jar").md5Hash == file("second/gradle/wrapper/gradle-wrapper.jar").md5Hash