add all modules, better gradle setup, and elixir for server

This commit is contained in:
mae 2025-10-07 19:34:23 -05:00
parent 3efcca8651
commit e58cc0a1a6
Signed by: maemachinebroke
GPG Key ID: B54591A4805E9CC8
40 changed files with 273 additions and 29 deletions

18
.idea/gradle.xml generated
View File

@ -4,11 +4,29 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT">
<builds>
<build path="$PROJECT_DIR$/buildSrc" name="buildSrc">
<projects>
<project path="$PROJECT_DIR$/buildSrc" />
</projects>
</build>
</builds>
</compositeBuild>
</compositeConfiguration>
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="" /> <option name="gradleHome" value="" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/buildSrc" />
<option value="$PROJECT_DIR$/plt-build" />
<option value="$PROJECT_DIR$/plt-build-wrapper" />
<option value="$PROJECT_DIR$/plt-fetch" />
<option value="$PROJECT_DIR$/plt-pkg" />
<option value="$PROJECT_DIR$/plt-server" />
<option value="$PROJECT_DIR$/plt-updated" />
</set> </set>
</option> </option>
</GradleProjectSettings> </GradleProjectSettings>

View File

@ -15,32 +15,21 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0")
implementation(kotlin("reflect")) implementation(kotlin("reflect"))
} }
tasks.test {
useJUnitPlatform()
dependsOn(testGo)
}
tasks.classes {
dependsOn(compileGo)
}
kotlin { kotlin {
jvmToolchain(24) jvmToolchain(24)
} }
val compileGo = tasks.register("compileGo", Exec::class) { tasks.build.configure {
group = "go" dependsOn(":plt-build-wrapper:compileGo")
workingDir(layout.projectDirectory) dependsOn(":plt-fetch:compileGo")
commandLine("/usr/bin/go", "build", "-o", "build/go/planterette", "./src/main/go") dependsOn(":plt-pkg:compileGo")
dependsOn(":plt-server:compileEx")
dependsOn(":plt-updated:compileGo")
} }
tasks.test.configure {
val testGo = tasks.register("testGo", Exec::class) { dependsOn(":plt-build-wrapper:testGo")
group = "go" dependsOn(":plt-fetch:testGo")
workingDir(layout.projectDirectory) dependsOn(":plt-pkg:testGo")
commandLine("/usr/bin/go", "test", "./src/main/go") dependsOn(":plt-server:testEx")
} dependsOn(":plt-updated:testGo")
val runGo = tasks.register("runGo", Exec::class) {
group = "go"
workingDir(layout.projectDirectory)
commandLine("/usr/bin/go", "run", "./src/main/go")
} }

15
buildSrc/build.gradle.kts Normal file
View File

@ -0,0 +1,15 @@
plugins {
`kotlin-dsl`
}
repositories {
gradlePluginPortal()
}
gradlePlugin {
plugins {
create("goPlugin") {
id = "goPlugin"
implementationClass = "moe.rosa.planterette.buildsrc.GoPlugin"
}
}
}

View File

@ -0,0 +1,22 @@
package moe.rosa.planterette.buildsrc
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.Exec
class GoPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.tasks.register("compileGo", Exec::class.java) {
group = "go"
description = "compile all go source files and output into build directory"
workingDir(project.layout.projectDirectory)
commandLine("go", "build", "-o", "../build/go")
}
project.tasks.register("testGo", Exec::class.java) {
group = "go"
description = "run go test"
workingDir(project.layout.projectDirectory)
commandLine("go", "test")
}
}
}

4
go.mod
View File

@ -1,4 +0,0 @@
module rosa.moe/planterette
go 1.24.7

View File

@ -0,0 +1,3 @@
plugins {
id("goPlugin")
}

3
plt-build-wrapper/go.mod Normal file
View File

@ -0,0 +1,3 @@
module plt-build-wrapper
go 1.24

View File

