86 lines
2.7 KiB
Groovy
86 lines
2.7 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'application'
|
|
}
|
|
|
|
group = 'pl.genschu.rexcatalog'
|
|
version = '0.1.0-SNAPSHOT'
|
|
|
|
ext {
|
|
gdxVersion = '1.14.2'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
targetCompatibility = JavaVersion.VERSION_21
|
|
}
|
|
|
|
dependencies {
|
|
// Podstawiane przez dependencySubstitution w settings.gradle na lokalny :core.
|
|
// Wersja jest nieistotna — nigdy nie trafia do rozwiązywania z repozytorium.
|
|
implementation 'pl.genschu:core:0.1-SNAPSHOT'
|
|
|
|
// core loguje przez statyki Gdx.app, więc potrzebny jest headless backend
|
|
implementation "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
|
|
runtimeOnly "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
|
|
|
implementation 'org.xerial:sqlite-jdbc:3.46.1.3'
|
|
}
|
|
|
|
application {
|
|
mainClass = 'pl.genschu.rexcatalog.Main'
|
|
}
|
|
|
|
tasks.named('run', JavaExec) {
|
|
// ./gradlew run --args="ingest /Users/genszu/Reksio"
|
|
systemProperty 'file.encoding', 'UTF-8'
|
|
// wersja :core trafia do bazy (copy.core_version, detection.core_version,
|
|
// artifact.tool_version) i steruje unieważnianiem cache'u pochodnych
|
|
systemProperty 'catalog.coreVersion',
|
|
providers.gradleProperty('coreVersion').getOrElse('nieznana')
|
|
systemProperty 'catalog.data',
|
|
providers.gradleProperty('dataDir').getOrElse("${projectDir}/data")
|
|
}
|
|
|
|
/**
|
|
* Sprawdza, czy commit przypięty w submodule odpowiada tagowi z gradle.properties.
|
|
* Pomijane, gdy build celuje w zewnętrzną kopię roboczą (-PemulatorPath).
|
|
*/
|
|
tasks.register('verifyCoreVersion') {
|
|
group = 'verification'
|
|
description = 'Weryfikuje, że vendor/Rex-EMoolator stoi na tagu z coreVersion'
|
|
|
|
def expected = providers.gradleProperty('coreVersion')
|
|
def usingExternal = providers.gradleProperty('emulatorPath').isPresent()
|
|
def submodule = file('vendor/Rex-EMoolator')
|
|
|
|
doLast {
|
|
if (usingExternal.get()) {
|
|
logger.lifecycle('verifyCoreVersion: pominięte (-PemulatorPath, kopia robocza)')
|
|
return
|
|
}
|
|
def proc = new ProcessBuilder('git', 'describe', '--tags')
|
|
.directory(submodule)
|
|
.redirectErrorStream(true)
|
|
.start()
|
|
def actual = proc.inputStream.text.trim()
|
|
proc.waitFor()
|
|
|
|
if (actual != expected.get()) {
|
|
throw new GradleException(
|
|
"Rozjazd wersji :core — submoduł stoi na '${actual}', " +
|
|
"a gradle.properties deklaruje '${expected.get()}'.\n" +
|
|
"Albo przestaw submoduł, albo zaktualizuj coreVersion.")
|
|
}
|
|
logger.lifecycle("verifyCoreVersion: :core = ${actual}")
|
|
}
|
|
}
|
|
|
|
tasks.named('check') {
|
|
dependsOn 'verifyCoreVersion'
|
|
}
|