Build: Map camel case configuration names to dashed directory names. (So when we will have "javaxServlet", that will be mapped to "freemarker-javax-servlet", rather than to "freemarker-javaxServlet".)
diff --git a/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt
index 6683f0a..dfdd9b3 100644
--- a/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt
+++ b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt
@@ -19,7 +19,6 @@
package freemarker.build
-import java.util.concurrent.atomic.AtomicBoolean
import org.gradle.api.NamedDomainObjectProvider
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
@@ -42,6 +41,7 @@
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.language.jvm.tasks.ProcessResources
import org.gradle.testing.base.TestingExtension
+import java.util.concurrent.atomic.AtomicBoolean
private const val TEST_UTILS_SOURCE_SET_NAME = "test-utils"
@@ -94,7 +94,7 @@
val compilerVersion: JavaLanguageVersion
) {
val main = sourceSetName == SourceSet.MAIN_SOURCE_SET_NAME
- val baseDirName = if (main) "core" else sourceSetName
+ val baseDirName = if (main) "core" else sourceSetName.camelCaseToDashed()
val sourceSet = context.sourceSets.maybeCreate(sourceSetName)
diff --git a/buildSrc/src/main/kotlin/freemarker/build/FreemarkerStringExtensions.kt b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerStringExtensions.kt
new file mode 100644
index 0000000..b290760
--- /dev/null
+++ b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerStringExtensions.kt
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 freemarker.build
+
+private val CAMEL_HUMP = "(?<=[A-Za-z0-9])[A-Z]".toRegex()
+
+fun String.camelCaseToDashed(): String =
+ replace(CAMEL_HUMP) { "-" + it.value.replaceFirstChar(Char::lowercaseChar) }