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

Add Initial SQL Server support #10624

Merged
merged 29 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@
- [Compare two objects with `Ordering.compare` and define comparator with
`Comparable.new`][10468]
- [Added `dec` construction function for creating `Decimal`s.][10517]
- [Added initial read support for SQLServer][10324]

[10434]: https://github.com/enso-org/enso/pull/10434
[10445]: https://github.com/enso-org/enso/pull/10445
[10466]: https://github.com/enso-org/enso/pull/10466
[10467]: https://github.com/enso-org/enso/pull/10467
[10474]: https://github.com/enso-org/enso/pull/10474
[10517]: https://github.com/enso-org/enso/pull/10517
[10324]: https://github.com/enso-org/enso/pull/10324

# Enso 2024.2

Expand Down
45 changes: 44 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ GatherLicenses.distributions := Seq(
makeStdLibDistribution("Database", Distribution.sbtProjects(`std-database`)),
makeStdLibDistribution("Image", Distribution.sbtProjects(`std-image`)),
makeStdLibDistribution("AWS", Distribution.sbtProjects(`std-aws`)),
makeStdLibDistribution("Snowflake", Distribution.sbtProjects(`std-snowflake`))
makeStdLibDistribution(
"Snowflake",
Distribution.sbtProjects(`std-snowflake`)
),
makeStdLibDistribution("Microsoft", Distribution.sbtProjects(`std-microsoft`))
AdRiley marked this conversation as resolved.
Show resolved Hide resolved
)

GatherLicenses.licenseConfigurations := Set("compile")
Expand Down Expand Up @@ -346,6 +350,7 @@ lazy val enso = (project in file("."))
`std-table`,
`std-aws`,
`std-snowflake`,
`std-microsoft`,
`http-test-helper`,
`enso-test-java-helpers`,
`exploratory-benchmark-java-helpers`,
Expand Down Expand Up @@ -563,6 +568,7 @@ val fansiVersion = "0.4.0"
val httpComponentsVersion = "4.4.1"
val apacheArrowVersion = "14.0.1"
val snowflakeJDBCVersion = "3.15.0"
val mssqlserverJDBCVersion = "12.6.2.jre11"
val jsoniterVersion = "2.28.5"

// ============================================================================
Expand Down Expand Up @@ -1942,6 +1948,7 @@ lazy val runtime = (project in file("engine/runtime"))
.dependsOn(`std-table` / Compile / packageBin)
.dependsOn(`std-aws` / Compile / packageBin)
.dependsOn(`std-snowflake` / Compile / packageBin)
.dependsOn(`std-microsoft` / Compile / packageBin)
.value
)
.dependsOn(`common-polyglot-core-utils`)
Expand Down Expand Up @@ -3260,6 +3267,8 @@ val `std-aws-polyglot-root` =
stdLibComponentRoot("AWS") / "polyglot" / "java"
val `std-snowflake-polyglot-root` =
stdLibComponentRoot("Snowflake") / "polyglot" / "java"
val `std-microsoft-polyglot-root` =
stdLibComponentRoot("Microsoft") / "polyglot" / "java"

lazy val `std-base` = project
.in(file("std-bits") / "base")
Expand Down Expand Up @@ -3567,6 +3576,36 @@ lazy val `std-snowflake` = project
.dependsOn(`std-table` % "provided")
.dependsOn(`std-database` % "provided")

lazy val `std-microsoft` = project
.in(file("std-bits") / "microsoft")
.settings(
frgaalJavaCompilerSetting,
autoScalaLibrary := false,
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(SPIHelpers.ensureSPIConsistency)
.value,
Compile / packageBin / artifactPath :=
`std-microsoft-polyglot-root` / "std-microsoft.jar",
libraryDependencies ++= Seq(
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"com.microsoft.sqlserver" % "mssql-jdbc" % mssqlserverJDBCVersion
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
val _ = StdBits
.copyDependencies(
`std-microsoft-polyglot-root`,
Seq("std-microsoft.jar"),
ignoreScalaLibrary = true
)
.value
result
}.value
)
.dependsOn(`std-base` % "provided")
.dependsOn(`std-table` % "provided")
.dependsOn(`std-database` % "provided")

