mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-11 19:14:11 +00:00
VolmLib pin removal
- The build resolves VolmLib master-SNAPSHOT when no sibling checkout is substituted - The native runtime manifest, roots and keep rules come from the embedded natives - The packed jar natives are verified against the embedded provider shas - Every jar carries META-INF/volmit/volmlib.properties - The build logs the resolved VolmLib once - publishedNativeRuntime, the loader coordinate flags, mavenLocal and publish-volmlib are gone
This commit is contained in:
@@ -13,13 +13,12 @@ Configuration kernelDependencies = configurations.create('generationKernelDepend
|
||||
extendsFrom(configurations.implementation, configurations.slim, configurations.annotationProcessor)
|
||||
}
|
||||
dependencies.add(kernelDependencies.name, libs.guava)
|
||||
String nativeLibraryVersion = providers.gradleProperty('volmLibCoordinate').get().tokenize(':').last()
|
||||
List<String> nativeRevisionModules = ['native-common', 'native-minecraft26_2-sources']
|
||||
for (String adapter : rootProject.extensions.extraProperties.get('nativeDevelopmentAdapters')) {
|
||||
nativeRevisionModules.add('native-' + adapter)
|
||||
}
|
||||
for (String module : nativeRevisionModules) {
|
||||
dependencies.add(kernelDependencies.name, "com.github.VolmitSoftware.VolmLib:${module}:${nativeLibraryVersion}") {
|
||||
dependencies.add(kernelDependencies.name, "com.github.VolmitSoftware.VolmLib:${module}:master-SNAPSHOT") {
|
||||
transitive = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,12 @@ Configuration nativeMinecraftSources = configurations.create('nativeMinecraftSou
|
||||
canBeResolved = true
|
||||
}
|
||||
|
||||
Properties nativeLibraryProperties = new Properties()
|
||||
file('../../gradle.properties').withInputStream { InputStream stream -> nativeLibraryProperties.load(stream) }
|
||||
String nativeLibraryCoordinate = providers.gradleProperty('volmLibCoordinate')
|
||||
.getOrElse(nativeLibraryProperties.getProperty('volmLibCoordinate'))
|
||||
String nativeSourceLoader = extensions.extraProperties.get('nativeSourceLoader')
|
||||
String nativeSourceImplementation = 'minecraft26_2'
|
||||
String nativeSourceMinecraftVersion = providers.gradleProperty('minecraftVersion').getOrElse('26.3')
|
||||
extensions.extraProperties.set('nativeSourceImplementation', nativeSourceImplementation)
|
||||
dependencies.add(nativeMinecraftSources.name,
|
||||
"com.github.VolmitSoftware.VolmLib:native-${nativeSourceImplementation}-sources:${nativeLibraryCoordinate.tokenize(':').last()}")
|
||||
"com.github.VolmitSoftware.VolmLib:native-${nativeSourceImplementation}-sources:master-SNAPSHOT")
|
||||
|
||||
TaskProvider<Sync> unpackNativeMinecraftSources = tasks.register('unpackNativeMinecraftSources', Sync) {
|
||||
dependsOn(nativeMinecraftSources)
|
||||
|
||||
@@ -40,10 +40,17 @@
|
||||
* otherwise walk up from settingsDir looking for a `VolmLib` directory
|
||||
* that contains a settings script.
|
||||
*
|
||||
* When nothing is found the build falls back to the published `volmLibCoordinate` from
|
||||
* gradle.properties.
|
||||
* When nothing is found, or substitution is disabled, every VolmLib coordinate resolves the published
|
||||
* master-SNAPSHOT from JitPack instead, re-checked on every build like the rest of the plugin fleet.
|
||||
*
|
||||
* The outcome is logged once per top-level build and handed to the build scripts through `gradle`
|
||||
* extra properties: `volmLibDirectory` (the substituted checkout, or null) and `volmLibStamp` (the
|
||||
* content of META-INF/volmit/volmlib.properties in every shipped jar).
|
||||
*/
|
||||
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.process.ExecOutput
|
||||
|
||||
import java.io.File
|
||||
|
||||
boolean irisHasVolmLibSettings(File directory) {
|
||||
@@ -85,9 +92,47 @@ boolean irisUseLocalVolmLib = providers.gradleProperty('useLocalVolmLib')
|
||||
.orElse('true')
|
||||
.map { String value -> value.equalsIgnoreCase('true') }
|
||||
.get()
|
||||
File irisLocalVolmLibDirectory = irisResolveLocalVolmLibDirectory()
|
||||
File irisLocalVolmLibDirectory = irisUseLocalVolmLib ? irisResolveLocalVolmLibDirectory() : null
|
||||
|
||||
if (irisUseLocalVolmLib && irisLocalVolmLibDirectory != null) {
|
||||
String irisGit(File directory, String... arguments) {
|
||||
try {
|
||||
ExecOutput result = providers.exec {
|
||||
commandLine(['git', '-C', directory.absolutePath] + arguments.toList())
|
||||
ignoreExitValue = true
|
||||
}
|
||||
return result.result.get().exitValue == 0 ? result.standardOutput.asText.get().trim() : null
|
||||
} catch (Exception ignored) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> irisVolmLibStamp
|
||||
String irisVolmLibDescription
|
||||
if (irisLocalVolmLibDirectory == null) {
|
||||
irisVolmLibStamp = [source: 'published master-SNAPSHOT']
|
||||
irisVolmLibDescription = 'published master-SNAPSHOT'
|
||||
gradle.allprojects { Project project ->
|
||||
project.buildscript.configurations.configureEach { Configuration configuration ->
|
||||
configuration.resolutionStrategy.cacheChangingModulesFor(0, 'seconds')
|
||||
}
|
||||
project.configurations.configureEach { Configuration configuration ->
|
||||
configuration.resolutionStrategy.cacheChangingModulesFor(0, 'seconds')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String commit = irisGit(irisLocalVolmLibDirectory, 'rev-parse', 'HEAD')
|
||||
String status = commit == null ? null : irisGit(irisLocalVolmLibDirectory, 'status', '--porcelain')
|
||||
String dirty = status == null ? 'unknown' : String.valueOf(!status.isEmpty())
|
||||
irisVolmLibStamp = [source: 'local', commit: commit ?: 'unknown', dirty: dirty]
|
||||
irisVolmLibDescription = "${irisLocalVolmLibDirectory.canonicalPath} @ ${commit == null ? 'unknown' : commit.take(7)}${dirty == 'true' ? '+dirty' : ''}"
|
||||
}
|
||||
gradle.extensions.extraProperties.set('volmLibDirectory', irisLocalVolmLibDirectory)
|
||||
gradle.extensions.extraProperties.set('volmLibStamp', irisVolmLibStamp)
|
||||
if (gradle.parent == null) {
|
||||
logger.lifecycle("VolmLib: ${irisVolmLibDescription}")
|
||||
}
|
||||
|
||||
if (irisLocalVolmLibDirectory != null) {
|
||||
includeBuild(irisLocalVolmLibDirectory) {
|
||||
dependencySubstitution {
|
||||
substitute(module('com.github.VolmitSoftware:VolmLib')).using(project(':shared'))
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Writes the VolmLib provenance that gradle/volmlib-resolution.settings.gradle resolved. Every shipped jar
|
||||
// carries it as META-INF/volmit/volmlib.properties.
|
||||
Map<String, String> volmLibStamp = (Map<String, String>) gradle.extensions.extraProperties.get('volmLibStamp')
|
||||
|
||||
tasks.register('generateVolmLibStamp', WriteProperties) {
|
||||
destinationFile.set(layout.buildDirectory.file('generated/volmlib-stamp/volmlib.properties'))
|
||||
properties(volmLibStamp)
|
||||
}
|
||||
Reference in New Issue
Block a user