Skip to content

Commit

Permalink
using provider
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Dec 26, 2023
1 parent 03d6153 commit d27ce0b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions main/src/plugin/Run.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,21 @@ class MindustryRunPlugin : Plugin<Project> {
for (client in x.clients) {
val resolveClient = proj.tasks.register<ResolveGame>("resolveClient${client.name}") {
group = R.taskGroup.mindustryStuff
val gameLocalProp = proj.localProp[client.locationLocalPropKey]
location.set(
location.set(proj.provider {
val gameLocalProp = proj.localProp[client.locationLocalPropKey]
if (gameLocalProp != null) LocalGameLoc(gameLocalProp)
else client.location
)
})
}
proj.tasks.register<RunClient>("runClient${client.name}") {
group = R.taskGroup.mindustry
dependsOn(resolveClient)
startupArgs.addAll(client.startupArgs)
val dataDirLocalProp = proj.localProp[client.dataDirLocalPropKey]
dataDir.set(
dataDir.set(proj.provider {
val dataDirLocalProp = proj.localProp[client.dataDirLocalPropKey]
if (dataDirLocalProp != null) LocalDataDirLoc(dataDirLocalProp)
else client.dataDir
)
})
gameFile.set(proj.provider {
resolveClient.get().outputs.files.singleFile
})
Expand Down Expand Up @@ -90,21 +90,21 @@ class MindustryRunPlugin : Plugin<Project> {
for (server in x.servers) {
val resolveServer = proj.tasks.register<ResolveGame>("resolveServer${server.name}") {
group = R.taskGroup.mindustryStuff
val gameLocalProp = project.localProp[server.locationLocalPropKey]
location.set(
location.set(proj.provider {
val gameLocalProp = project.localProp[server.locationLocalPropKey]
if (gameLocalProp != null) LocalGameLoc(gameLocalProp)
else server.location
)
})
}
proj.tasks.register<RunServer>("runServer${server.name}") {
group = R.taskGroup.mindustry
dependsOn(resolveServer)
startupArgs.addAll(server.startupArgs)
val dataDirLocalProp = proj.localProp[server.dataDirLocalPropKey]
dataDir.set(
dataDir.set(proj.provider {
val dataDirLocalProp = proj.localProp[server.dataDirLocalPropKey]
if (dataDirLocalProp != null) LocalDataDirLoc(dataDirLocalProp)
else server.dataDir
)
})
gameFile.set(proj.provider {
resolveServer.get().outputs.files.singleFile
})
Expand Down

0 comments on commit d27ce0b

Please sign in to comment.