Skip to content

Commit e968454

Browse files
committed
Start rebuilding with pure Akka
1 parent ba3a68c commit e968454

File tree

49 files changed

+3270
-69
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3270
-69
lines changed

artifact-api/src/main/java/org/spongepowered/downloads/artifact/api/query/GroupRegistration.java

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -30,67 +30,19 @@
3030
import com.lightbend.lagom.serialization.Jsonable;
3131
import org.spongepowered.downloads.artifact.api.Group;
3232

33-
import java.util.Objects;
34-
3533
public final class GroupRegistration {
3634

3735
@JsonDeserialize
38-
public static final class RegisterGroupRequest {
39-
40-
/**
41-
* The name of the group, displayed for reading purposes
42-
*/
43-
@JsonProperty(required = true)
44-
public final String name;
45-
/**
46-
* The maven group coordinates of the group.
47-
*/
48-
@JsonProperty(required = true)
49-
public final String groupCoordinates;
50-
/**
51-
* A website for the group
52-
*/
53-
@JsonProperty(required = true)
54-
public final String website;
55-
56-
@JsonCreator
57-
public RegisterGroupRequest(
58-
final String name,
59-
final String groupCoordinates,
60-
final String website
61-
) {
62-
this.name = name;
63-
this.groupCoordinates = groupCoordinates;
64-
this.website = website;
65-
}
36+
public record RegisterGroupRequest(
37+
@JsonProperty(required = true) String name,
38+
@JsonProperty(required = true) String groupCoordinates,
39+
@JsonProperty(required = true) String website
40+
) {
6641

67-
@Override
68-
public boolean equals(final Object obj) {
69-
if (obj == this) {
70-
return true;
71-
}
72-
if (obj == null || obj.getClass() != this.getClass()) {
73-
return false;
74-
}
75-
final var that = (RegisterGroupRequest) obj;
76-
return Objects.equals(this.name, that.name) &&
77-
Objects.equals(this.groupCoordinates, that.groupCoordinates) &&
78-
Objects.equals(this.website, that.website);
79-
}
80-
81-
@Override
82-
public int hashCode() {
83-
return Objects.hash(this.name, this.groupCoordinates, this.website);
84-
}
42+
@JsonCreator
43+
public RegisterGroupRequest { }
8544

86-
@Override
87-
public String toString() {
88-
return "RegisterGroupRequest[" +
89-
"name=" + this.name + ", " +
90-
"groupCoordinates=" + this.groupCoordinates + ", " +
91-
"website=" + this.website + ']';
9245
}
93-
}
9446

9547
public interface Response extends Jsonable {
9648

artifact-api/src/main/java/org/spongepowered/downloads/artifact/api/query/GroupsResponse.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,4 @@ record Available(@JsonProperty List<Group> groups)
4545
public Available {
4646
}
4747
}
48-
4948
}

artifact-impl/src/main/java/org/spongepowered/downloads/artifact/group/GroupManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public GroupManager(ClusterSharding clusterSharding, final DetailsManager detail
3737
public CompletionStage<GroupRegistration.Response> registerGroup(
3838
GroupRegistration.RegisterGroupRequest registration
3939
) {
40-
final String mavenCoordinates = registration.groupCoordinates;
41-
final String name = registration.name;
42-
final String website = registration.website;
43-
return this.groupEntity(registration.groupCoordinates.toLowerCase(Locale.ROOT))
40+
final String mavenCoordinates = registration.groupCoordinates();
41+
final String name = registration.name();
42+
final String website = registration.website();
43+
return this.groupEntity(registration.groupCoordinates().toLowerCase(Locale.ROOT))
4444
.<GroupRegistration.Response>ask(
4545
replyTo -> new GroupCommand.RegisterGroup(mavenCoordinates, name, website, replyTo),
4646
this.askTimeout

build.sbt

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ ThisBuild / scmInfo := Some(ScmInfo(url("https://github.com/SpongePowered/System
1616
"scm:git@github.com:spongepowered/systemofadownload.git"))
1717
ThisBuild / developers := List(
1818
Developer(
19-
id = "gabizou",
20-
name = "Gabriel Harris-Rouquette",
19+
id = "gabizou",
20+
name = "Gabriel Harris-Rouquette",
2121
email = "gabizou@spongepowered.org",
22-
url = url("https://github.com/gabizou")
22+
url = url("https://github.com/gabizou")
2323
)
2424
)
2525
ThisBuild / description := "A Web Application for indexing and cataloging Artifacts in Maven Repositories"
@@ -127,6 +127,9 @@ lazy val jacksonGuava = "com.fasterxml.jackson.datatype" % "jackson-datatype-gua
127127
lazy val jacksonPcollections = "com.fasterxml.jackson.datatype" % "jackson-datatype-pcollections" % "2.14.0"
128128
// endregion
129129

130+
lazy val akkaHttp = "com.typesafe.akka" %% "akka-http" % LagomVersion.akkaHttp
131+
lazy val akkaJackson = "com.typesafe.akka" %% "akka-http-jackson" % LagomVersion.akkaHttp
132+
130133
lazy val akkaStreamTyped = "com.typesafe.akka" %% "akka-stream-typed" % LagomVersion.akka
131134
lazy val akkaPersistenceTestkit = "com.typesafe.akka" %% "akka-persistence-testkit" % LagomVersion.akka % Test
132135
lazy val akkaKubernetesDiscovery = "com.lightbend.akka.discovery" %% "akka-discovery-kubernetes-api" % "1.1.3"
@@ -142,14 +145,20 @@ lazy val guice = "com.google.inject" % "guice" % "5.1.0"
142145
lazy val jgit = "org.eclipse.jgit" % "org.eclipse.jgit" % "6.1.0.202203080745-r"
143146
lazy val jgit_jsch = "org.eclipse.jgit" % "org.eclipse.jgit.ssh.jsch" % "6.1.0.202203080745-r"
144147

148+
lazy val mavenArtifact = "org.apache.maven" % "maven-artifact" % "3.8.5"
149+
150+
lazy val testContainers = "org.testcontainers" % "testcontainers" % "1.17.3" % Test
151+
lazy val testContainersJunit = "org.testcontainers" % "junit-jupiter" % "1.17.3" % Test
152+
lazy val testContainersPostgres = "org.testcontainers" % "postgresql" % "1.17.3" % Test
153+
145154
// endregion
146155

147156
// region - project blueprints
148157

149158
def soadProject(name: String) =
150159
Project(name, file(name)).settings(
151160
moduleName := s"systemofadownload-$name",
152-
Compile / javacOptions := Seq("--release", "17", "-parameters", "-encoding", "UTF-8"), //Override the settings Lagom sets
161+
Compile / javacOptions := Seq("--release", "17", "--enable-preview", "-parameters", "-encoding", "UTF-8"), //Override the settings Lagom sets
153162
artifactName := { (_: ScalaVersion, module: ModuleID, artifact: Artifact) =>
154163
s"${artifact.name}-${module.revision}.${artifact.extension}"
155164
},
@@ -308,6 +317,50 @@ lazy val `artifact-query-api` = apiSoadProject("artifact-query-api").dependsOn(
308317
lazy val `artifact-query-impl` = implSoadProjectWithPersistence("artifact-query-impl", `artifact-query-api`).settings(
309318
libraryDependencies += playFilterHelpers
310319
)
320+
lazy val `downloads-api` = soadProject("downloads-api").enablePlugins(DockerPlugin)
321+
.settings(
322+
libraryDependencies ++= Seq(
323+
// App
324+
mavenArtifact,
325+
326+
// Akka
327+
akkaHttp,
328+
akkaStreamTyped,
329+
akkaKubernetesDiscovery,
330+
331+
// Jackson serialization
332+
akkaJackson,
333+
jacksonDataBind,
334+
jacksonDataTypeJsr310,
335+
jacksonDataformatCbor,
336+
jacksonDatatypeJdk8,
337+
jacksonParameterNames,
338+
jacksonParanamer,
339+
jacksonScala,
340+
//Language Features
341+
vavr,
342+
// Persistence
343+
hibernate,
344+
postgres,
345+
// Testing
346+
akkaPersistenceTestkit,
347+
junit,
348+
jupiterInterface
349+
),
350+
dockerUpdateLatest := true,
351+
dockerBaseImage := "eclipse-temurin:17.0.3_7-jre",
352+
dockerChmodType := DockerChmodType.UserGroupWriteExecute,
353+
dockerExposedPorts := Seq(9000, 8558, 2552),
354+
// dockerLabels ++= Map(
355+
// "author" -> "spongepowered"
356+
// ),
357+
Docker / maintainer := "spongepowered",
358+
Docker / packageName := s"systemofadownload-$name",
359+
dockerUsername := Some("spongepowered"),
360+
Universal / javaOptions ++= Seq(
361+
"-Dpidfile.path=/dev/null"
362+
)
363+
)
311364

312365
lazy val `versions-api` = apiSoadProject("versions-api").dependsOn(
313366
//Module Dependencies

docs/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM node:18-alpine as builder
2+
3+
COPY systemofadownload.yaml ./
4+
RUN npm install -g redoc-cli && redoc-cli bundle -o index.html systemofadownload.yaml
5+
6+
FROM nginx as webserver
7+
8+
COPY --from=builder index.html /usr/share/nginx/html/

docs/project/build.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=1.6.0

0 commit comments

Comments
 (0)