-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a12a457
Showing
21 changed files
with
2,994 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
# Created by https://www.toptal.com/developers/gitignore/api/gradle | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=gradle | ||
|
||
### Gradle ### | ||
.gradle | ||
**/build/ | ||
!src/**/build/ | ||
|
||
# Ignore Gradle GUI config | ||
gradle-app.setting | ||
|
||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||
!gradle-wrapper.jar | ||
|
||
# Avoid ignore Gradle wrappper properties | ||
!gradle-wrapper.properties | ||
|
||
# Cache of project | ||
.gradletasknamecache | ||
|
||
# Eclipse Gradle plugin generated files | ||
# Eclipse Core | ||
.project | ||
# JDT-specific (Eclipse Java Development Tools) | ||
.classpath | ||
|
||
### Gradle Patch ### | ||
# Java heap dump | ||
*.hprof | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/gradle | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all | ||
|
||
### Intellij+all ### | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# AWS User-specific | ||
.idea/**/aws.xml | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# SonarLint plugin | ||
.idea/sonarlint/ | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
||
### Intellij+all Patch ### | ||
# Ignore everything but code style settings and run configurations | ||
# that are supposed to be shared within teams. | ||
|
||
.idea/* | ||
|
||
!.idea/codeStyles | ||
!.idea/runConfigurations | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/intellij+all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023-2024 Lionel Briand | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
## TT `{{ tag }} template` | ||
|
||
A quick and easy to use library for those, who only want named {{ tag }} replacement in a string. | ||
|
||
For a more advanced template processor, please look at my mustache templating | ||
engine [L-Briand/KTM](https://github.com/L-Briand/KTM). | ||
|
||
Default rendering: | ||
|
||
```kotlin | ||
val render = TT("Hello {{ name }}!", "name" to "John") | ||
assert("Hello John!" == render) | ||
|
||
val data = mapOf("name" to "John", "ag e" to 33) | ||
assert("John, 33 y/o" == TT("{{ name }}, {{ ag e }} y/o", data)) | ||
|
||
data class User(val name: String) | ||
assert("User(name=John)" == TT("{{ class }}", "class" to User("John"))) | ||
``` | ||
|
||
Custom delimiters: | ||
|
||
```kotlin | ||
val format = TT(start = "%%", stop = "%") | ||
val render = format("Hello %% name %!", "name" to "John") | ||
assert("Hello John!" == render) | ||
``` | ||
|
||
Escape HTML: | ||
|
||
```kotlin | ||
val format = TT(HtmlEscape) | ||
val render = format("{{ script }}", "script" to "<script>alert('Hello')</script>") | ||
assert("<script>alert('Hello')</script>", render) | ||
``` | ||
|
||
## Import from maven | ||
|
||
### Multiplatform | ||
|
||
```kotlin | ||
repositories { | ||
mavenCentral() | ||
} | ||
val commonMain by getting { | ||
dependencies { | ||
implementation("net.orandja.kt:tt:1.0.0") | ||
} | ||
} | ||
``` | ||
|
||
### Jvm | ||
|
||
```kotlin | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
implementation("net.orandja.kt:tt:1.0.0") | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl | ||
|
||
plugins { | ||
kotlin("multiplatform") version "1.9.22" | ||
kotlin("plugin.serialization") version "1.9.22" | ||
id("org.jetbrains.dokka") version "1.9.10" | ||
id("maven-publish") | ||
id("signing") | ||
} | ||
|
||
fun findProperty(name: String): String? = if (hasProperty(name)) property(name) as String else System.getenv(name) | ||
fun findFilledProperty(name: String): String? = findProperty(name)?.ifBlank { null } | ||
|
||
group = findProperty("group")!! | ||
version = findProperty("version")!! | ||
|
||
val ossrhUsername = findFilledProperty("osshr.username") | ||
val ossrhPassword = findFilledProperty("osshr.password") | ||
val ossrhMavenEnabled = ossrhUsername != null && ossrhPassword != null | ||
val isSigningEnabled = findFilledProperty("signing.keyId") != null && | ||
findFilledProperty("signing.password") != null && | ||
findFilledProperty("signing.secretKeyRingFile") != null | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
kotlin { | ||
jvm { | ||
compilations.getByName("main") { | ||
kotlinOptions { jvmTarget = "1.8" } | ||
} | ||
jvmToolchain(8) | ||
withJava() | ||
withSourcesJar(true) | ||
testRuns.named("test") { | ||
executionTask.configure { useJUnitPlatform() } | ||
} | ||
} | ||
|
||
// web | ||
|
||
js { | ||
browser() | ||
nodejs() | ||
} | ||
|
||
@OptIn(ExperimentalWasmDsl::class) | ||
wasmJs { d8() } | ||
// wasmWasi { nodejs() } | ||
|
||
// https://kotlinlang.org/docs/native-target-support.html | ||
|
||
// Tier1 | ||
|
||
macosX64() | ||
macosArm64() | ||
iosSimulatorArm64() | ||
iosX64() | ||
|
||
// Tier2 | ||
|
||
linuxX64() | ||
linuxArm64() | ||
watchosSimulatorArm64() | ||
watchosX64() | ||
watchosArm32() | ||
watchosArm64() | ||
tvosSimulatorArm64() | ||
tvosX64() | ||
tvosArm64() | ||
iosArm64() | ||
|
||
// Tier3 | ||
androidNativeArm32() | ||
androidNativeArm64() | ||
androidNativeX86() | ||
androidNativeX64() | ||
mingwX64() | ||
watchosDeviceArm64() | ||
|
||
sourceSets { | ||
getByName("commonTest") { | ||
dependencies { | ||
implementation(kotlin("test")) | ||
} | ||
} | ||
} | ||
} | ||
|
||
publishing { | ||
publications.withType<MavenPublication> { | ||
val publicationName = this@withType.name | ||
val javadocJar = tasks.register("${publicationName}JavadocJar", Jar::class) { | ||
archiveClassifier.set("javadoc") | ||
archiveBaseName.set("${archiveBaseName.get()}-${publicationName}") | ||
} | ||
artifact(javadocJar) | ||
pom { | ||
name.set(findProperty("POM_NAME")!!) | ||
description.set(findProperty("POM_DESCRIPTION")!!) | ||
url.set(findProperty("POM_URL")!!) | ||
licenses { | ||
license { | ||
name.set(findProperty("POM_LICENSE_NAME")!!) | ||
url.set(findProperty("POM_LICENSE_URL")!!) | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set(findProperty("POM_DEVELOPER_LBRIAND_ID")!!) | ||
name.set(findProperty("POM_DEVELOPER_LBRIAND_NAME")!!) | ||
email.set(findProperty("POM_DEVELOPER_LBRIAND_EMAIL")!!) | ||
} | ||
} | ||
scm { | ||
connection.set(findProperty("POM_SCM_URL")!!) | ||
developerConnection.set(findProperty("POM_SCM_CONNECTION")!!) | ||
url.set(findProperty("POM_SCM_DEV_CONNECTION")!!) | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
if (ossrhMavenEnabled) { | ||
maven { | ||
name = "sonatype" | ||
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
credentials { | ||
username = ossrhUsername | ||
password = ossrhPassword | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (isSigningEnabled) { | ||
signing { | ||
sign(publishing.publications) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
kotlin.code.style=official | ||
kotlin.js.compiler=ir | ||
# Global information | ||
group=net.orandja.tt | ||
version=1.0.0 | ||
# Artifact related | ||
POM_NAME=TT | ||
POM_DESCRIPTION=A quick and simple {{ tag }} template processor in kotlin | ||
POM_URL=https://github.com/L-Briand/either | ||
POM_LICENSE_NAME=MIT | ||
POM_LICENSE_URL=https://spdx.org/licenses/MIT.html | ||
POM_DEVELOPER_LBRIAND_ID=lbriand | ||
POM_DEVELOPER_LBRIAND_NAME=Lionel Briand | ||
POM_DEVELOPER_LBRIAND_EMAIL=lionel.briand@orandja.fr | ||
POM_SCM_URL=https://github.com/L-Briand/either | ||
POM_SCM_CONNECTION=scm:git:git://github.com/L-Briand/either | ||
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/L-Briand/either.git |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.