Skip to content

Commit

Permalink
Automatically set metadata Minecraft version when using ForgeGradle
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-gh committed Aug 24, 2016
1 parent f654b08 commit 937f0d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
18 changes: 8 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defaultTasks 'clean', 'licenseFormat', 'build'
apply plugin: 'java'

group = 'org.spongepowered'
version = '0.6.1-SNAPSHOT'
version = '0.7-SNAPSHOT'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
Expand All @@ -25,18 +25,16 @@ archivesBaseName = project.name.toLowerCase()

repositories {
jcenter()
// TODO: Remove before uploading to Gradle's plugin portal
maven {
name = 'sponge'
url = 'http://repo.spongepowered.org/maven'
}
}

configurations {
compileOnly
}

sourceSets.main.compileClasspath += configurations.compileOnly
eclipse.classpath.plusConfigurations += [configurations.compileOnly]
idea.module.scopes.COMPILE.plus += [configurations.compileOnly]

dependencies {
compile 'org.spongepowered:plugin-meta:0.1.1'
// TODO: Switch to release before uploading to Gradle's plugin portal
compile 'org.spongepowered:plugin-meta:0.2-SNAPSHOT'
compileOnly 'org.codehaus.groovy:groovy-all:2.4.4:indy'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class MetadataBaseExtension {
Object version
Object description
Object url
Object minecraftVersion

List<String> authors = []

Expand All @@ -106,6 +107,10 @@ class MetadataBaseExtension {
return SpongeGradle.resolve(this.url)
}

String getMinecraftVersion() {
return SpongeGradle.resolve(this.minecraftVersion)
}

String getAssets() {
return SpongeGradle.resolve(this.assets)
}
Expand All @@ -116,6 +121,7 @@ class MetadataBaseExtension {
meta.version = getVersion()
meta.description = getDescription()
meta.url = getUrl()
meta.minecraftVersion = getMinecraftVersion()
meta.authors.addAll(this.authors)

def assets = getAssets()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class MetadataPlugin implements Plugin<Project> {
name = project.name
version = {project.version}
description = {project.description}
minecraftVersion = {project.extensions.findByName('minecraft')?.version}
}
}
}
Expand Down

0 comments on commit 937f0d8

Please sign in to comment.