Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix windows error running version 8.x #2

Merged
merged 2 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Setup {
new FilePermissionsInitializer(),
new Mysql57Initializer(),
new NixBefore57Initializer(),
new NixBefore8Initializer(),
new Mysql8Initializer());


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public FileSet emit() {
.addEntry(Library, "bin/mysql.exe")
.addEntry(Library, "bin/mysqladmin.exe")
.addEntry(Library, "share/english/errmsg.sys")
.addEntry(Library, "bin/libeay32.dll")
.addEntry(Library, "bin/ssleay32.dll")
// .addEntry(Library, "share/fill_help_tables.sql")
// .addEntry(Library, "share/mysql_sys_schema.sql")
// .addEntry(Library, "share/mysql_system_tables.sql")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.wix.mysql.distribution.setup;

import com.wix.mysql.config.MysqldConfig;
import com.wix.mysql.distribution.Version;
import de.flapdoodle.embed.process.config.IRuntimeConfig;
import de.flapdoodle.embed.process.distribution.Platform;
import de.flapdoodle.embed.process.extract.IExtractedFileSet;
import org.apache.commons.io.filefilter.RegexFileFilter;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

public class NixBefore8Initializer implements Initializer {

private static final String SEP = File.separator;

@Override
public boolean matches(Version version) {
return Platform.detect().isUnixLike() &&
version.getMajorVersion().equals("8.0");
}

@Override
public void apply(IExtractedFileSet files, IRuntimeConfig runtimeConfig, MysqldConfig config) throws IOException {
File baseDir = files.baseDir();
File libDir = new File(baseDir + SEP + "lib");
FileFilter filter = new RegexFileFilter("^[a-z]+\\.so(\\.[0-9]+)+");
File[] soFiles = libDir.listFiles(filter);
for (File file : soFiles) {
Files.createSymbolicLink(Paths.get(baseDir + SEP + "bin" + SEP + file.getName()), Paths.get(file.getPath()));
System.out.println("Symlink " + file.getName());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this println anymore?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be useful for debug.
I'd replace it with a logger.

}
}
}