Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed Jun 14, 2024
1 parent 6902fea commit 1f42a72
Show file tree
Hide file tree
Showing 122 changed files with 1,244 additions and 1,331 deletions.
42 changes: 33 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,39 @@ jobs:
gradle-build:
runs-on: ubuntu-latest
steps:
- name: git clone
uses: actions/[email protected]
- name: Set up JDK
uses: actions/[email protected]
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: gradle build
id: gradle
uses: gradle/[email protected]
java-version-file: gradle/jdk-version.txt
- uses: gradle/actions/setup-gradle@v3
- run: "./gradlew qualityCheck"
env:
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PWD: ${{ secrets.BUILD_CACHE_PWD }}
- run: "./gradlew test"
env:
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PWD: ${{ secrets.BUILD_CACHE_PWD }}
- run: "./gradlew endToEndTest"
env:
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PWD: ${{ secrets.BUILD_CACHE_PWD }}
- run: "./gradlew endToEndTestSlow"
env:
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PWD: ${{ secrets.BUILD_CACHE_PWD }}
- run: "./gradlew cyclonedxBom"
env:
BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }}
BUILD_CACHE_PWD: ${{ secrets.BUILD_CACHE_PWD }}
- uses: DependencyTrack/gh-upload-sbom@v3
with:
arguments: build
apiKey: ${{ secrets.DEPENDENCYTRACK_APIKEY }}
bomFilename: "gradle/aggregation/build/reports/sbom/bom.xml"
serverHostname: "212.132.95.131"
port: "8091"
protocol: "http"
projectName: "gradle-project-setup-howto"
projectVersion: ${{ github.ref_name }}
autoCreate: true
45 changes: 20 additions & 25 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
plugins {
id("org.example.application")
}
plugins { id("org.example.gradle.component.java-application") }

application {
mainClass.set("org.example.product.app.Application")
}
application { mainClass = "org.example.product.app.Application" }

// Complicated notation for 'capabilities' - upvote: https://github.com/gradle/gradle/issues/25629
dependencies {
providedCompile("jakarta.servlet:jakarta.servlet-api")

implementation(project(":bespin"))
implementation(project(":corellia"))
implementation(project(":kamino"))
implementation(project(":kashyyyk"))
implementation(project(":naboo"))
implementation(project(":tatooine"))
implementation("com.google.inject.extensions:guice-servlet")
implementation("com.google.inject:guice")
implementation("org.slf4j:slf4j-api")

mockApiImplementation(project(path))
mockApiImplementation("com.google.guava:guava")
implementation(projects.bespin)
implementation(projects.corellia)
implementation(projects.kamino)
implementation(projects.kashyyyk)
implementation(projects.naboo)
implementation(projects.tatooine)
implementation(libs.guice)
implementation(libs.guice.servlet)
implementation(libs.slf4j.api)
runtimeOnly(libs.slf4j.simple)
providedCompile(libs.jakarta.servlet.api)

testImplementation("org.junit.jupiter:junit-jupiter-api")
endToEndTestImplementation(projects.app) { capabilities { requireCapability("${project.group}:$name-mock-api") } }
endToEndTestImplementation(libs.guava)
endToEndTestImplementation(libs.junit.jupiter.api)

endToEndTestImplementation(project(path)) { capabilities { requireCapabilities("${project.group}:${project.name}-mock-api") } }
endToEndTestImplementation("com.google.guava:guava")
endToEndTestImplementation("org.junit.jupiter:junit-jupiter-api")
mockApiImplementation(projects.app)
mockApiImplementation(libs.guava)

runtimeOnly("org.slf4j:slf4j-simple")
testImplementation(libs.junit.jupiter.api)
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.example.product.app.endtoend;

import static org.junit.jupiter.api.Assertions.assertEquals;

import com.google.common.collect.ImmutableList;
import org.example.product.app.mock.api.MockServer;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class SystemQuickTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.example.product.app.endtoend;

import static org.junit.jupiter.api.Assertions.assertEquals;

import com.google.common.collect.ImmutableList;
import org.example.product.app.mock.api.MockServer;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

@Tag("slow")
public class SystemTest {

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/org/example/product/app/AppServlet.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.example.product.app;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/check")
public class AppServlet extends HttpServlet {
Expand All @@ -17,4 +17,4 @@ public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOExce
pw.println("</body></html>");
pw.close();
}
}
}
3 changes: 1 addition & 2 deletions app/src/main/java/org/example/product/app/MainModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.inject.Guice;
import com.google.inject.servlet.SessionScoped;
import java.io.IOException;
import org.example.product.bespin.BespinModule;
import org.example.product.kamino.KaminoModule;
import org.example.product.kashyyyk.KashyyykModule;
Expand All @@ -10,8 +11,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

@SessionScoped
public class MainModule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ public ImmutableList<String> get() {
new MainModule();
return ImmutableList.of("a", "b", "x", "y");
}

}
4 changes: 2 additions & 2 deletions app/src/test/java/org/example/product/app/test/AppTest.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.example.product.app.test;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertSame;

