Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor build script. Remove bloat. #254

Merged
merged 3 commits into from Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
474 changes: 1 addition & 473 deletions .editorconfig

Large diffs are not rendered by default.

77 changes: 38 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
version project.modVersion
group project.modGroup

buildscript {
repositories {
mavenCentral()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://repo.spongepowered.org/maven/' }
}

dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:5.+'
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"
}
}

apply plugin: 'idea'
apply plugin: 'kotlin'
plugins {
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'org.spongepowered.mixin'

version project.modVersion
group project.modGroup

compileJava {
sourceCompatibility = targetCompatibility = '1.8'
options.encoding = 'UTF-8'
Expand All @@ -34,10 +32,10 @@ compileKotlin.kotlinOptions {
}

repositories {
mavenCentral()
maven { url = 'https://repo.spongepowered.org/maven/' }
maven { url = 'https://impactdevelopment.github.io/maven/' }
maven { url = "https://jitpack.io" }
mavenCentral()
maven { url = 'https://jitpack.io' }
}

minecraft {
Expand Down Expand Up @@ -70,53 +68,40 @@ dependencies {
// Forge
minecraft "net.minecraftforge:forge:$minecraftVersion-$forgeVersion"

jarLibs('org.spongepowered:mixin:0.8.3') {
jarLibs('org.spongepowered:mixin:0.8.5') {
exclude module: 'commons-io'
exclude module: 'gson'
exclude module: 'guava'
exclude module: 'launchwrapper'
exclude module: 'log4j-core' // we want to exclude this as well because 0.8.3 includes it too new for MC
}

// Hacky way to get mixin work
annotationProcessor('org.spongepowered:mixin:0.8.3:processor') {
annotationProcessor('org.spongepowered:mixin:0.8.5:processor') {
exclude module: 'gson'
}

// Not the latest Reflections because it breaks Future compatibility :/
jarLibs('org.reflections:reflections:0.9.12') {
exclude module: 'gson'
exclude module: 'guava'
}

// Kotlin libs
// kotlin-stdlib-common and annotations aren't required at runtime
jarLibs("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}

jarLibs("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}
//noinspection GradlePackageUpdate
jarLibs 'org.reflections:reflections:0.9.12'

jarLibs("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}

jarLibs("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") {
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
exclude module: 'kotlin-stdlib'
}

jarLibs("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") {
exclude module: 'kotlin-stdlib-jdk8'
exclude module: 'kotlin-stdlib-common'
exclude module: 'annotations'
}

jarLibs "com.github.cbyrneee:DiscordIPC:e18542f600"
jarLibs('com.github.cbyrneee:DiscordIPC:e18542f600') {
exclude module: 'junixsocket-common'
exclude module: 'junixsocket-native-common'
exclude module: 'json'
}

// Add them back to compileOnly (provided)
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
Expand All @@ -134,7 +119,11 @@ dependencies {

mixin {
defaultObfuscationEnv 'searge'
add sourceSets.main, 'mixins.lambda.refmap.json'
sourceSets {
main {
ext.refMap = 'mixins.lambda.refmap.json'
}
}
}

processResources {
Expand All @@ -151,15 +140,15 @@ task sourceJar(type: Jar) { // Generate sources
group 'build'
description 'Assemble API library source archive'

archiveClassifier.set('api-source')
archiveClassifier.set 'api-source'
from sourceSets.main.allSource
}

task apiJar(type: Jar) {
group 'build'
description 'Assemble API library archive'

archiveClassifier.set('api')
archiveClassifier.set 'api'
from sourceSets.main.output
}

Expand All @@ -176,7 +165,17 @@ jar {

// Copy needed libs to jar
from {
exclude "**/module-info.class"
exclude '**/module-info.class',
'DebugProbesKt.bin',
'META-INF/maven/**',
'META-INF/proguard/**',
'META-INF/versions/**',
'META-INF/**.RSA',
'META-INF/com.android.tools/**',
'META-INF/*.kotlin_module',
'kotlin/**/*.kotlin_metadata',
'kotlin/**/*.kotlin_builtins',
'META-INF/*.version'
configurations.jarLibs.collect {
it.isDirectory() ? it : zipTree(it)
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.caching=true
org.gradle.parallel=true

modGroup=com.lambda
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading