Skip to content

Commit

Permalink
Also downloading LICENSE for cvc5
Browse files Browse the repository at this point in the history
  • Loading branch information
leventeBajczi committed Nov 22, 2023
1 parent 7f5c7d2 commit 18796ab
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
import java.util.List;

import static hu.bme.mit.theta.common.OsHelper.Architecture.X64;
import static hu.bme.mit.theta.common.OsHelper.OperatingSystem.*;
import static hu.bme.mit.theta.common.OsHelper.OperatingSystem.LINUX;
import static hu.bme.mit.theta.common.OsHelper.OperatingSystem.MAC;
import static hu.bme.mit.theta.common.OsHelper.OperatingSystem.WINDOWS;

public class CVC5SmtLibSolverInstaller extends SmtLibSolverInstaller.Default {
private final List<SemVer.VersionDecoder> versions;
Expand Down Expand Up @@ -68,6 +70,15 @@ protected void installSolver(final Path installDir, final String version) throws
} catch (IOException e) {
throw new SmtLibSolverInstallerException(e);
}
try (
final var inputChannel = Channels.newChannel(getLicenseDownloadUrl().openStream());
final var outputChannel = new FileOutputStream(installDir.resolve("COPYING").toAbsolutePath().toString()).getChannel()
) {
logger.write(Logger.Level.MAINSTEP, "Starting license download (%s)...\n", getLicenseDownloadUrl().toString());
outputChannel.transferFrom(inputChannel, 0, Long.MAX_VALUE);
} catch (IOException e) {
throw new SmtLibSolverInstallerException(e);
}

logger.write(Logger.Level.MAINSTEP, "Download finished\n");
}
Expand Down Expand Up @@ -108,6 +119,10 @@ version, getArchString(version)
)).toURL();
}

private URL getLicenseDownloadUrl() throws SmtLibSolverInstallerException, MalformedURLException {
return URI.create("https://raw.githubusercontent.com/cvc5/cvc5/main/COPYING").toURL();
}

private String getArchString(final String version) throws SmtLibSolverInstallerException {
final var semVer = SemVer.of(version);
String archStr = null;
Expand Down

0 comments on commit 18796ab

Please sign in to comment.