Skip to content

Commit

Permalink
1.7.4 use values (#105)
Browse files Browse the repository at this point in the history
* Map of values can be sent to the KickAssembler.

* Map of values can be sent to the KickAssembler.
  • Loading branch information
maciejmalecki authored Aug 17, 2023
1 parent 1732de6 commit d24af6c
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGES.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
= Change log

1.7.4::
* A map of values can be now passed to the KickAssembler.

1.7.3::
* `Image`: Fixing bitmap writer.

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
allprojects {

group = "com.github.c64lib"
version = "1.7.3"
version = "1.7.4-SNAPSHOT"

if (project.hasProperty(tagPropertyName)) {
version = project.property(tagPropertyName) ?: version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ open class Assemble : DefaultTask() {
KickAssembleCommand(
libDirs = listOf(*extension.libDirs).map { file -> project.file(file) },
defines = listOf(*extension.defines),
values = extension.values,
source = sourceFile))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ internal class CommandLineBuilder(private val settings: KickAssemblerSettings) {
return this
}

fun variables(values: Map<String, String>): CommandLineBuilder {
values.entries.forEach { variable(it.key, it.value) }
return this
}

fun source(source: Path): CommandLineBuilder {
args.add(source.absolutePathString())
return this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ class KickAssembleAdapter(
private val project: Project,
private val settings: KickAssemblerSettings
) : KickAssemblePort {
override fun assemble(libDirs: List<File>, defines: List<String>, source: File) {
override fun assemble(
libDirs: List<File>,
defines: List<String>,
values: Map<String, String>,
source: File
) {
project.javaexec {
it.classpath = project.files(settings.pathToExecutable)
val args =
CommandLineBuilder(settings)
.libDirs(libDirs.map { file -> file.toPath() })
.defines(defines)
.variables(values)
.source(source.toPath())
.build()
it.args = args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ import java.io.File

class KickAssembleUseCase(private val kickAssemblePort: KickAssemblePort) {
fun apply(command: KickAssembleCommand) =
kickAssemblePort.assemble(command.libDirs, command.defines, command.source)
kickAssemblePort.assemble(command.libDirs, command.defines, command.values, command.source)
}

data class KickAssembleCommand(
val libDirs: List<File>,
val defines: List<String>,
val values: Map<String, String>,
val source: File
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ package com.github.c64lib.rbt.compilers.kickass.usecase.port
import java.io.File

interface KickAssemblePort {
fun assemble(libDirs: List<File>, defines: List<String>, source: File): Unit
fun assemble(
libDirs: List<File>,
defines: List<String>,
values: Map<String, String>,
source: File
): Unit
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ open class RetroAssemblerPluginExtension {
var viceAutostartPrgMode = AutostartPrgMode.VIRTUAL_FS
var specDirs = arrayOf("spec")
var specIncludes: Array<String> = arrayOf("**/*.spec.asm")
var values: Map<String, String> = mapOf()

val dependencies: List<Dependency>
get() = _dependencies
Expand Down

0 comments on commit d24af6c

Please sign in to comment.