update flyway to v9.1.3

This commit is contained in:
Craig Raw 2024-10-10 09:04:01 +02:00
parent c450efe499
commit 1d8c37066e
4 changed files with 30 additions and 8 deletions

View file

@ -76,7 +76,7 @@ dependencies {
implementation('org.jdbi:jdbi3-sqlobject:3.20.0') { implementation('org.jdbi:jdbi3-sqlobject:3.20.0') {
exclude group: 'org.slf4j' exclude group: 'org.slf4j'
} }
implementation('org.flywaydb:flyway-core:7.10.7-SNAPSHOT') implementation('org.flywaydb:flyway-core:9.1.3')
implementation('org.fxmisc.richtext:richtextfx:0.10.4') implementation('org.fxmisc.richtext:richtextfx:0.10.4')
implementation('no.tornado:tornadofx-controls:1.0.4') implementation('no.tornado:tornadofx-controls:1.0.4')
implementation('com.google.zxing:javase:3.4.0') { implementation('com.google.zxing:javase:3.4.0') {
@ -189,7 +189,8 @@ application {
"--add-opens=java.base/java.net=com.sparrowwallet.sparrow", "--add-opens=java.base/java.net=com.sparrowwallet.sparrow",
"--add-opens=java.base/java.io=com.google.gson", "--add-opens=java.base/java.io=com.google.gson",
"--add-opens=java.smartcardio/sun.security.smartcardio=com.sparrowwallet.sparrow", "--add-opens=java.smartcardio/sun.security.smartcardio=com.sparrowwallet.sparrow",
"--add-reads=kotlin.stdlib=kotlinx.coroutines.core"] "--add-reads=kotlin.stdlib=kotlinx.coroutines.core",
"--add-reads=org.flywaydb.core=java.desktop"]
if(os.macOsX) { if(os.macOsX) {
applicationDefaultJvmArgs += ["-Dprism.lcdtext=false", "-Xdock:name=Sparrow", "-Xdock:icon=/Users/scy/git/sparrow/src/main/resources/sparrow-large.png", applicationDefaultJvmArgs += ["-Dprism.lcdtext=false", "-Xdock:name=Sparrow", "-Xdock:icon=/Users/scy/git/sparrow/src/main/resources/sparrow-large.png",
@ -210,8 +211,6 @@ jlink {
requires 'jdk.crypto.cryptoki' requires 'jdk.crypto.cryptoki'
requires 'java.management' requires 'java.management'
requires 'io.leangen.geantyref' requires 'io.leangen.geantyref'
uses 'org.flywaydb.core.extensibility.FlywayExtension'
uses 'org.flywaydb.core.internal.database.DatabaseType'
uses 'org.eclipse.jetty.http.HttpFieldPreEncoder' uses 'org.eclipse.jetty.http.HttpFieldPreEncoder'
} }
@ -249,7 +248,8 @@ jlink {
"--add-reads=com.sparrowwallet.merged.module=co.nstant.in.cbor", "--add-reads=com.sparrowwallet.merged.module=co.nstant.in.cbor",
"--add-reads=com.sparrowwallet.merged.module=org.bouncycastle.pg", "--add-reads=com.sparrowwallet.merged.module=org.bouncycastle.pg",
"--add-reads=com.sparrowwallet.merged.module=org.bouncycastle.provider", "--add-reads=com.sparrowwallet.merged.module=org.bouncycastle.provider",
"--add-reads=kotlin.stdlib=kotlinx.coroutines.core"] "--add-reads=kotlin.stdlib=kotlinx.coroutines.core",
"--add-reads=org.flywaydb.core=java.desktop"]
if(os.windows) { if(os.windows) {
jvmArgs += ["-Djavax.accessibility.assistive_technologies", "-Djavax.accessibility.screen_magnifier_present=false"] jvmArgs += ["-Djavax.accessibility.assistive_technologies", "-Djavax.accessibility.screen_magnifier_present=false"]
@ -488,6 +488,15 @@ extraJavaModuleInfo {
requires('io.reactivex.rxjava2') requires('io.reactivex.rxjava2')
requires('javafx.graphics') requires('javafx.graphics')
} }
module('flyway-core-9.1.3.jar', 'org.flywaydb.core', '9.1.3') {
exports('org.flywaydb.core')
exports('org.flywaydb.core.api')
exports('org.flywaydb.core.api.exception')
exports('org.flywaydb.core.api.configuration')
uses('org.flywaydb.core.extensibility.Plugin')
provides('org.flywaydb.core.extensibility.Plugin', 'org.flywaydb.core.internal.database.h2.H2DatabaseType', 'org.flywaydb.core.internal.schemahistory.BaseAppliedMigration', 'org.flywaydb.core.internal.resource.CoreResourceTypeProvider')
requires('java.sql')
}
module('wellbehavedfx-0.3.3.jar', 'org.fxmisc.wellbehaved', '0.3.3') { module('wellbehavedfx-0.3.3.jar', 'org.fxmisc.wellbehaved', '0.3.3') {
requires('javafx.base') requires('javafx.base')
requires('javafx.graphics') requires('javafx.graphics')

View file

@ -13,6 +13,7 @@ import org.objectweb.asm.Opcodes;
import java.io.*; import java.io.*;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.jar.*; import java.util.jar.*;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -169,6 +170,10 @@ abstract public class ExtraModuleInfoTransform implements TransformAction<ExtraM
for (String usesName : moduleInfo.getUses()) { for (String usesName : moduleInfo.getUses()) {
moduleVisitor.visitUse(usesName.replace('.', '/')); moduleVisitor.visitUse(usesName.replace('.', '/'));
} }
for (Map.Entry<String, List<String>> providesEntry : moduleInfo.getProvides().entrySet()) {
moduleVisitor.visitProvide(providesEntry.getKey().replace('.', '/'),
providesEntry.getValue().stream().map(name -> name.replace('.', '/')).toArray(String[]::new));
}
moduleVisitor.visitEnd(); moduleVisitor.visitEnd();
classWriter.visitEnd(); classWriter.visitEnd();
return classWriter.toByteArray(); return classWriter.toByteArray();

View file

@ -1,8 +1,7 @@
package org.gradle.sample.transform.javamodules; package org.gradle.sample.transform.javamodules;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.*;
import java.util.List;
/** /**
* Data class to hold the information that should be added as module-info.class to an existing Jar file. * Data class to hold the information that should be added as module-info.class to an existing Jar file.
@ -14,6 +13,7 @@ public class ModuleInfo implements Serializable {
private List<String> requires = new ArrayList<>(); private List<String> requires = new ArrayList<>();
private List<String> requiresTransitive = new ArrayList<>(); private List<String> requiresTransitive = new ArrayList<>();
private List<String> uses = new ArrayList<>(); private List<String> uses = new ArrayList<>();
private Map<String, List<String>> provides = new LinkedHashMap<>();
ModuleInfo(String moduleName, String moduleVersion) { ModuleInfo(String moduleName, String moduleVersion) {
this.moduleName = moduleName; this.moduleName = moduleName;
@ -36,6 +36,10 @@ public class ModuleInfo implements Serializable {
this.uses.add(uses); this.uses.add(uses);
} }
public void provides(String service, String... providers) {
this.provides.put(service, Arrays.asList(providers));
}
public String getModuleName() { public String getModuleName() {
return moduleName; return moduleName;
} }
@ -59,4 +63,8 @@ public class ModuleInfo implements Serializable {
protected List<String> getUses() { protected List<String> getUses() {
return uses; return uses;
} }
public Map<String, List<String>> getProvides() {
return provides;
}
} }

View file

@ -624,7 +624,7 @@ public class DbPersistence implements Persistence {
} }
private Flyway getFlyway(Storage storage, String schema, String password, File resourcesDir) throws StorageException { private Flyway getFlyway(Storage storage, String schema, String password, File resourcesDir) throws StorageException {
return Flyway.configure().dataSource(getDataSource(storage, password)).locations("filesystem:" + resourcesDir.getAbsolutePath()).schemas(schema).failOnMissingLocations(true).load(); return Flyway.configure().cleanDisabled(false).dataSource(getDataSource(storage, password)).locations("filesystem:" + resourcesDir.getAbsolutePath()).schemas(schema).failOnMissingLocations(true).load();
} }
//Flyway does not support JPMS yet, so the migration files are extracted to a temp dir in order to avoid classloader encapsulation issues //Flyway does not support JPMS yet, so the migration files are extracted to a temp dir in order to avoid classloader encapsulation issues