Skip to content

Commit e09f035

Browse files
Nep NepAvanatiker
andauthored
Forgelin compat (#340)
* Initial take on forgelin/konas compat * Revert "Revert to ForgeGradle 4.+" This reverts commit ac36d99. * Revert "Revert "Revert to ForgeGradle 4.+"" This reverts commit 7cc4a0e. * Downgrade shadow to work with gradle 6 and by proxy FG4 * Change task structure Co-authored-by: Constructor <fractalminds@protonmail.com>
1 parent 10b2228 commit e09f035

File tree

2 files changed

+43
-28
lines changed

2 files changed

+43
-28
lines changed

.github/workflows/nightly_build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
with:
2323
java-version: 1.8
2424

25-
- name: Fix wrapper permissions
25+
- name: Elevate wrapper permissions
2626
run: chmod +x ./gradlew
2727

28-
- name: Gradle cache
28+
- name: Loading gradle cache
2929
uses: actions/cache@v2
3030
with:
3131
path: |
@@ -38,7 +38,7 @@ jobs:
3838
- name: Prepare workspace
3939
run: ./gradlew --no-daemon classes
4040

41-
- name: Build forge mod
41+
- name: Build lambda utility mod
4242
run: ./gradlew --build-cache build
4343

4444
- name: Rename built forge mod
@@ -64,7 +64,7 @@ jobs:
6464
path: lambda-${{ github.run_number }}-SHA256.txt
6565

6666
- name: Build plugin API
67-
run: ./gradlew apiJar --no-build-cache
67+
run: ./gradlew --no-build-cache buildApi
6868

6969
- name: Rename built plugin API
7070
run: mv build/libs/lambda-*-api.jar lambda-${{ github.run_number }}-api.jar

build.gradle

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ buildscript {
77
dependencies {
88
classpath 'net.minecraftforge.gradle:ForgeGradle:4.+'
99
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
10+
classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0'
1011
}
1112
}
1213

@@ -16,6 +17,7 @@ plugins {
1617

1718
apply plugin: 'net.minecraftforge.gradle'
1819
apply plugin: 'org.spongepowered.mixin'
20+
apply plugin: 'com.github.johnrengelman.shadow'
1921

2022
version project.modVersion
2123
group project.modGroup
@@ -132,24 +134,33 @@ processResources {
132134
}
133135
}
134136

135-
task sourceJar(type: Jar) { // Generate sources
137+
task buildApiSource(type: Jar) { // Generate sources
136138
group 'build'
137139
description 'Assemble API library source archive'
138140

139141
archiveClassifier.set 'api-source'
140142
from sourceSets.main.allSource
141143
}
142144

143-
task apiJar(type: Jar) {
145+
task buildApi(type: Jar) {
144146
group 'build'
145147
description 'Assemble API library archive'
146148

147149
archiveClassifier.set 'api'
148150
from sourceSets.main.output
149151
}
150152

151-
// Don't put baritone mixin here please c:
152-
jar {
153+
task buildAll {
154+
group 'build'
155+
description 'Assemble all jars'
156+
157+
dependsOn 'buildApi'
158+
dependsOn 'buildApiSource'
159+
dependsOn 'build'
160+
}
161+
162+
shadowJar {
163+
// Don't put baritone mixin here please c:
153164
manifest.attributes(
154165
'Manifest-Version': 1.0,
155166
'MixinConfigs': 'mixins.lambda.json',
@@ -159,27 +170,31 @@ jar {
159170
'ForceLoadAsMod': 'true'
160171
)
161172

162-
// Copy needed libs to jar
163-
from {
164-
exclude '**/module-info.class',
165-
'DebugProbesKt.bin',
166-
'META-INF/proguard/**',
167-
'META-INF/versions/**',
168-
'META-INF/**.RSA',
169-
'META-INF/com.android.tools/**',
170-
'META-INF/*.kotlin_module',
171-
'kotlin/**/*.kotlin_metadata',
172-
'kotlin/**/*.kotlin_builtins',
173-
'META-INF/*.version'
174-
configurations.jarLibs.collect {
175-
it.isDirectory() ? it : zipTree(it)
176-
}
173+
archiveClassifier.set('')
174+
exclude '**/module-info.class',
175+
'DebugProbesKt.bin',
176+
'META-INF/proguard/**',
177+
'META-INF/versions/**',
178+
'META-INF/**.RSA',
179+
'META-INF/com.android.tools/**',
180+
'META-INF/*.kotlin_module',
181+
'kotlin/**/*.kotlin_metadata',
182+
'kotlin/**/*.kotlin_builtins',
183+
'META-INF/*.version'
184+
configurations = [project.configurations.jarLibs]
185+
relocate 'kotlin', 'com.lambda.shadow.kotlin'
186+
relocate 'kotlinx', 'com.lambda.shadow.kotlinx'
187+
finalizedBy 'reobfShadowJar'
188+
}
189+
190+
reobf {
191+
shadowJar {}
192+
jar {
193+
enabled = false
177194
}
178195
}
179196

180-
task buildApi {
181-
group 'build'
182-
dependsOn sourceJar
183-
dependsOn apiJar
184-
description 'Assemble API library archives'
197+
artifacts {
198+
shadowJar
185199
}
200+

0 commit comments

Comments
 (0)