-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of code generation homework
- Loading branch information
1 parent
de5636a
commit 912917f
Showing
39 changed files
with
1,103 additions
and
5 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,27 @@ | ||
name: Continuous Integration | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 21 | ||
distribution: adopt | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
- name: Check phase 1 | ||
run: ./gradlew build -PhomeworkStage=1 | ||
- name: Check phase 2 | ||
run: ./gradlew build -PhomeworkStage=2 | ||
- name: Check phase 3 | ||
run: ./gradlew build -PhomeworkStage=3 | ||
- name: Check phase 4 | ||
run: ./gradlew build -PhomeworkStage=4 |
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 @@ | ||
*._trace | ||
.idea/ | ||
.gradle/ | ||
build/ | ||
**/src/gen/ |
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
import org.gradle.accessors.dm.LibrariesForLibs | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
|
||
val libs = the<LibrariesForLibs>() | ||
|
||
dependencies { | ||
// https://github.com/gradle/gradle/issues/15383 | ||
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) | ||
implementation(libs.python.gradle.plugin) | ||
} |
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,7 @@ | ||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
buildSrc/src/main/kotlin/hu/bme/mit/ase/gradle/conventions/generator.gradle.kts
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,60 @@ | ||
package hu.bme.mit.ase.gradle.conventions | ||
|
||
import com.pswidersk.gradle.python.VenvTask | ||
import org.gradle.api.tasks.Sync | ||
import org.gradle.kotlin.dsl.getValue | ||
import org.gradle.kotlin.dsl.provideDelegate | ||
import org.gradle.kotlin.dsl.registering | ||
|
||
plugins { | ||
id("hu.bme.mit.ase.gradle.conventions.jvm") | ||
id("com.pswidersk.python-plugin") | ||
} | ||
|
||
val srcGenJava = "src/gen/java" | ||
|
||
sourceSets.main { | ||
java.srcDir(srcGenJava) | ||
} | ||
|
||
val installPythonPackages by tasks.registering(VenvTask::class) { | ||
venvExec = "pip3" | ||
|
||
args = listOf( | ||
"install", | ||
"jinja2", | ||
) | ||
} | ||
|
||
val syncGeneratorScripts by tasks.registering(Sync::class) { | ||
from(rootProject.layout.projectDirectory.dir("python-scripts")) | ||
into(project.layout.buildDirectory.dir("python-scripts")) | ||
} | ||
|
||
val syncModels by tasks.registering(Sync::class) { | ||
from(rootProject.layout.projectDirectory.dir("models")) | ||
into(project.layout.buildDirectory.dir("models")) | ||
} | ||
|
||
val syncTemplates by tasks.registering(Sync::class) { | ||
from(rootProject.layout.projectDirectory.dir("jinja-templates")) | ||
into(project.layout.buildDirectory.dir("jinja-templates")) | ||
} | ||
|
||
val generate by tasks.registering(VenvTask::class) { | ||
inputs.files(syncGeneratorScripts.get().outputs) | ||
inputs.files(syncModels.get().outputs) | ||
inputs.files(syncTemplates.get().outputs) | ||
|
||
dependsOn(installPythonPackages) | ||
|
||
outputs.dir(srcGenJava) | ||
} | ||
|
||
tasks.compileJava { | ||
inputs.files(generate.get().outputs) | ||
} | ||
|
||
tasks.clean { | ||
delete(srcGenJava) | ||
} |
37 changes: 37 additions & 0 deletions
37
buildSrc/src/main/kotlin/hu/bme/mit/ase/gradle/conventions/jvm.gradle.kts
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,37 @@ | ||
package hu.bme.mit.ase.gradle.conventions | ||
|
||
import org.gradle.accessors.dm.LibrariesForLibs | ||
|
||
plugins { | ||
`java-library` | ||
`java-test-fixtures` | ||
java | ||
} | ||
|
||
val libs = the<LibrariesForLibs>() | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
java.toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(21)) | ||
} | ||
|
||
tasks { | ||
test { | ||
useJUnitPlatform() | ||
testLogging.showStandardStreams = true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(libs.slf4j.api) | ||
|
||
runtimeOnly(libs.slf4j.log4j.impl) | ||
|
||
testImplementation(libs.junit.jupiter.core) | ||
testImplementation(libs.junit.jupiter.params) | ||
|
||
testRuntimeOnly(libs.junit.jupiter.engine) | ||
} |
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,6 @@ | ||
org.gradle.daemon=true | ||
org.gradle.jvmargs=-Xmx2048M | ||
org.gradle.parallel=true | ||
|
||
# Change the stage here to execute additional tests! | ||
homeworkStage=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,16 @@ | ||
# This file was generated by the Gradle 'init' task. | ||
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format | ||
|
||
[versions] | ||
slf4j = "1.7.25" | ||
log4j = "2.23.1" | ||
jUnit = "5.10.0" | ||
python-gradle-plugin = "2.7.3" | ||
|
||
[libraries] | ||
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" } | ||
slf4j-log4j-impl = { group = "org.apache.logging.log4j", name = "log4j-slf4j-impl", version.ref = "log4j" } | ||
junit-jupiter-core = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "jUnit" } | ||
junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "jUnit" } | ||
junit-jupiter-params = { group = "org.junit.jupiter", name = "junit-jupiter-params", version.ref = "jUnit" } | ||
python-gradle-plugin = { group = "com.pswidersk", name = "python-gradle-plugin", version.ref = "python-gradle-plugin" } |
Oops, something went wrong.