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 support for external deps for eclipselink #285

Merged
merged 5 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ insert into db1.table1 values (1, 'a');
select * from db1.table1;
```

Apache Polaris supports the following optional build options:
- `-PeclipseLink=true` – Enables the EclipseLink extension.
- `-PeclipseLinkDeps=[groupId]:[artifactId]:[version],...` – Specifies one or more additional dependencies for EclipseLink (e.g., JDBC drivers), separated by commas.
Copy link
Contributor

@flyrain flyrain Sep 13, 2024

Choose a reason for hiding this comment

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

Not sure if it is a good idea to add examples for Postgres or mySQL. Thoughts? cc @aihuaxu. Not a blocker though. Something like

./gradlew -PeclipseLink=true -PeclipseLinkDeps=org.postgresql:postgresql:42.7.4,mysql:mysql-connector-java:8.0.33


### More build and run options
Running in Docker
- `docker build -t localhost:5001/polaris:latest .` - To build the image.
Expand Down
18 changes: 18 additions & 0 deletions extension/persistence/eclipselink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
* under the License.
*/

fun isValidDep(dep: String): Boolean {
val depRegex = "^[\\w.]+:[\\w\\-.]+:[\\w\\-.]+$".toRegex()
return dep.matches(depRegex)
}

plugins {
id("polaris-server")
`java-library`
Expand All @@ -27,6 +32,19 @@ dependencies {
implementation(libs.eclipselink)
implementation(platform(libs.dropwizard.bom))
implementation("io.dropwizard:dropwizard-jackson")
val eclipseLinkDeps: String? = project.findProperty("eclipseLinkDeps") as String?
eclipseLinkDeps?.let {
val dependenciesList = it.split(",")
dependenciesList.forEach { dep ->
val trimmedDep = dep.trim()
if (isValidDep(trimmedDep)) {
implementation(trimmedDep)
} else {
throw GradleException("Invalid dependency format: $trimmedDep")
}
}
}

compileOnly(libs.jetbrains.annotations)

testImplementation(libs.h2)
Expand Down