Skip to content

Commit

Permalink
build: create basic projects
Browse files Browse the repository at this point in the history
Signed-off-by: Kengo TODA <skypencil@gmail.com>
  • Loading branch information
KengoTODA committed Nov 12, 2023
1 parent bb60e88 commit 00fcee0
Show file tree
Hide file tree
Showing 29 changed files with 639 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .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

22 changes: 22 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Continuous Integration
on:
push:
branches:
- main
pull_request: {}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version-file: .java-version
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build --scan
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/google-java-format.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
21

7 changes: 7 additions & 0 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id("jp.skypencil.kosmo.kotlin-application-conventions")
}

application {
mainClass.set("jp.skypencil.kosmo.backend.AppKt")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package jp.skypencil.kosmo.backend

class Coordinator {
}
11 changes: 11 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10")
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* This file was generated by the Gradle 'init' task.
*
* This settings file is used to specify which projects to include in your build-logic build.
*/

rootProject.name = "buildSrc"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plugins {
id("jp.skypencil.kosmo.kotlin-common-conventions")

application
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
id("org.jetbrains.kotlin.jvm")
}

repositories {
mavenCentral()
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks.named<Test>("test") {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins {
id("jp.skypencil.kosmo.kotlin-common-conventions")
`java-library`
}
3 changes: 3 additions & 0 deletions frontend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id("jp.skypencil.kosmo.kotlin-application-conventions")
}
86 changes: 86 additions & 0 deletions frontend/src/main/kotlin/jp/skypencil/kosmo/list/LinkedList.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* This Kotlin source file was generated by the Gradle 'init' task.
*/
package jp.skypencil.kosmo.list

class LinkedList {
private var head: Node? = null

fun add(element: String) {
val newNode = Node(element)

val it = tail(head)
if (it == null) {
head = newNode
} else {
it.next = newNode
}
}

private fun tail(head: Node?): Node? {
var it: Node?

it = head
while (it?.next != null) {
it = it.next
}

return it
}

fun remove(element: String): Boolean {
var result = false
var previousIt: Node? = null
var it: Node? = head
while (!result && it != null) {
if (0 == element.compareTo(it.data)) {
result = true
unlink(previousIt, it)
break
}
previousIt = it
it = it.next
}

return result
}

private fun unlink(previousIt: Node?, currentIt: Node) {
if (currentIt == head) {
head = currentIt.next
} else {
previousIt?.next = currentIt.next
}
}

fun size(): Int {
var size = 0

var it = head
while (it != null) {
++size
it = it.next
}

return size
}

fun get(idx: Int): String {
var index = idx
var it = head
while (index > 0 && it != null) {
it = it.next
index--
}

if (it == null) {
throw IndexOutOfBoundsException("Index is out of range")
}

return it.data
}

private data class Node(val data: String) {
var next: Node? = null
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 00fcee0

Please sign in to comment.