From b628a871332a0a85ccf3dd0913fd180543efe562 Mon Sep 17 00:00:00 2001 From: Gabriel Harris-Rouquette Date: Tue, 14 Apr 2020 19:55:08 -0700 Subject: [PATCH] Some fixes with build script setup and licenses Signed-off-by: Gabriel Harris-Rouquette --- SpongeAPI | 2 +- build.gradle.kts | 1 + config/checkstyle/checkstyle.xml | 41 ++++++++++ config/checkstyle/suppressions.xml | 25 ++++++ .../common/data/util/DataUtil.java | 24 ++++++ .../mixin/invalid/core/item/ItemMixin.java | 24 ++++++ .../core/tileentity/TileEntityMixin.java | 24 ++++++ .../common/util/SpongeHooks.java | 24 ++++++ settings.gradle.kts | 2 +- .../util/EntityDamageSourceAccessor.java | 24 ++++++ .../block/DispenserBlockAccessor.java | 24 ++++++ .../accessor/item/ArmorItemAccessor.java | 24 ++++++ .../PlayerProfileCacheAccessor.java | 24 ++++++ .../common/util/PrettyPrinter.java | 24 ++++++ .../common/data/package-info.java | 24 ++++++ ...odlauncher.serviceapi.ILaunchPluginService | 1 + .../SpongeModLauncherLaunchService.java | 78 +++++++++++++++++++ .../SuperClassTransformationService.java | 24 ++++++ 18 files changed, 412 insertions(+), 2 deletions(-) create mode 100644 config/checkstyle/checkstyle.xml create mode 100644 config/checkstyle/suppressions.xml create mode 100644 src/modLauncher/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService create mode 100644 src/modlauncher/java/org/spongepowered/common/modlauncher/service/SpongeModLauncherLaunchService.java diff --git a/SpongeAPI b/SpongeAPI index 4aa6ee41f..7833d94a5 160000 --- a/SpongeAPI +++ b/SpongeAPI @@ -1 +1 @@ -Subproject commit 4aa6ee41f30b9dce60b1c79be092d55828767553 +Subproject commit 7833d94a5f8b457a9bab276dfff4107950c1d6c6 diff --git a/build.gradle.kts b/build.gradle.kts index 1316f3671..fcbaabf3c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,6 +23,7 @@ apply { spongeDev { api(project.project("SpongeAPI")) + common(project) addedSourceSets { register("mixins") { sourceType.set(SourceType.Mixin) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 000000000..a02a4b107 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml new file mode 100644 index 000000000..98c15c566 --- /dev/null +++ b/config/checkstyle/suppressions.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/invalid/main/java/org/spongepowered/common/data/util/DataUtil.java b/invalid/main/java/org/spongepowered/common/data/util/DataUtil.java index 505fe9ef1..96799b92c 100644 --- a/invalid/main/java/org/spongepowered/common/data/util/DataUtil.java +++ b/invalid/main/java/org/spongepowered/common/data/util/DataUtil.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.common.data.util; import java.util.Collections; diff --git a/invalid/main/java/org/spongepowered/common/mixin/invalid/core/item/ItemMixin.java b/invalid/main/java/org/spongepowered/common/mixin/invalid/core/item/ItemMixin.java index 267ca2ae6..3bfc1167e 100644 --- a/invalid/main/java/org/spongepowered/common/mixin/invalid/core/item/ItemMixin.java +++ b/invalid/main/java/org/spongepowered/common/mixin/invalid/core/item/ItemMixin.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.common.mixin.invalid.core.item; import java.util.List; diff --git a/invalid/main/java/org/spongepowered/common/mixin/invalid/core/tileentity/TileEntityMixin.java b/invalid/main/java/org/spongepowered/common/mixin/invalid/core/tileentity/TileEntityMixin.java index abab0f4b6..66e207633 100644 --- a/invalid/main/java/org/spongepowered/common/mixin/invalid/core/tileentity/TileEntityMixin.java +++ b/invalid/main/java/org/spongepowered/common/mixin/invalid/core/tileentity/TileEntityMixin.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.common.mixin.invalid.core.tileentity; import net.minecraft.tileentity.TileEntity; diff --git a/invalid/main/java/org/spongepowered/common/util/SpongeHooks.java b/invalid/main/java/org/spongepowered/common/util/SpongeHooks.java index e71bae5f4..033f3808e 100644 --- a/invalid/main/java/org/spongepowered/common/util/SpongeHooks.java +++ b/invalid/main/java/org/spongepowered/common/util/SpongeHooks.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.common.util; public class SpongeHooks { diff --git a/settings.gradle.kts b/settings.gradle.kts index 6e11fca3f..e8d6b16f4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -11,7 +11,7 @@ pluginManagement { resolutionStrategy { eachPlugin { if (requested.id.id.startsWith("org.spongepowered.gradle.")) { - val version = requested.version ?: "0.11.2-SNAPSHOT" + val version = requested.version ?: "0.11.3-SNAPSHOT" useModule("org.spongepowered:SpongeGradle:$version") } } diff --git a/src/accessors/java/org/spongepowered/accessor/util/EntityDamageSourceAccessor.java b/src/accessors/java/org/spongepowered/accessor/util/EntityDamageSourceAccessor.java index 452cf6410..ad23fa272 100644 --- a/src/accessors/java/org/spongepowered/accessor/util/EntityDamageSourceAccessor.java +++ b/src/accessors/java/org/spongepowered/accessor/util/EntityDamageSourceAccessor.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.accessor.util; import net.minecraft.entity.Entity; diff --git a/src/accessors/java/org/spongepowered/common/accessor/block/DispenserBlockAccessor.java b/src/accessors/java/org/spongepowered/common/accessor/block/DispenserBlockAccessor.java index e3d4d455a..177aa44fe 100644 --- a/src/accessors/java/org/spongepowered/common/accessor/block/DispenserBlockAccessor.java +++ b/src/accessors/java/org/spongepowered/common/accessor/block/DispenserBlockAccessor.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.common.accessor.block; import net.minecraft.block.DispenserBlock; diff --git a/src/accessors/java/org/spongepowered/common/accessor/item/ArmorItemAccessor.java b/src/accessors/java/org/spongepowered/common/accessor/item/ArmorItemAccessor.java index 6ce252d06..848f54587 100644 --- a/src/accessors/java/org/spongepowered/common/accessor/item/ArmorItemAccessor.java +++ b/src/accessors/java/org/spongepowered/common/accessor/item/ArmorItemAccessor.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.common.accessor.item; import net.minecraft.item.ArmorItem; diff --git a/src/accessors/java/org/spongepowered/common/accessor/server/management/PlayerProfileCacheAccessor.java b/src/accessors/java/org/spongepowered/common/accessor/server/management/PlayerProfileCacheAccessor.java index 02cc4633b..139539702 100644 --- a/src/accessors/java/org/spongepowered/common/accessor/server/management/PlayerProfileCacheAccessor.java +++ b/src/accessors/java/org/spongepowered/common/accessor/server/management/PlayerProfileCacheAccessor.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.common.accessor.server.management; import net.minecraft.server.management.PlayerProfileCache; diff --git a/src/launch/java/org/spongepowered/common/util/PrettyPrinter.java b/src/launch/java/org/spongepowered/common/util/PrettyPrinter.java index 1c89e786d..09c328640 100644 --- a/src/launch/java/org/spongepowered/common/util/PrettyPrinter.java +++ b/src/launch/java/org/spongepowered/common/util/PrettyPrinter.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.common.util; import java.io.PrintStream; diff --git a/src/main/java/org/spongepowered/common/data/package-info.java b/src/main/java/org/spongepowered/common/data/package-info.java index 41d23ab3f..8e51f803e 100644 --- a/src/main/java/org/spongepowered/common/data/package-info.java +++ b/src/main/java/org/spongepowered/common/data/package-info.java @@ -1,2 +1,26 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ @org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) package org.spongepowered.common.data; \ No newline at end of file diff --git a/src/modLauncher/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService b/src/modLauncher/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService new file mode 100644 index 000000000..4455b7906 --- /dev/null +++ b/src/modLauncher/resources/META-INF/services/cpw.mods.modlauncher.serviceapi.ILaunchPluginService @@ -0,0 +1 @@ +org.spongepowered.common.modlauncher.loading.SpongeModLauncherLaunchService \ No newline at end of file diff --git a/src/modlauncher/java/org/spongepowered/common/modlauncher/service/SpongeModLauncherLaunchService.java b/src/modlauncher/java/org/spongepowered/common/modlauncher/service/SpongeModLauncherLaunchService.java new file mode 100644 index 000000000..591bd54b0 --- /dev/null +++ b/src/modlauncher/java/org/spongepowered/common/modlauncher/service/SpongeModLauncherLaunchService.java @@ -0,0 +1,78 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ +package org.spongepowered.common.modlauncher.loading; + +import cpw.mods.modlauncher.TransformingClassLoader; +import cpw.mods.modlauncher.serviceapi.ILaunchPluginService; +import org.objectweb.asm.Type; +import org.objectweb.asm.tree.ClassNode; + +import java.nio.file.Path; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.List; + +public class SpongeModLauncherLaunchService implements ILaunchPluginService { + + private static final List PROTECTED_PACKAGES = Arrays.asList( + "org.spongepowered.common.event.tracking.", + "org.spongepowered.common.launch.", + "org.spongepowered.common.modLauncher.", + "org.spongepowered.common.util." + ); + + public static final String NAME = "spongecommon"; + + @Override + public String name() { + return SpongeModLauncherLaunchService.NAME; + } + + @Override + public EnumSet handlesClass(final Type classType, final boolean isEmpty) { + return null; + } + + @Override + public EnumSet handlesClass(Type classType, boolean isEmpty, String reason) { + return EnumSet.noneOf(Phase.class); + } + + @Override + public boolean processClass(final Phase phase, final ClassNode classNode, final Type classType) { + throw new UnsupportedOperationException("Outdated ModLauncher"); + } + + @Override + public boolean processClass(Phase phase, ClassNode classNode, Type classType, String reason) { + return false; + } + + @Override + public void initializeLaunch(final ITransformerLoader transformerLoader, final Path[] specialPaths) { + final TransformingClassLoader classLoader = (TransformingClassLoader) Thread.currentThread().getContextClassLoader(); + classLoader.addTargetPackageFilter(name -> PROTECTED_PACKAGES.stream().noneMatch(name::startsWith)); + } +} diff --git a/src/modlauncher/java/org/spongepowered/common/modlauncher/service/SuperClassTransformationService.java b/src/modlauncher/java/org/spongepowered/common/modlauncher/service/SuperClassTransformationService.java index e90d8a6ee..a41ae153d 100644 --- a/src/modlauncher/java/org/spongepowered/common/modlauncher/service/SuperClassTransformationService.java +++ b/src/modlauncher/java/org/spongepowered/common/modlauncher/service/SuperClassTransformationService.java @@ -1,3 +1,27 @@ +/* + * This file is part of Sponge, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * Copyright (c) contributors + * + * 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. + */ package org.spongepowered.common.modlauncher.service; import cpw.mods.modlauncher.api.IEnvironment;