org.groovymc.modsdotgroovy.gradle.tasks.AbstractGatherPlatformDetailsTask.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-plugin Show documentation
Show all versions of gradle-plugin Show documentation
A Gradle plugin for creation of mods metadata file from a groovy file
The newest version!
package org.groovymc.modsdotgroovy.gradle.tasks
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
import groovy.transform.CompileStatic
import org.gradle.api.DefaultTask
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.Directory
import org.gradle.api.file.ProjectLayout
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.groovymc.modsdotgroovy.gradle.internal.MapUtils
import org.jetbrains.annotations.Nullable
import javax.inject.Inject
import java.util.regex.Pattern
@CacheableTask
@CompileStatic
abstract class AbstractGatherPlatformDetailsTask extends DefaultTask {
private static final Pattern DOT_PATTERN = Pattern.compile('\\.')
private final Property<@Nullable String> minecraftVersion = objectFactory.property(String)
private final Property<@Nullable String> platformVersion = objectFactory.property(String)
private final RegularFileProperty outputFile = objectFactory.fileProperty()
@Input
abstract MapProperty getExtraProperties()
@Input
abstract MapProperty getBuildProperties()
@Optional
@InputFiles
@PathSensitive(PathSensitivity.NONE)
abstract ConfigurableFileCollection getParents()
@Optional @Input
Property<@Nullable String> getMinecraftVersion() {
return minecraftVersion
}
@Optional @Input
Property<@Nullable String> getPlatformVersion() {
return platformVersion
}
@OutputFile
RegularFileProperty getOutputFile() {
return outputFile
}
@Inject
protected abstract ProjectLayout getProjectLayout()
@Inject
protected abstract ObjectFactory getObjectFactory()
void projectProperty(String name) {
projectProperty(project.provider { name })
}
void projectProperty(Provider name) {
buildProperties.putAll(
project.provider {
[(name.get()): project.property(name.get())]
}
)
}
void projectProperties(Collection names) {
names.each { projectProperty(it) }
}
void projectProperties(Provider extends Collection> names) {
buildProperties.putAll(names.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy