-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42095 from gcw-it/pr_16292
Enable Liquibase includeAll in Native Image
- Loading branch information
Showing
6 changed files
with
92 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...ibase/runtime/src/main/java/io/quarkus/liquibase/runtime/NativeImageResourceAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package io.quarkus.liquibase.runtime; | ||
|
||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.nio.file.FileSystem; | ||
import java.nio.file.FileSystemAlreadyExistsException; | ||
import java.nio.file.FileSystems; | ||
import java.nio.file.Path; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
import liquibase.resource.AbstractPathResourceAccessor; | ||
import liquibase.resource.PathResource; | ||
import liquibase.resource.Resource; | ||
|
||
public class NativeImageResourceAccessor extends AbstractPathResourceAccessor { | ||
private static final URI NATIVE_IMAGE_FILESYSTEM_URI = URI.create("resource:/"); | ||
private static final Logger log = Logger.getLogger(NativeImageResourceAccessor.class); | ||
|
||
private final FileSystem fileSystem; | ||
|
||
public NativeImageResourceAccessor() { | ||
FileSystem fs; | ||
try { | ||
fs = FileSystems.newFileSystem( | ||
NATIVE_IMAGE_FILESYSTEM_URI, | ||
Collections.singletonMap("create", "true")); | ||
log.debug("Creating new filesystem for native image"); | ||
} catch (FileSystemAlreadyExistsException ex) { | ||
fs = FileSystems.getFileSystem(NATIVE_IMAGE_FILESYSTEM_URI); | ||
log.debug("Native image file system already exists", ex); | ||
} catch (IOException ex) { | ||
throw new IllegalStateException(ex); | ||
} | ||
fileSystem = fs; | ||
} | ||
|
||
@Override | ||
protected Path getRootPath() { | ||
return fileSystem.getPath("/"); | ||
} | ||
|
||
@Override | ||
protected Resource createResource(Path file, String pathToAdd) { | ||
return new PathResource(pathToAdd, file); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
} | ||
|
||
@Override | ||
public List<String> describeLocations() { | ||
return Collections.singletonList(fileSystem.toString()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getName() + " (" + getRootPath() + ") (" + fileSystem.toString() + ")"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters