diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2021-09-20 19:10:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 00:10:50 +0800 |
commit | 979a9d488285ff25573e62a38a1054603f281a7c (patch) | |
tree | a844d2dbc7eb1831188ad2974d19e2e6b6c5d246 /src/main/java/net/fabricmc/loom/util/PropertyUtil.java | |
parent | 6522a826e1adba9a55070df3d4ae38ecfcfce565 (diff) | |
download | architectury-loom-979a9d488285ff25573e62a38a1054603f281a7c.tar.gz architectury-loom-979a9d488285ff25573e62a38a1054603f281a7c.tar.bz2 architectury-loom-979a9d488285ff25573e62a38a1054603f281a7c.zip |
Move all Forge-only properties to Forge extension (#46)
Diffstat (limited to 'src/main/java/net/fabricmc/loom/util/PropertyUtil.java')
-rw-r--r-- | src/main/java/net/fabricmc/loom/util/PropertyUtil.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/net/fabricmc/loom/util/PropertyUtil.java b/src/main/java/net/fabricmc/loom/util/PropertyUtil.java new file mode 100644 index 00000000..98e85b68 --- /dev/null +++ b/src/main/java/net/fabricmc/loom/util/PropertyUtil.java @@ -0,0 +1,45 @@ +/* + * This file is part of fabric-loom, licensed under the MIT License (MIT). + * + * Copyright (c) 2021 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. + */ + +package net.fabricmc.loom.util; + +import org.gradle.api.provider.HasConfigurableValue; +import org.gradle.api.provider.Provider; + +/** + * Working with properties. + */ +public final class PropertyUtil { + /** + * Gets a property and finalizes its value. + * + * @param property the property + * @param <T> the value type + * @return the current property value + */ + public static <T, P extends Provider<T> & HasConfigurableValue> T getAndFinalize(P property) { + property.finalizeValue(); + return property.get(); + } +} |