Skip to content

Commit

Permalink
Merge pull request #35757 from famod/liquibase-4.23
Browse files Browse the repository at this point in the history
Update liquibase from 4.20.0 to 4.23.1, liquibase-mongodb to 4.23.0
  • Loading branch information
geoand authored Sep 6, 2023
2 parents 51da1dd + 5169283 commit 61eb419
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 43 deletions.
10 changes: 8 additions & 2 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@
<jboss-logmanager.version>3.0.2.Final</jboss-logmanager.version>
<flyway.version>9.21.2</flyway.version>
<yasson.version>3.0.3</yasson.version>
<liquibase.version>4.20.0</liquibase.version>
<!-- liquibase-mongodb is not released everytime with liquibase anymore, but the two versions need to be compatible -->
<liquibase.version>4.23.1</liquibase.version>
<liquibase-mongodb.version>4.23.0</liquibase-mongodb.version>
<snakeyaml.version>2.1</snakeyaml.version>
<osgi.version>6.0.0</osgi.version>
<mongo-client.version>4.10.2</mongo-client.version>
Expand Down Expand Up @@ -5893,6 +5895,10 @@
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- liquibase-core has a dependency on org.osgi:osgi.core -->
Expand All @@ -5904,7 +5910,7 @@
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-mongodb</artifactId>
<version>${liquibase.version}</version>
<version>${liquibase-mongodb.version}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
import io.quarkus.deployment.builditem.ApplicationInfoBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
import io.quarkus.deployment.builditem.InitTaskBuildItem;
import io.quarkus.deployment.builditem.InitTaskCompletedBuildItem;
import io.quarkus.deployment.builditem.ServiceStartBuildItem;
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
Expand All @@ -61,6 +61,7 @@
import liquibase.exception.LiquibaseException;
import liquibase.parser.ChangeLogParser;
import liquibase.parser.ChangeLogParserFactory;
import liquibase.plugin.AbstractPluginFactory;
import liquibase.resource.ClassLoaderResourceAccessor;

class LiquibaseMongodbProcessor {
Expand All @@ -74,12 +75,11 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(Feature.LIQUIBASE_MONGODB);
}

@BuildStep
public SystemPropertyBuildItem disableHub() {
// Don't block app startup with prompt:
// Do you want to see this operation's report in Liquibase Hub, which improves team collaboration?
// If so, enter your email. If not, enter [N] to no longer be prompted, or [S] to skip for now, but ask again next time (default "S"):
return new SystemPropertyBuildItem("liquibase.hub.mode", "off");
@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
List<IndexDependencyBuildItem> indexLiquibase() {
return List.of(
new IndexDependencyBuildItem("org.liquibase", "liquibase-core"),
new IndexDependencyBuildItem("org.liquibase.ext", "liquibase-mongodb"));
}

@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
Expand All @@ -103,28 +103,31 @@ void nativeImageConfiguration(
liquibase.database.jvm.JdbcConnection.class.getName())
.methods().build());

reflective.produce(ReflectiveClassBuildItem
.builder(combinedIndex.getIndex().getAllKnownSubclasses(AbstractPluginFactory.class).stream()
.map(classInfo -> classInfo.name().toString())
.toArray(String[]::new))
.constructors().build());

reflective.produce(ReflectiveClassBuildItem
.builder(liquibase.command.CommandFactory.class.getName(),
// deprecated, but still used by liquibase.nosql.lockservice.AbstractNoSqlLockService
liquibase.configuration.GlobalConfiguration.class.getName())
.constructors().build());

reflective.produce(ReflectiveClassBuildItem.builder(
liquibase.parser.ChangeLogParserConfiguration.class.getName(),
liquibase.hub.HubServiceFactory.class.getName(),
liquibase.logging.core.DefaultLoggerConfiguration.class.getName(),
// deprecated, but still used by liquibase.nosql.lockservice.AbstractNoSqlLockService
liquibase.configuration.GlobalConfiguration.class.getName(),
liquibase.GlobalConfiguration.class.getName(),
liquibase.license.LicenseServiceFactory.class.getName(),
liquibase.executor.ExecutorService.class.getName(),
liquibase.change.ChangeFactory.class.getName(),
liquibase.logging.core.LogServiceFactory.class.getName(),
liquibase.logging.LogFactory.class.getName(),
liquibase.change.ColumnConfig.class.getName(),
liquibase.change.AddColumnConfig.class.getName(),
liquibase.change.core.LoadDataColumnConfig.class.getName(),
liquibase.sql.visitor.PrependSqlVisitor.class.getName(),
liquibase.sql.visitor.ReplaceSqlVisitor.class.getName(),
liquibase.sql.visitor.AppendSqlVisitor.class.getName(),
liquibase.sql.visitor.RegExpReplaceSqlVisitor.class.getName(),
liquibase.ext.mongodb.database.MongoClientDriver.class.getName(),
liquibase.resource.PathHandlerFactory.class.getName(),
liquibase.logging.mdc.MdcManagerFactory.class.getName())
liquibase.ext.mongodb.database.MongoClientDriver.class.getName())
.constructors().methods().fields().build());