/* Note [Native Image Workaround for GraalVM 20.2]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* In GraalVM 20.2 the Native Image build of even simple Scala programs has
Expand Down Expand Up @@ -3713,6 +3752,7 @@ val stdBitsProjects =
"Database",
"Google_Api",
"Image",
"Microsoft",
"Snowflake",
"Table"
) ++ allStdBitsSuffix
Expand Down Expand Up @@ -3784,6 +3824,8 @@ pkgStdLibInternal := Def.inputTask {
(`std-aws` / Compile / packageBin).value
case "Snowflake" =>
(`std-snowflake` / Compile / packageBin).value
case "Microsoft" =>
(`std-microsoft` / Compile / packageBin).value
case _ if buildAllCmd =>
(`std-base` / Compile / packageBin).value
(`enso-test-java-helpers` / Compile / packageBin).value
Expand All @@ -3795,6 +3837,7 @@ pkgStdLibInternal := Def.inputTask {
(`std-google-api` / Compile / packageBin).value
(`std-aws` / Compile / packageBin).value
(`std-snowflake` / Compile / packageBin).value
(`std-microsoft` / Compile / packageBin).value
case _ =>
}
val libs =
Expand Down
38 changes: 35 additions & 3 deletions build/build/src/enso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ use crate::paths::ENSO_META_TEST_ARGS;
use crate::paths::ENSO_META_TEST_COMMAND;
use crate::paths::ENSO_TEST_ANSI_COLORS;
use crate::postgres;
use crate::postgres::EndpointConfiguration;
use crate::postgres::EndpointConfiguration as PostgresEndpointConfiguration;
use crate::postgres::Postgresql;
use crate::sqlserver;
use crate::sqlserver::EndpointConfiguration as SQLServerEndpointConfiguration;
use crate::sqlserver::SQLServer;

use ide_ci::future::AsyncPolicy;
use ide_ci::programs::docker::ContainerId;
Expand Down Expand Up @@ -142,7 +145,12 @@ impl BuiltEnso {
let may_need_postgres = match &test_selection {
StandardLibraryTestsSelection::All => true,
StandardLibraryTestsSelection::Selected(only) =>
only.iter().any(|test| test.contains("Postgres_Tests")),
only.iter().any(|test| test.contains("Table_Tests")),
};
let may_need_sqlserver = match &test_selection {
StandardLibraryTestsSelection::All => true,
StandardLibraryTestsSelection::Selected(only) =>
only.iter().any(|test| test.contains("SQLServer")),
AdRiley marked this conversation as resolved.
Show resolved Hide resolved
};

let _httpbin = crate::httpbin::get_and_spawn_httpbin_on_free_port(sbt).await?;
Expand All @@ -162,7 +170,7 @@ impl BuiltEnso {
database_name: "enso_test_db".to_string(),
user: "enso_test_user".to_string(),
password: "enso_test_password".to_string(),
endpoint: EndpointConfiguration::deduce()?,
endpoint: PostgresEndpointConfiguration::deduce()?,
version: "latest".to_string(),
};
let postgres = Postgresql::start(config).await?;
Expand All @@ -171,6 +179,30 @@ impl BuiltEnso {
_ => None,
};

let _sqlserver = match TARGET_OS {
OS::Linux if may_need_sqlserver => {
let runner_context_string = crate::env::ENSO_RUNNER_CONTAINER_NAME
.get_raw()
.or_else(|_| ide_ci::actions::env::RUNNER_NAME.get())
.unwrap_or_else(|_| Uuid::new_v4().to_string());
// GH-hosted runners are named like "GitHub Actions 10". Spaces are not allowed in
// the container name.
let container_name =
format!("sqlserver-for-{runner_context_string}").replace(' ', "_");
let config = sqlserver::Configuration {
sqlserver_container: ContainerId(container_name),
database_name: "tempdb".to_string(),
user: "sa".to_string(),
password: "enso_test_password_<YourStrong@Passw0rd>".to_string(),
endpoint: SQLServerEndpointConfiguration::deduce()?,
version: "latest".to_string(),
};
let sqlserver = SQLServer::start(config).await?;
Some(sqlserver)
}
_ => None,
};

let futures = std_tests.into_iter().map(|test_path| {
let command = self.run_test(test_path, ir_caches);
async move { command?.run_ok().await }
Expand Down
1 change: 1 addition & 0 deletions build/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub mod release;
pub mod repo;
pub mod rust;
pub mod source;
pub mod sqlserver;
pub mod version;
pub mod web;

Expand Down
Loading
Loading