Use .dsl.cpp suffix for DSL C++ instead of _dsl.cpp.

This requires the GN processing to be slightly more complex, as GN has
no native support for more than one extension on a file.
Context: https://groups.google.com/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4

Change-Id: I630511fca9eb291f0e414481ef439f18a8e1b72f
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396197
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-04-14 09:35:24 -04:00 committed by Skia Commit-Bot
parent 4df814c2d6
commit 0a0a50ae97
5 changed files with 14 additions and 7 deletions

View File

@ -780,8 +780,15 @@ if (skia_compile_sksl_tests) {
src = resourcesDir + partialPath
dir = get_path_info(dst, "dir")
name = get_path_info(dst, "name")
ext = get_path_info(dst, "extension")
# We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
# Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
# For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
# For input path "file.cc", name will contain "file" and ext will contain ".cc".
nameTmp = get_path_info(dst, "name")
name = get_path_info(nameTmp, "name")
ext = get_path_info(nameTmp, "extension")
ext += get_path_info(dst, "extension")
response_file_contents += rebase_path([
src,
dir,
@ -814,7 +821,7 @@ if (skia_compile_sksl_tests) {
compile_sksl("dsl_fp_tests") {
sources = sksl_dsl_fp_tests_sources
outExtensions = [
"_dsl.cpp",
".dsl.cpp",
".h",
]
lang = "--dslfp"

View File

@ -82,7 +82,7 @@ for input, targetDir in pairwise(inputs):
worklist.write(settings + "\n\n")
elif lang == "--dslfp":
worklist.write(input + "\n")
worklist.write(target + "_dsl.cpp\n")
worklist.write(target + ".dsl.cpp\n")
worklist.write(settings + "\n\n")
worklist.write(input + "\n")
worklist.write(target + ".h\n")
@ -127,7 +127,7 @@ else:
# `### Compilation failed`, its sibling should be replaced by an empty file. This improves clarity
# during code review; a failure on either file means that success on the sibling is irrelevant.
if lang == "--fp" or lang == "--dslfp":
cppExtension = ("_dsl.cpp" if lang == "--dslfp" else ".cpp")
cppExtension = (".dsl.cpp" if lang == "--dslfp" else ".cpp")
hExtension = ".h"
for target in targets:

View File

@ -592,7 +592,7 @@ sksl_rte_error_tests = [
sksl_fp_tests_sources = sksl_fp_error_tests + sksl_fp_tests
# Tests in sksl_dsl_fp_tests_sources will be compiled with --settings on, and are expected to
# generate a _dsl.cpp and a .h output file.
# generate a .dsl.cpp and a .h output file.
sksl_dsl_fp_tests_sources = sksl_dsl_fp_tests
# Tests in sksl_glsl_tests_sources will be compiled with --settings on, and are expected to generate

View File

@ -379,7 +379,7 @@ ResultCode processCommand(std::vector<SkSL::String>& args) {
[&](SkSL::Compiler& compiler, SkSL::Program& program, SkSL::OutputStream& out) {
return compiler.toH(program, base_name(inputPath.c_str(), "Gr", ".fp"), out);
});
} else if (outputPath.endsWith("_dsl.cpp")) {
} else if (outputPath.endsWith(".dsl.cpp")) {
settings.fReplaceSettings = false;
settings.fPermitInvalidStaticTests = true;
return compileProgram(