reflective.produce(ReflectiveClassBuildItem.builder(
Expand Down Expand Up @@ -170,7 +173,6 @@ void nativeImageConfiguration(
liquibase.snapshot.SnapshotGenerator.class,
liquibase.sqlgenerator.SqlGenerator.class,
liquibase.structure.DatabaseObject.class,
liquibase.hub.HubService.class,
liquibase.logging.mdc.MdcManager.class)
.forEach(t -> addService(services, reflective, t, false));

Expand All @@ -196,6 +198,10 @@ void nativeImageConfiguration(
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.17.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.18.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.19.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.21.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.22.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.23.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd",
"liquibase.build.properties"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import io.quarkus.liquibase.mongodb.runtime.LiquibaseMongodbBuildTimeConfig;
import io.quarkus.liquibase.mongodb.runtime.LiquibaseMongodbConfig;
Expand Down Expand Up @@ -91,7 +92,9 @@ public LiquibaseMongodbConfig getConfiguration() {
* @return the label expression
*/
public LabelExpression createLabels() {
return new LabelExpression(liquibaseMongodbConfig.labels.orElse(null));
// need to join because of https://github.com/liquibase/liquibase/issues/4763
return new LabelExpression(
liquibaseMongodbConfig.labels.map(labels -> labels.stream().collect(Collectors.joining(","))).orElse(null));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import io.quarkus.deployment.builditem.InitTaskBuildItem;
import io.quarkus.deployment.builditem.InitTaskCompletedBuildItem;
import io.quarkus.deployment.builditem.ServiceStartBuildItem;
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
Expand All @@ -75,6 +74,7 @@
import liquibase.exception.LiquibaseException;
import liquibase.parser.ChangeLogParser;
import liquibase.parser.ChangeLogParserFactory;
import liquibase.plugin.AbstractPluginFactory;
import liquibase.resource.ClassLoaderResourceAccessor;

class LiquibaseProcessor {
Expand All @@ -90,14 +90,6 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(Feature.LIQUIBASE);
}

@BuildStep
public SystemPropertyBuildItem disableHub() {
// Don't block app startup with prompt:
// Do you want to see this operation's report in Liquibase Hub, which improves team collaboration?
// If so, enter your email. If not, enter [N] to no longer be prompted, or [S] to skip for now, but ask again next time (default "S"):
return new SystemPropertyBuildItem("liquibase.hub.mode", "off");
}

@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
IndexDependencyBuildItem indexLiquibase() {
return new IndexDependencyBuildItem("org.liquibase", "liquibase-core");
Expand Down Expand Up @@ -126,29 +118,26 @@ void nativeImageConfiguration(
.build());

reflective.produce(ReflectiveClassBuildItem
.builder("liquibase.command.LiquibaseCommandFactory",
liquibase.command.CommandFactory.class.getName())
.builder(combinedIndex.getIndex().getAllKnownSubclasses(AbstractPluginFactory.class).stream()
.map(classInfo -> classInfo.name().toString())
.toArray(String[]::new))
.constructors().build());

reflective.produce(ReflectiveClassBuildItem
.builder(liquibase.command.CommandFactory.class.getName())
.constructors().build());

reflective.produce(ReflectiveClassBuildItem.builder(
liquibase.parser.ChangeLogParserConfiguration.class.getName(),
liquibase.hub.HubServiceFactory.class.getName(),
liquibase.logging.core.DefaultLoggerConfiguration.class.getName(),
liquibase.GlobalConfiguration.class.getName(),
liquibase.license.LicenseServiceFactory.class.getName(),
liquibase.executor.ExecutorService.class.getName(),
liquibase.change.ChangeFactory.class.getName(),
liquibase.logging.core.LogServiceFactory.class.getName(),
liquibase.logging.LogFactory.class.getName(),
liquibase.change.ColumnConfig.class.getName(),
liquibase.change.AddColumnConfig.class.getName(),
liquibase.change.core.LoadDataColumnConfig.class.getName(),
liquibase.sql.visitor.PrependSqlVisitor.class.getName(),
liquibase.sql.visitor.ReplaceSqlVisitor.class.getName(),
liquibase.sql.visitor.AppendSqlVisitor.class.getName(),
liquibase.sql.visitor.RegExpReplaceSqlVisitor.class.getName(),
liquibase.resource.PathHandlerFactory.class.getName(),
liquibase.logging.mdc.MdcManagerFactory.class.getName())
liquibase.sql.visitor.RegExpReplaceSqlVisitor.class.getName())
.constructors().methods().fields().build());

reflective.produce(ReflectiveClassBuildItem.builder(
Expand Down Expand Up @@ -201,7 +190,6 @@ void nativeImageConfiguration(
liquibase.snapshot.SnapshotGenerator.class,
liquibase.sqlgenerator.SqlGenerator.class,
liquibase.structure.DatabaseObject.class,
liquibase.hub.HubService.class,
liquibase.logging.mdc.MdcManager.class)
.forEach(t -> consumeService(t, (serviceClass, implementations) -> {
services.produce(
Expand Down Expand Up @@ -244,6 +232,10 @@ void nativeImageConfiguration(
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.17.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.18.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.19.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.20.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.21.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.22.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.23.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd",
"www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd",
"liquibase.build.properties"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.quarkus.liquibase;

import java.util.Map;
import java.util.stream.Collectors;

import javax.sql.DataSource;

Expand Down Expand Up @@ -71,7 +72,10 @@ public LiquibaseConfig getConfiguration() {
* @return the label expression
*/
public LabelExpression createLabels() {
return new LabelExpression(config.labels);
// need to join because of https://github.com/liquibase/liquibase/issues/4763
return new LabelExpression(config.labels != null
? config.labels.stream().collect(Collectors.joining(","))
: null);
}

/**
Expand Down

0 comments on commit 61eb419

Please sign in to comment.