-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19cdc6e
commit 3ee14fe
Showing
21 changed files
with
544 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,6 @@ bin/ | |
.classpath | ||
.project | ||
|
||
# fabric | ||
|
||
# forge&fabric | ||
run/ | ||
minecraft/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,251 @@ | ||
plugins { | ||
id 'fabric-loom' version '0.5-SNAPSHOT' | ||
id 'maven-publish' | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2017 Una Thompson (unascribed) | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
* of the Software, and to permit persons to whom the Software is furnished to do | ||
* so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
jcenter() | ||
maven { | ||
url = "http://files.minecraftforge.net/maven" | ||
} | ||
maven { | ||
url = "https://oss.sonatype.org/content/repositories/snapshots/" | ||
} | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
} | ||
dependencies { | ||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' | ||
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.0' | ||
classpath 'gradle.plugin.net.minecrell:licenser:0.3' | ||
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.3' | ||
} | ||
} | ||
|
||
ext.early = true | ||
apply from: 'project.gradle' | ||
|
||
if (project.ext.language == 'kotlin') { | ||
apply plugin: 'kotlin' | ||
} else if (project.ext.language == 'scala') { | ||
apply plugin: 'scala' | ||
} | ||
apply plugin: 'net.minecraftforge.gradle.forge' | ||
|
||
project.ext.package = project.ext.group+'.'+project.ext.projectName.toLowerCase() | ||
|
||
if (project.ext.useElytraVersionFormat) { | ||
def branch; | ||
if (System.env.BRANCH_NAME) { | ||
// Jenkins support | ||
branch = System.env.BRANCH_NAME; | ||
branch = branch.substring(branch.lastIndexOf('/')+1); | ||
} else { | ||
branch = 'git rev-parse --abbrev-ref HEAD'.execute().in.text.trim(); | ||
} | ||
if (branch == "HEAD") { | ||
branch = 'git rev-parse --short HEAD'.execute().in.text.trim(); | ||
} | ||
def commits = 'git rev-list --count HEAD'.execute().in.text.trim(); | ||
def dirty = !'git diff-index HEAD'.execute().in.text.trim().isEmpty(); | ||
version = branch+'-'+project.ext.version+'.'+commits+(dirty ? '-dirty' : ''); | ||
} else { | ||
version = project.ext.version; | ||
} | ||
println() | ||
println("Elytra Project Skeleton v1.1.4") | ||
println("https://github.com/elytra/Skeleton") | ||
println() | ||
println("Project Name: "+project.ext.projectName) | ||
println("Version: "+version) | ||
println() | ||
println("Package: "+project.ext.package) | ||
println() | ||
if (!project.ext.concreteModules.isEmpty()) { | ||
println("Concrete Version: "+project.ext.concreteVersion) | ||
} | ||
if (project.ext.coremod && project.ext.miniVersion) { | ||
println("Mini Version: "+project.ext.miniVersion); | ||
} | ||
println("Forge Version: "+project.ext.forge) | ||
println("Mappings: "+project.ext.mappings) | ||
println() | ||
println("Language: "+project.ext.language.charAt(0).toUpperCase()+project.ext.language.substring(1)) | ||
println() | ||
|
||
project.ext.priv = parseConfig(file('private.properties')) | ||
|
||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
group = project.ext.group | ||
archivesBaseName = project.ext.projectName | ||
|
||
archivesBaseName = project.archives_base_name | ||
version = project.mod_version | ||
group = project.maven_group | ||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
|
||
dependencies { | ||
//to change the versions see the gradle.properties file | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" | ||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
tasks.withType(JavaCompile) { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
// Fabric API. This is technically optional, but you probably want it anyway. | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
repositories { | ||
jcenter() | ||
mavenCentral() | ||
maven { | ||
url 'https://repo.elytradev.com/' | ||
} | ||
if (project.ext.language == 'kotlin') { | ||
maven { | ||
url 'http://maven.shadowfacts.net/' | ||
} | ||
} | ||
} | ||
|
||
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. | ||
// You may need to force-disable transitiveness on them. | ||
if (project.ext.enforceLicenseHeaders) { | ||
apply plugin: 'net.minecrell.licenser' | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
def needsShadow = !project.ext.concreteModules.isEmpty() || project.ext.miniVersion | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
include "fabric.mod.json" | ||
expand "version": project.version | ||
if (needsShadow) { | ||
apply plugin: 'com.github.johnrengelman.shadow' | ||
|
||
jar { | ||
classifier = 'slim' | ||
} | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
exclude "fabric.mod.json" | ||
shadowJar { | ||
classifier = '' | ||
relocate 'com.elytradev.concrete', project.ext.package+'.repackage.com.elytradev.concrete' | ||
relocate 'com.elytradev.mini', project.ext.package+'.asm.repackage.com.elytradev.mini' | ||
configurations = [project.configurations.shadow] | ||
} | ||
|
||
reobf { | ||
shadowJar { mappingType = 'SEARGE' } | ||
} | ||
|
||
tasks.reobfJar.doLast { | ||
file('build/libs/'+archivesBaseName+'-'+version+'-slim.jar').delete() | ||
} | ||
|
||
tasks.build.dependsOn reobfShadowJar | ||
|
||
artifacts { | ||
archives shadowJar | ||
} | ||
|
||
dependencies { | ||
for (String module : project.ext.concreteModules) { | ||
shadow 'com.elytradev.concrete:concrete-'+module+':'+project.ext.concreteVersion | ||
deobfCompile 'com.elytradev.concrete:concrete-'+module+':'+project.ext.concreteVersion | ||
} | ||
if (project.ext.miniVersion) { | ||
shadow 'com.elytradev:mini:'+project.ext.miniVersion | ||
compile 'com.elytradev:mini:'+project.ext.miniVersion | ||
} | ||
} | ||
} | ||
|
||
// ensure that the encoding is set to UTF-8, no matter what the system default is | ||
// this fixes some edge cases with special characters not displaying correctly | ||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html | ||
tasks.withType(JavaCompile) { | ||
options.encoding = "UTF-8" | ||
ext.early = false | ||
apply from: 'project.gradle' | ||
|
||
if (project.ext.language == 'kotlin') { | ||
dependencies { | ||
compile 'net.shadowfacts:Forgelin:1.5.1' | ||
} | ||
} | ||
|
||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task | ||
// if it is present. | ||
// If you remove this task, sources will not be generated. | ||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = "sources" | ||
from sourceSets.main.allSource | ||
if (file('private.gradle').exists()) { | ||
apply plugin: 'maven' | ||
|
||
configurations { | ||
deploy | ||
} | ||
|
||
dependencies { | ||
deploy 'org.apache.maven.wagon:wagon-ssh:2.10' | ||
} | ||
|
||
apply from: 'private.gradle' | ||
} | ||
|
||
jar { | ||
from "LICENSE" | ||
|
||
|
||
minecraft { | ||
version = project.ext.forge | ||
mappings = project.ext.mappings | ||
|
||
runDir = "minecraft" | ||
|
||
replaceIn 'src/main/java/'+project.ext.package.replace('.', '/')+'/'+project.ext.projectName+'.java' | ||
replace '@VERSION@', project.version | ||
|
||
if (project.ext.coremod) { | ||
coreMod = project.ext.coremod | ||
} | ||
} | ||
|
||
// configure the maven publication | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
// add all the jars that should be included when publishing to maven | ||
artifact(remapJar) { | ||
builtBy remapJar | ||
} | ||
artifact(sourcesJar) { | ||
builtBy remapSourcesJar | ||
} | ||
if (project.ext.coremod) { | ||
jar { | ||
manifest { | ||
attributes ( | ||
'FMLCorePlugin': project.ext.coremod, | ||
'FMLCorePluginContainsFMLMod': true | ||
) | ||
} | ||
} | ||
} | ||
|
||
// select the repositories you want to publish to | ||
repositories { | ||
// uncomment to publish to the local maven | ||
// mavenLocal() | ||
if (project.ext.language == 'kotlin') { | ||
sourceSets.main.java.srcDirs += 'src/main/kotlin' | ||
} | ||
|
||
processResources { | ||
// this will ensure that this task is redone when the versions change. | ||
inputs.property "version", project.version | ||
inputs.property "mcversion", project.minecraft.version | ||
|
||
// replace stuff in mcmod.info, nothing else | ||
from(sourceSets.main.resources.srcDirs) { | ||
include 'mcmod.info' | ||
|
||
// replace version and mcversion | ||
expand 'version':project.version, 'mcversion':project.minecraft.version | ||
} | ||
|
||
// copy everything else, thats not the mcmod.info | ||
from(sourceSets.main.resources.srcDirs) { | ||
exclude 'mcmod.info' | ||
exclude '*.xcf' | ||
exclude '*.wav' | ||
} | ||
} | ||
|
||
def parseConfig(File config) { | ||
if (!config.exists()) return null | ||
config.withReader { | ||
def prop = new Properties() | ||
prop.load(it) | ||
return (new ConfigSlurper().parse(prop)) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// See https://github.com/elytra/Skeleton/wiki for what all these values mean | ||
|
||
ext { | ||
group = 'com.unascribed' | ||
projectName = 'Ears' | ||
|
||
useElytraVersionFormat = false | ||
version = '1.0.1' | ||
|
||
concreteVersion = '' | ||
concreteModules = [ ] | ||
|
||
coremod = 'com.unascribed.ears.asm.EarsLoadingPlugin' | ||
miniVersion = '0.2-SNAPSHOT' | ||
|
||
language = 'java' | ||
|
||
forge = '1.12.2-14.23.5.2847' | ||
mappings = 'snapshot_20180413' | ||
|
||
enforceLicenseHeaders = false | ||
|
||
verbose = false | ||
} | ||
|
||
if (!ext.early) { | ||
archivesBaseName = 'ears-forge' | ||
|
||
repositories { | ||
// the skeleton already defines mavenCentral, jcenter, and the Elytra repo | ||
// will also have Shadowfacts' maven if the language is set to kotlin | ||
} | ||
|
||
dependencies { | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.