Skip to content

Commit

Permalink
add recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
osoykan committed May 13, 2024
1 parent eb960f0 commit 3ca26ee
Show file tree
Hide file tree
Showing 62 changed files with 2,769 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build-recipes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Recipes
env:
PATH_RECIPES: 'recipes/**'

on:
push:
branches: [ main ]
paths:
- ${{ env.PATH_RECIPES }}
pull_request:
branches: [ main ]
paths:
- ${{ env.PATH_RECIPES }}
jobs:
build-and-test:
runs-on: ubuntu-latest
services:
docker:
image: docker:dind
options: --privileged
steps:
- name: Configure JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'

- name: Check out Git repository
uses: actions/checkout@v4

- name: Gradle Build and Test
uses: gradle/[email protected]
with:
arguments: --build-cache build test
30 changes: 30 additions & 0 deletions recipes/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
root = true

[*]
insert_final_newline = true
ktlint_standard_package-name = disabled
ktlint_standard_filename = disabled
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_string-template-indent = disabled
ktlint_standard_function-signature = disabled

[*.java]
indent_style = space
max_line_length = 140
indent_size = 2

[{*.kt,*.kts}]
indent_style = space
max_line_length = 140
indent_size = 2
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_continuation_indent_size = 2
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_name_count_to_use_star_import = 2
ij_kotlin_name_count_to_use_star_import_for_members = 2

[{**/test/**.kt,**/test-e2e/**.kt,**/test-int/**.kt}]
max_line_length = 240
ktlint_standard_no-consecutive-comments = disabled
9 changes: 9 additions & 0 deletions recipes/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

85 changes: 85 additions & 0 deletions recipes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
.DS_Store
/site
/.idea
.idea/shelf
/confluence/target
/dependencies/repo
/android.tests.dependencies
/dependencies/android.tests.dependencies
/dist
/local
/gh-pages
/ideaSDK
/clionSDK
/android-studio/sdk
out/
/tmp
/intellij
workspace.xml
*.versionsBackup
/idea/testData/debugger/tinyApp/classes*
/jps-plugin/testData/kannotator
/js/js.translator/testData/out/
/js/js.translator/testData/out-min/
/js/js.translator/testData/out-pir/
.gradle/
build/
!**/src/**/build
!**/test/**/build
*.iml
!**/testData/**/*.iml
.idea/remote-targets.xml
.idea/libraries/Gradle*.xml
.idea/libraries/Maven*.xml
.idea/artifacts/PILL_*.xml
.idea/artifacts/KotlinPlugin.xml
.idea/modules
.idea/runConfigurations/JPS_*.xml
.idea/runConfigurations/PILL_*.xml
.idea/runConfigurations/_FP_*.xml
.idea/runConfigurations/_MT_*.xml
.idea/libraries
.idea/modules.xml
.idea/gradle.xml
.idea/compiler.xml
.idea/inspectionProfiles/profiles_settings.xml
.idea/.name
.idea/artifacts/dist_auto_*
.idea/artifacts/dist.xml
.idea/artifacts/ideaPlugin.xml
.idea/artifacts/kotlinc.xml
.idea/artifacts/kotlin_compiler_jar.xml
.idea/artifacts/kotlin_plugin_jar.xml
.idea/artifacts/kotlin_jps_plugin_jar.xml
.idea/artifacts/kotlin_daemon_client_jar.xml
.idea/artifacts/kotlin_imports_dumper_compiler_plugin_jar.xml
.idea/artifacts/kotlin_main_kts_jar.xml
.idea/artifacts/kotlin_compiler_client_embeddable_jar.xml
.idea/artifacts/kotlin_reflect_jar.xml
.idea/artifacts/kotlin_stdlib_js_ir_*
.idea/artifacts/kotlin_test_js_ir_*
.idea/artifacts/kotlin_stdlib_wasm_*
.idea/artifacts/kotlinx_atomicfu_runtime_*
.idea/artifacts/kotlinx_cli_jvm_*
.idea/jarRepositories.xml
.idea/csv-plugin.xml
.idea/libraries-with-intellij-classes.xml
.idea/misc.xml
.idea/**
node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-js-runner/lib/
local.properties
buildSrcTmp/
distTmp/
outTmp/
/test.output
/kotlin-native/dist
kotlin-ide/
**/bin/**/*

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
87 changes: 87 additions & 0 deletions recipes/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
kotlin("jvm").version(libs.versions.kotlin)
alias(libs.plugins.spotless)
alias(libs.plugins.testLogger)
alias(libs.plugins.detekt)
idea
java
}

subprojects {
apply {
plugin(rootProject.libs.plugins.spotless.get().pluginId)
plugin(rootProject.libs.plugins.testLogger.get().pluginId)
plugin(rootProject.libs.plugins.detekt.get().pluginId)
plugin("idea")
plugin("java")
plugin("kotlin")
}

detekt {
buildUponDefaultConfig = true
parallel = true
config.from(rootProject.file("detekt.yml"))
}
dependencies {
detektPlugins(rootProject.libs.detekt.formatting)
}

spotless {
java {
removeUnusedImports()
googleJavaFormat()
}
kotlin {
ktlint().setEditorConfigPath(rootProject.layout.projectDirectory.file(".editorconfig"))
}
}
the<IdeaModel>().apply {
module {
isDownloadSources = true
isDownloadJavadoc = true
}
}

tasks {

test {
dependsOn(spotlessApply)
useJUnitPlatform()
testlogger {
setTheme("mocha")
showStandardStreams = true
showExceptions = true
showCauses = true
}
reports {
junitXml.required.set(true)
}
jvmArgs("--add-opens", "java.base/java.util=ALL-UNNAMED")
}


kotlin {
jvmToolchain(21)
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
dependsOn(spotlessApply)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
allWarningsAsErrors = true
freeCompilerArgs.addAll(
"-Xjsr305=strict",
"-Xcontext-receivers",
"-Xsuppress-version-warnings"
)
}
}
}
}
7 changes: 7 additions & 0 deletions recipes/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
}
6 changes: 6 additions & 0 deletions recipes/buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs", { from(files("../gradle/libs.versions.toml")) })
}
}

5 changes: 5 additions & 0 deletions recipes/buildSrc/src/main/kotlin/TestFolders.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object TestFolders {
const val integration = "test-int"
const val e2e = "test-e2e"
const val shared = "test-shared"
}
Loading

0 comments on commit 3ca26ee

Please sign in to comment.