import org.junit.jupiter.api.Test;

public class AppTest {

@Test
Expand Down
16 changes: 7 additions & 9 deletions bespin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
plugins {
id("org.example.java-library")
}
plugins { id("org.example.gradle.component.java-library") }

// For isolated-projects, use 'requireCapability' notation instead of testFixtures(...)
dependencies {
api(project(":corellia"))

implementation(project(":coruscant"))
implementation("org.apache.velocity:velocity-engine-core")
api(projects.corellia)
implementation(projects.coruscant)
implementation(libs.velocity.engine.core)

testImplementation(testFixtures(project(":corellia")))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation(projects.corellia) { capabilities { requireCapability("${project.group}:$name-test-fixtures") } }
testImplementation(libs.junit.jupiter.api)
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package org.example.product.bespin;

import org.example.product.corellia.CorelliaModule;
import org.example.product.coruscant.CoruscantModule;
import org.apache.velocity.io.VelocityWriter;

import java.io.FileWriter;
import java.io.IOException;
import org.apache.velocity.io.VelocityWriter;
import org.example.product.corellia.CorelliaModule;
import org.example.product.coruscant.CoruscantModule;

public class BespinModule {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.example.product.bespin.test;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.example.product.corellia.fixtures.CorelliaModuleFixture;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class BespinModuleTest {

@Test
Expand Down
4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
plugins {
id("org.example.root")
id("org.example.gradle.base.lifecycle.root")
id("org.example.gradle.check.dependencies.root")
id("org.example.gradle.check.format-gradle.root")
}
16 changes: 8 additions & 8 deletions corellia/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
id("org.example.java-library-with-test-fixtures")
id("org.example.gradle.component.java-library")
id("org.example.gradle.feature.test-fixtures")
}

dependencies {
api("org.apache.poi:poi")
api(libs.poi)
implementation(libs.commons.io)
implementation(libs.poi.ooxml)

implementation("commons-io:commons-io")
implementation("org.apache.poi:poi-ooxml")
testImplementation(libs.junit.jupiter.api)

testFixturesApi("com.google.code.findbugs:jsr305")
testFixturesApi("com.google.guava:guava")

testImplementation("org.junit.jupiter:junit-jupiter-api")
testFixturesApi(libs.guava)
testFixturesApi(libs.jsr305)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.example.application.tasks

import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.example.product.corellia;

import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ooxml.POIXMLDocument;
import org.apache.commons.io.input.NullInputStream;

import java.io.IOException;
import org.apache.commons.io.input.NullInputStream;
import org.apache.poi.ooxml.POIXMLDocument;
import org.apache.poi.ss.usermodel.Workbook;

public class CorelliaModule {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package org.example.product.corellia.test;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.example.product.corellia.fixtures.CorelliaModuleFixture;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class CorelliaModuleTest {

@Test
void testModule() {
assertEquals(3, new CorelliaModuleFixture().threeModules().size());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

import com.google.common.collect.ImmutableList;
import com.google.common.io.ByteProcessor;
import org.example.product.corellia.CorelliaModule;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.example.product.corellia.CorelliaModule;

public class CorelliaModuleFixture implements ByteProcessor<CorelliaModuleFixture> {
public List<CorelliaModule> threeModules() {
Expand Down
36 changes: 18 additions & 18 deletions coruscant/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
plugins {
id("org.example.java-library-published")
id("org.example.gradle.component.java-library")
id("org.example.gradle.feature.publish")
}

dependencies {
api("com.fasterxml.jackson.core:jackson-annotations")
api("com.fasterxml.jackson.core:jackson-databind")
api("com.google.guava:guava")
api("jakarta.inject:jakarta.inject-api")
api("org.json:json")
api("org.opensaml:opensaml")
api(libs.guava)
api(libs.jackson.annotations)
api(libs.jackson.databind)
api(libs.jakarta.inject.api)
api(libs.opensaml)
api(libs.org.json)
implementation(libs.httpcomponents.fluent.hc)
implementation(libs.jackson.core)
implementation(libs.jackson.datatype.json.org)
implementation(libs.jackson.datatype.jsr310)
implementation(libs.jakarta.activation)
implementation(libs.jakarta.mail.impl)
implementation(libs.org.reflections)
implementation(libs.slf4j.api)

implementation("com.fasterxml.jackson.core:jackson-core")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-json-org")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
implementation("com.sun.activation:jakarta.activation")
implementation("com.sun.mail:jakarta.mail")
implementation("org.apache.httpcomponents:fluent-hc")
implementation("org.reflections:reflections")
implementation("org.slf4j:slf4j-api")

testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation(libs.assertj.core)
testImplementation(libs.junit.jupiter.api)
}
Loading

0 comments on commit 1f42a72

Please sign in to comment.