@@ -47,6 +47,88 @@ minecraft_fp {
4747 }
4848}
4949
50+ val java8Compiler = javaToolchains.compilerFor {
51+ languageVersion = JavaLanguageVersion .of(8 )
52+ vendor = JvmVendorSpec .ADOPTIUM
53+ }
54+
55+ fun createSourceSet (name : String , shareDeps : Boolean ): SourceSet {
56+ val set = sourceSets.create(name) {
57+ if (shareDeps) {
58+ compileClasspath + = sourceSets[" patchedMc" ].output
59+ }
60+ }
61+ tasks.named<JavaCompile >(set.compileJavaTaskName).configure {
62+ javaCompiler = java8Compiler
63+ }
64+ afterEvaluate {
65+ tasks.named<JavaCompile >(set.compileJavaTaskName).configure {
66+ this .sourceCompatibility = " 8"
67+ this .targetCompatibility = " 8"
68+ this .options.release = null
69+ }
70+ }
71+ if (shareDeps) {
72+
73+ configurations.named(set.compileClasspathConfigurationName) {
74+ extendsFrom(configurations.getByName(" compileClasspath" ))
75+ exclude(" com.falsepattern" , " falsepatternlib-mc1.7.10" )
76+ }
77+ configurations.named(set.runtimeClasspathConfigurationName) {
78+ extendsFrom(configurations.getByName(" runtimeClasspath" ))
79+ exclude(" com.falsepattern" , " falsepatternlib-mc1.7.10" )
80+ }
81+ configurations.named(set.annotationProcessorConfigurationName) {
82+ extendsFrom(configurations.getByName(" annotationProcessor" ))
83+ exclude(" com.falsepattern" , " falsepatternlib-mc1.7.10" )
84+ }
85+ }
86+
87+ return set
88+ }
89+
90+ val depLoader = createSourceSet(" deploader" , true )
91+
92+ val depLoaderJar = tasks.register<Jar >(depLoader.jarTaskName) {
93+ from(depLoader.output)
94+ archiveBaseName = " falsepatternlib-mc1.7.10"
95+ archiveVersion = minecraft_fp.mod.version
96+ archiveClassifier = " deploader"
97+ manifest {
98+ attributes(" FPLib-Deploader-Version" to " 1" )
99+ }
100+ }
101+
102+ val depLoaderStub = createSourceSet(" deploaderStub" , true )
103+
104+ val depLoaderStubJar = tasks.register<Jar >(depLoaderStub.jarTaskName) {
105+ from(depLoaderStub.output)
106+ archiveBaseName = " falsepatternlib-mc1.7.10"
107+ archiveVersion = minecraft_fp.mod.version
108+ archiveClassifier = " deploader_stub"
109+ }
110+
111+ sourceSets[" main" ].compileClasspath + = depLoader.output
112+ sourceSets[" main" ].compileClasspath + = depLoaderStub.output
113+
114+ afterEvaluate {
115+ for (outgoingConfig in listOf (" runtimeElements" , " apiElements" )) {
116+ val outgoing = configurations.getByName(outgoingConfig)
117+ outgoing.outgoing.artifact(depLoaderStubJar)
118+ outgoing.outgoing.artifact(depLoaderJar)
119+ }
120+ }
121+
122+ tasks.jar {
123+ dependsOn(depLoaderJar, depLoaderStubJar)
124+ from(depLoaderJar.map { it.archiveFile }) {
125+ rename { " fplib_deploader.jar" }
126+ }
127+ from(zipTree(depLoaderStubJar.map { it.archiveFile })) {
128+ exclude(" META-INF/MANIFEST.MF" )
129+ }
130+ }
131+
50132repositories {
51133 exclusive(maven(" horizon" , " https://mvn.falsepattern.com/horizon/" ), " com.gtnewhorizons.retrofuturabootstrap" )
52134 exclusive(horizon()) {
0 commit comments