Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
isXander committed Aug 26, 2021
0 parents commit 69d3bb4
Show file tree
Hide file tree
Showing 15 changed files with 594 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
* text=auto

# Text Files
* .java text eol=lf
* .kt text eol=lf
* .json text eol=lf
* .gradle text eol=lf
* .properties text eol=lf
* .yml text eol=lf
* .bat text eol=lf
* .md text eol=lf
* .info text eol=lf
* .txt text eol=lf
* .gitattributes text eol=lf
* .gitignore text eol=lf
LICENSE text eol=lf

# Binaries
* .png binary
* .jar binary
33 changes: 33 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Forge Workspace
run: ./gradlew setupCIWorkspace
- name: Build with Gradle
run: ./gradlew build
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2.2.3
with:
path: ./build/libs/
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# idea
out
*.ipr
*.iws
*.iml
.idea/**
!.idea/scopes/**
!.idea/copyright/**

# gradle
build
.gradle

# other
eclipse
run/**
!**/*.gitkeep
150 changes: 150 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
plugins {
// Languages
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.5.21'

// Minecraft Tools
id 'net.minecraftforge.gradle.forge' version '8708bf3e0'
id 'org.spongepowered.mixin' version '0.6-SNAPSHOT'

// Build Tools
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'com.github.gmazzo.buildconfig' version '3.0.1'
}

group 'dev.isxander'

def modPackage = "$group.$mod_id"
def isPrerelease =! mod_version_prerelease.trim().isEmpty()

version = {
def normal = "$mod_version_major.$mod_version_minor.$mod_version_patch"
if (isPrerelease) normal += "-pre.$mod_version_prerelease"

return normal
}()

targetCompatibility = sourceCompatibility = JavaVersion.VERSION_1_8

minecraft {
version = '1.8.9-11.15.1.2318-1.8.9'
mappings = 'stable_22'
runDir = 'run'
makeObfSourceJar = false
}

buildConfig {
className "${mod_name}Info"
packageName modPackage
useKotlinOutput()

buildConfigField 'String', 'NAME', "\"$mod_name\""
buildConfigField 'String', 'ID', "\"$mod_id\""
buildConfigField 'String', 'DESCRIPTION', "\"$mod_description\""

buildConfigField 'Int', 'VERSION_MAJOR', mod_version_major
buildConfigField 'Int', 'VERSION_MINOR', mod_version_minor
buildConfigField 'Int', 'VERSION_PATCH', mod_version_patch
buildConfigField 'Int?', 'VERSION_PRERELEASE', (isPrerelease ? mod_version_prerelease : 'null')

buildConfigField 'String', 'VERSION_FULL', "\"${project.version}\""
}

repositories {
mavenCentral()
maven { url 'https://repo.spongepowered.org/maven' }
maven { url 'https://jitpack.io' }
maven { url 'https://repo.sk1er.club/repository/maven-public' }
}

configurations {
include
implementation.extendsFrom include
}

dependencies {
// Essential
include 'gg.essential:loader-launchwrapper:1.0.2'
provided 'gg.essential:essential-1.8.9-forge:1234'

include 'dev.isXander.kotlin-forge-api:forge-event-dsl:481f620'
annotationProcessor 'org.spongepowered:mixin:0.7.11-SNAPSHOT'
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
}

jar {
manifest.attributes (
'MixinConfigs': 'mixins.examplemod.json',
'TweakClass': 'gg.essential.loader.stage0.EssentialSetupTweaker'
)

enabled = false
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
}
}

processResources {
inputs.property 'mod_version', project.version
inputs.property 'mod_id', mod_id
inputs.property 'mod_name', mod_name
inputs.property 'mod_description', mod_description

filesMatching('mcmod.info') {
expand (
'mod_version': project.version,
'mod_id': mod_id,
'mod_name': mod_name,
'mod_description': mod_description
)
}

rename '(.+_at.cfg)', 'META-INF/$1'
}

task moveResources {
doLast {
ant.move (
file: "${buildDir}/resources/main",
todir: "${buildDir}/classes/java"
)
}
}

tasks.moveResources.dependsOn processResources
tasks.classes.dependsOn moveResources

shadowJar {
archiveClassifier.set('')

configurations = [project.configurations.include]
duplicatesStrategy DuplicatesStrategy.EXCLUDE
}

mixin {
disableRefMapWarning true
defaultObfuscationEnv searge
add sourceSets.main, 'mixins.examplemod.refmap.json'
}

reobf {
shadowJar {
mappingType = 'SEARGE'
}
}

reobfJar.dependsOn tasks.shadowJar

sourceSets {
main {
ext.refMap = 'mixins.examplemod.refmap.json'
}
}
16 changes: 16 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
kotlin.code.style=official

mod_version_major=1
mod_version_minor=0
mod_version_patch=0
mod_version_prerelease=

mod_id=examplemod
mod_name=ExampleMod
mod_description=An example mod using the Kotlin language.

org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureoncommand=true
org.gradle.parallel.threads=4
org.gradle.jvmargs=-Xmx3G
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 69d3bb4

Please sign in to comment.