Skip to content

Commit

Permalink
default path for icon
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Dec 21, 2023
1 parent 5129a4d commit 2441cb4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 28 deletions.
9 changes: 5 additions & 4 deletions main/src/assets/Asset.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ open class MindustryAssetsExtension(
*/
@JvmField
val _icon = proj.fileProp().apply {
val inProj = proj.layout.projectDirectory.file("icon.png").asFile
val inRoot = proj.rootProject.layout.projectDirectory.file("icon.png").asFile
convention(
findFileInOrder(
proj.layout.projectDirectory.file("icon.png").asFile,
proj.layout.projectDirectory.file("icon.png").asFile,
)
inProj,
inRoot,
) ?: inRoot
)

}

/**
Expand Down
23 changes: 12 additions & 11 deletions main/src/dsl/GradleKts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.gradle.api.*
import org.gradle.api.artifacts.Configuration
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.Directory
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.plugins.ExtensionContainer
import org.gradle.api.plugins.PluginContainer
Expand All @@ -27,47 +28,47 @@ fun <reified T> ExtensionContainer.getOrNull(): T? {
}

internal
fun Project.stringProp() =
fun Project.stringProp(): Property<String> =
objects.property(String::class.java)

internal
fun Project.boolProp() =
fun Project.boolProp(): Property<Boolean> =
objects.property(Boolean::class.java)

internal
fun Project.stringsProp() =
fun Project.stringsProp(): ListProperty<String> =
objects.listProperty(String::class.java)

internal inline
fun <reified T> Project.listProp() =
fun <reified T> Project.listProp(): ListProperty<T> =
objects.listProperty(T::class.java)

internal inline
fun <reified TK, reified TV> Project.mapProp() =
fun <reified TK, reified TV> Project.mapProp(): MapProperty<TK, TV> =
project.objects.mapProperty(TK::class.java, TV::class.java)

internal inline
fun <reified T> Project.setProp() =
fun <reified T> Project.setProp(): SetProperty<T> =
objects.setProperty(T::class.java)

internal inline
fun <reified T> Project.prop() =
fun <reified T> Project.prop(): Property<T> =
objects.property(T::class.java)

internal
fun Project.dirProp() =
fun Project.dirProp(): DirectoryProperty =
objects.directoryProperty()

internal
fun Project.sourceDirectorySet(name: String, displayName: String) =
fun Project.sourceDirectorySet(name: String, displayName: String): SourceDirectorySet =
objects.sourceDirectorySet(name, displayName)

internal
fun Project.fileProp() =
fun Project.fileProp(): Property<File> =
objects.property(File::class.java)

internal
fun Project.configurationFileCollection() =
fun Project.configurationFileCollection(): ConfigurableFileCollection =
objects.fileCollection()

internal inline
Expand Down
12 changes: 0 additions & 12 deletions main/src/dsl/TypeAlias.kt

This file was deleted.

2 changes: 1 addition & 1 deletion main/src/plugin/Java.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MindustryJavaPlugin : Plugin<Project> {
if (deployX.outputMod) {
from(assets.assets)
from(assets._icon)
from(tasks.getByPath(R.task.genModHjson))
from(tasks.findByPath(R.task.genModHjson))
}
}
}
Expand Down

0 comments on commit 2441cb4

Please sign in to comment.