From ce71e88c1b4d7c6fc75e4ce34874fce28b3142aa Mon Sep 17 00:00:00 2001 From: Master7720 <80098736+master7720@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:44:43 -0800 Subject: [PATCH 01/12] improvements and updated to 1.20.4 --- HEADER | 35 ++- LICENSE | 222 ++---------------- build.gradle | 82 ++----- gradle.properties | 14 +- gradle/wrapper/gradle-wrapper.properties | 6 +- .../language/scala/ScalaLanguageAdapter.scala | 43 ++-- .../net/fabricmc/language/scala/TestMod.scala | 41 ++-- 7 files changed, 134 insertions(+), 309 deletions(-) diff --git a/HEADER b/HEADER index f51ef31..bd666a5 100644 --- a/HEADER +++ b/HEADER @@ -1,13 +1,24 @@ -Copyright 2016, 2018, 2019 FabricMC +/* + * This file is part of fabric-loom, licensed under the MIT License (MIT). + * + * Copyright (c) $YEAR FabricMC + * + * 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. + */ -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/LICENSE b/LICENSE index 9c8f3ea..9ef50b1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,21 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file +MIT License + +Copyright (c) 2016 FabricMC + +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. diff --git a/build.gradle b/build.gradle index ce55b4a..0b4a3bc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,29 +1,27 @@ plugins { - id "java-library" - id "scala" - id "maven-publish" - id 'fabric-loom' version '0.10.30' - id "com.matthewprenger.cursegradle" version "1.4.0" + id 'java-library' + id 'scala' + id 'maven-publish' + id 'fabric-loom' version '1.5-SNAPSHOT' } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = project.archives_base_name group = project.maven_group -version = mod_version -def ENV = System.getenv() -version = version + "+scala." + project.scala_version + (ENV.GITHUB_ACTIONS ? "" : ".local") +version = mod_version + "+scala." + project.scala_version + (System.getenv('GITHUB_ACTIONS') ? "" : ".local") dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - include(api("org.scala-lang:scala3-library_3:${project.scala_version}")) - // Depended on by scala3 - include(api("org.scala-lang:scala-library:2.13.6")) + // Scala Dependencies + implementation "org.scala-lang:scala3-library_3:${project.scala_version}" + implementation "org.scala-lang:scala-reflect:${project.scala_reflect_version}" + implementation "org.scala-lang.modules:scala-xml_3:${project.scala_xml_version}"// might be unnecessary but wtv } processResources { @@ -39,49 +37,22 @@ java { } publishing { - publications { - maven(MavenPublication) { + publications { + maven(MavenPublication) { from components.java - } - } - repositories { - repositories { - if (ENV.MAVEN_URL) { - maven { - url ENV.MAVEN_URL - credentials { - username ENV.MAVEN_USERNAME - password ENV.MAVEN_PASSWORD - } + } + } + repositories { + if (System.getenv('MAVEN_URL')) { + maven { + url System.getenv('MAVEN_URL') + credentials { + username System.getenv('MAVEN_USERNAME') + password System.getenv('MAVEN_PASSWORD') } } } - } -} - -curseforge { - if (ENV.CURSEFORGE_API_KEY) { - apiKey = ENV.CURSEFORGE_API_KEY } - - project { - id = '309275' - changelog = 'A changelog can be found at https://github.com/FabricMC/fabric-language-scala/commits/master' - releaseType = 'release' - addGameVersion '1.17.1' - addGameVersion '1.16.5' - addGameVersion '1.15.2' - addGameVersion '1.14.4' - addGameVersion "Fabric" - - mainArtifact(file("${project.buildDir}/libs/${base.archivesBaseName}-${version}.jar")) { - displayName = "Fabric Language Scala $version" - } - } - - options { - forgeGradleIntegration = false - } } // A task to ensure that the version being released has not already been released. @@ -94,7 +65,4 @@ task checkVersion { throw new RuntimeException("${version} has already been released!") } } -} - -publish.mustRunAfter checkVersion -project.tasks.curseforge.mustRunAfter checkVersion \ No newline at end of file +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 41d57cf..b03e414 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,14 +2,18 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use -minecraft_version=1.17.1 -yarn_mappings=1.17.1+build.61 -loader_version=0.11.7 +minecraft_version=1.20.4 +yarn_mappings=1.20.4+build.3 +loader_version=0.15.7 + # Mod Properties mod_version=2.0.0 maven_group=net.fabricmc archives_base_name=fabric-language-scala description=Fabric language module for Scala url=https://github.com/FabricMC/fabric-language-scala/ -# Other -scala_version=3.0.2 + +# Scala +scala_version=3.4.2-RC1-bin-20240226-e0cb1e7-NIGHTLY +scala_reflect_version=2.13.13 +scala_xml_version=2.2.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 47f7bc8..92c1ac1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-rc-1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/src/main/scala/net/fabricmc/language/scala/ScalaLanguageAdapter.scala b/src/main/scala/net/fabricmc/language/scala/ScalaLanguageAdapter.scala index 41d42d3..9d2d2bb 100644 --- a/src/main/scala/net/fabricmc/language/scala/ScalaLanguageAdapter.scala +++ b/src/main/scala/net/fabricmc/language/scala/ScalaLanguageAdapter.scala @@ -1,37 +1,46 @@ /* - * Copyright 2016, 2018, 2019 FabricMC + * This file is part of fabric-loom, licensed under the MIT License (MIT). * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2023 FabricMC * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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: * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ package net.fabricmc.language.scala - import net.fabricmc.loader.api.{LanguageAdapter, ModContainer} +import scala.util.{Failure, Success, Try} + class ScalaLanguageAdapter extends LanguageAdapter { override def create[T](modContainer: ModContainer, s: String, aClass: Class[T]): T = { - try { + Try { val objectClass = Class.forName(s + "$") val moduleField = objectClass.getField("MODULE$") val instance = moduleField.get(null).asInstanceOf[T] - if (instance == null) throw new NullPointerException - instance - } catch { - case _: Exception => + Option(instance).getOrElse(throw new NullPointerException) + } match { + case Success(instance) => instance + case Failure(_) => println(s"Unable to find ${aClass.getName}$$MODULE$$") aClass.getConstructor().newInstance() } } -} +} \ No newline at end of file diff --git a/src/test/scala/net/fabricmc/language/scala/TestMod.scala b/src/test/scala/net/fabricmc/language/scala/TestMod.scala index 981895b..1fe1173 100644 --- a/src/test/scala/net/fabricmc/language/scala/TestMod.scala +++ b/src/test/scala/net/fabricmc/language/scala/TestMod.scala @@ -1,17 +1,25 @@ /* - * Copyright 2016, 2018, 2019 FabricMC + * This file is part of fabric-loom, licensed under the MIT License (MIT). * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Copyright (c) 2023 FabricMC * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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: * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ package net.fabricmc.language.scala @@ -22,9 +30,12 @@ import net.minecraft.block.Blocks object TestMod extends ModInitializer { override def onInitialize(): Unit = { - System.out.println("**********************") - System.out.println("Hello from Scala!") - System.out.println("Hello " + Blocks.DIRT) - System.out.println("**********************") + val message = """ + |********************** + |Hello from Scala! + |Hello ${Blocks.DIRT}! + |********************** + |""".stripMargin + println(message) } -} +} \ No newline at end of file From 845125e9de8a8f5becb1bb458ee63ccbf845a30c Mon Sep 17 00:00:00 2001 From: Master7720 <80098736+master7720@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:44:44 -0800 Subject: [PATCH 02/12] weird spacing issue frick you intellij --- .../net/fabricmc/language/scala/TestMod.scala | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/test/scala/net/fabricmc/language/scala/TestMod.scala b/src/test/scala/net/fabricmc/language/scala/TestMod.scala index 1fe1173..e48cbee 100644 --- a/src/test/scala/net/fabricmc/language/scala/TestMod.scala +++ b/src/test/scala/net/fabricmc/language/scala/TestMod.scala @@ -27,15 +27,13 @@ package net.fabricmc.language.scala import net.fabricmc.api.ModInitializer import net.minecraft.block.Blocks -object TestMod extends ModInitializer { - override def onInitialize(): Unit = { val message = """ - |********************** - |Hello from Scala! - |Hello ${Blocks.DIRT}! - |********************** - |""".stripMargin + |********************** + |Hello from Scala! + |Hello ${Blocks.DIRT}! + |********************** + |""".stripMargin println(message) } -} \ No newline at end of file +} From 40e14446eaec6cda153da8da5a3c6b12fb54a913 Mon Sep 17 00:00:00 2001 From: Master7720 <80098736+master7720@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:45:02 -0800 Subject: [PATCH 03/12] Update HEADER --- HEADER | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HEADER b/HEADER index bd666a5..57601fc 100644 --- a/HEADER +++ b/HEADER @@ -1,5 +1,5 @@ /* - * This file is part of fabric-loom, licensed under the MIT License (MIT). + * This file is part of fabric, licensed under the MIT License (MIT). * * Copyright (c) $YEAR FabricMC * From 5b462fc135eda30a4ba89b7e3d2e8d262fa34142 Mon Sep 17 00:00:00 2001 From: Master7720 <80098736+master7720@users.noreply.github.com> Date: Fri, 1 Mar 2024 07:46:40 -0800 Subject: [PATCH 04/12] Update build.gradle --- build.gradle | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 0b4a3bc..e1ff728 100644 --- a/build.gradle +++ b/build.gradle @@ -5,9 +5,8 @@ plugins { id 'fabric-loom' version '1.5-SNAPSHOT' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 archivesBaseName = project.archives_base_name group = project.maven_group @@ -65,4 +64,4 @@ task checkVersion { throw new RuntimeException("${version} has already been released!") } } -} \ No newline at end of file +} From f0488953bae71be422391a9f231dce24ce5ec6da Mon Sep 17 00:00:00 2001 From: Master7720 <80098736+master7720@users.noreply.github.com> Date: Fri, 1 Mar 2024 14:09:50 -0800 Subject: [PATCH 05/12] stable version of scala --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b03e414..46a284d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,6 +14,6 @@ description=Fabric language module for Scala url=https://github.com/FabricMC/fabric-language-scala/ # Scala -scala_version=3.4.2-RC1-bin-20240226-e0cb1e7-NIGHTLY +scala_version=3.4.0 scala_reflect_version=2.13.13 scala_xml_version=2.2.0 From 1774b97871e9e3ac870e8e38d85e34ac424e19da Mon Sep 17 00:00:00 2001 From: Master7720 <80098736+master7720@users.noreply.github.com> Date: Fri, 1 Mar 2024 18:36:02 -0800 Subject: [PATCH 06/12] Update HEADER --- HEADER | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/HEADER b/HEADER index 57601fc..f51ef31 100644 --- a/HEADER +++ b/HEADER @@ -1,24 +1,13 @@ -/* - * This file is part of fabric, licensed under the MIT License (MIT). - * - * Copyright (c) $YEAR FabricMC - * - * 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. - */ +Copyright 2016, 2018, 2019 FabricMC +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. From 47d74ae3911c205416713edc9d34dee0f0b48d17 Mon Sep 17 00:00:00 2001 From: Master7720 <80098736+master7720@users.noreply.github.com> Date: Fri, 1 Mar 2024 18:37:14 -0800 Subject: [PATCH 07/12] Update LICENSE --- LICENSE | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 201 insertions(+), 21 deletions(-) diff --git a/LICENSE b/LICENSE index 9ef50b1..8dada3e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,201 @@ -MIT License - -Copyright (c) 2016 FabricMC - -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. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From f02ae6ea3f664d342ef5cd7ed3f284b618592708 Mon Sep 17 00:00:00 2001 From: Master7720 <80098736+master7720@users.noreply.github.com> Date: Fri, 1 Mar 2024 18:37:54 -0800 Subject: [PATCH 08/12] Update ScalaLanguageAdapter.scala --- .../language/scala/ScalaLanguageAdapter.scala | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/main/scala/net/fabricmc/language/scala/ScalaLanguageAdapter.scala b/src/main/scala/net/fabricmc/language/scala/ScalaLanguageAdapter.scala index 9d2d2bb..750f0da 100644 --- a/src/main/scala/net/fabricmc/language/scala/ScalaLanguageAdapter.scala +++ b/src/main/scala/net/fabricmc/language/scala/ScalaLanguageAdapter.scala @@ -1,25 +1,17 @@ /* - * This file is part of fabric-loom, licensed under the MIT License (MIT). + * Copyright 2016, 2018, 2019 FabricMC * - * Copyright (c) 2023 FabricMC + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 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. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package net.fabricmc.language.scala @@ -43,4 +35,4 @@ class ScalaLanguageAdapter extends LanguageAdapter { aClass.getConstructor().newInstance() } } -} \ No newline at end of file +} From d112a24dcad271247da88ac6eadea6c351cf2e9d Mon Sep 17 00:00:00 2001 From: Master7720 <80098736+master7720@users.noreply.github.com> Date: Fri, 1 Mar 2024 18:38:17 -0800 Subject: [PATCH 09/12] Update TestMod.scala --- .../net/fabricmc/language/scala/TestMod.scala | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/test/scala/net/fabricmc/language/scala/TestMod.scala b/src/test/scala/net/fabricmc/language/scala/TestMod.scala index e48cbee..de381bc 100644 --- a/src/test/scala/net/fabricmc/language/scala/TestMod.scala +++ b/src/test/scala/net/fabricmc/language/scala/TestMod.scala @@ -1,25 +1,17 @@ /* - * This file is part of fabric-loom, licensed under the MIT License (MIT). + * Copyright 2016, 2018, 2019 FabricMC * - * Copyright (c) 2023 FabricMC + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * 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: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 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. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package net.fabricmc.language.scala From f7ba0d029ffbe5185fafe12d41ba1a88b89b3d0a Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 4 Mar 2024 09:36:33 +0000 Subject: [PATCH 10/12] Fixes --- LICENSE | 2 +- src/test/scala/net/fabricmc/language/scala/TestMod.scala | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 8dada3e..9c8f3ea 100644 --- a/LICENSE +++ b/LICENSE @@ -198,4 +198,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. \ No newline at end of file diff --git a/src/test/scala/net/fabricmc/language/scala/TestMod.scala b/src/test/scala/net/fabricmc/language/scala/TestMod.scala index de381bc..fbe1e89 100644 --- a/src/test/scala/net/fabricmc/language/scala/TestMod.scala +++ b/src/test/scala/net/fabricmc/language/scala/TestMod.scala @@ -19,6 +19,7 @@ package net.fabricmc.language.scala import net.fabricmc.api.ModInitializer import net.minecraft.block.Blocks +object TestMod extends ModInitializer { override def onInitialize(): Unit = { val message = """ |********************** From b9a5c25dc5cf042f42b023eb6225720661298457 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 4 Mar 2024 09:53:26 +0000 Subject: [PATCH 11/12] Remove libs we dont need --- build.gradle | 2 -- gradle.properties | 2 -- 2 files changed, 4 deletions(-) diff --git a/build.gradle b/build.gradle index e1ff728..1ae3f24 100644 --- a/build.gradle +++ b/build.gradle @@ -19,8 +19,6 @@ dependencies { // Scala Dependencies implementation "org.scala-lang:scala3-library_3:${project.scala_version}" - implementation "org.scala-lang:scala-reflect:${project.scala_reflect_version}" - implementation "org.scala-lang.modules:scala-xml_3:${project.scala_xml_version}"// might be unnecessary but wtv } processResources { diff --git a/gradle.properties b/gradle.properties index 46a284d..13d38aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,5 +15,3 @@ url=https://github.com/FabricMC/fabric-language-scala/ # Scala scala_version=3.4.0 -scala_reflect_version=2.13.13 -scala_xml_version=2.2.0 From b1391e1243d9052146240457e65cd64eacbfa3fa Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Mon, 4 Mar 2024 09:56:31 +0000 Subject: [PATCH 12/12] Fix actions --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e6727a0..c9b18e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ jobs: build: strategy: matrix: - java: [16-jdk, 17-jdk] + java: [17-jdk] runs-on: ubuntu-20.04 container: image: openjdk:${{ matrix.java }}