@ -2,7 +2,6 @@ package main
import ( import (
"testing" "testing"
_ "testing"
) )
func TestHelloWorld(t *testing.T) { func TestHelloWorld(t *testing.T) {

View File

@ -0,0 +1,20 @@
plugins {
id("java")
}
group = "moe.rosa"
version = "0.1.0"
repositories {
mavenCentral()
}
dependencies {
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.test {
useJUnitPlatform()
}

View File

@ -0,0 +1,3 @@
plugins {
id("goPlugin")
}

3
plt-fetch/go.mod Normal file
View File

@ -0,0 +1,3 @@
module plt-fetch
go 1.24

5
plt-fetch/main.go Normal file
View File

@ -0,0 +1,5 @@
package main
func main() {
}

9
plt-fetch/main_test.go Normal file
View File

@ -0,0 +1,9 @@
package main
import (
"testing"
)
func TestHelloWorld(t *testing.T) {
}

3
plt-pkg/build.gradle.kts Normal file
View File

@ -0,0 +1,3 @@
plugins {
id("goPlugin")
}

3
plt-pkg/go.mod Normal file
View File

@ -0,0 +1,3 @@
module plt-pkg
go 1.24

5
plt-pkg/main.go Normal file
View File

@ -0,0 +1,5 @@
package main
func main() {
}

9
plt-pkg/main_test.go Normal file
View File

@ -0,0 +1,9 @@
package main
import (
"testing"
)
func TestHelloWorld(t *testing.T) {
}

View File

@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

23
plt-server/.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
# The directory Mix will write compiled artifacts to.
/_build/
# If you run "mix test --cover", coverage assets end up here.
/cover/
# The directory Mix downloads your dependencies sources to.
/deps/
# Where third-party dependencies like ExDoc output generated docs.
/doc/
# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump
# Also ignore archive artifacts (built via "mix archive.build").
*.ez
# Ignore package tarball (built via "mix hex.build").
plt_server-*.tar
# Temporary files, for example, from tests.
/tmp/

21
plt-server/README.md Normal file
View File

@ -0,0 +1,21 @@
# PltServer
**TODO: Add description**
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `plt_server` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:plt_server, "~> 0.1.0"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at <https://hexdocs.pm/plt_server>.

View File

@ -0,0 +1,10 @@
tasks.register("compileEx", Exec::class) {
group = "elixir"
workingDir(project.layout.projectDirectory)
commandLine("mix", "compile") //TODO
}
tasks.register("testEx", Exec::class) {
group = "elixir"
workingDir(project.layout.projectDirectory)
commandLine("mix", "test")
}

View File

@ -0,0 +1,18 @@
defmodule PltServer do
@moduledoc """
Documentation for `PltServer`.
"""
@doc """
Hello world.
## Examples
iex> PltServer.hello()
:world
"""
def hello do
:world
end
end

28
plt-server/mix.exs Normal file
View File

@ -0,0 +1,28 @@
defmodule PltServer.MixProject do
use Mix.Project
def project do
[
app: :plt_server,
version: "0.1.0",
elixir: "~> 1.18",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
end

View File

@ -0,0 +1,8 @@
defmodule PltServerTest do
use ExUnit.Case
doctest PltServer
test "greets the world" do
assert PltServer.hello() == :world
end
end

View File

@ -0,0 +1 @@
ExUnit.start()

View File

@ -0,0 +1,3 @@
plugins {
id("goPlugin")
}

3
plt-updated/go.mod Normal file
View File

@ -0,0 +1,3 @@
module plt-updated
go 1.24

5
plt-updated/main.go Normal file
View File

@ -0,0 +1,5 @@
package main
func main() {
}

9
plt-updated/main_test.go Normal file
View File

@ -0,0 +1,9 @@
package main
import (
"testing"
)
func TestHelloWorld(t *testing.T) {
}

View File

@ -2,3 +2,9 @@ plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
} }
rootProject.name = "planterette" rootProject.name = "planterette"
include("plt-build")
include("plt-build-wrapper")
include("plt-fetch")
include("plt-pkg")
include("plt-server")
include("plt-updated")