Skip to content

Commit

Permalink
Merge tag 'refs/tags/dev-42.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sabieber committed Feb 23, 2024
2 parents 4f94185 + 0210779 commit 081e457
Show file tree
Hide file tree
Showing 52 changed files with 974 additions and 397 deletions.
10 changes: 5 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ clone:

steps:
- name: compile
image: scireum/sirius-build-jdk18
image: scireum/sirius-build-jdk21
commands:
- mvn clean compile
volumes: *scireum_volumes
Expand All @@ -28,7 +28,7 @@ steps:
- push

- name: cron_unit_tests
image: scireum/sirius-build-jdk18
image: scireum/sirius-build-jdk21
commands:
- mvn clean test
volumes: *scireum_volumes
Expand All @@ -48,7 +48,7 @@ steps:
- cron

- name: test
image: scireum/sirius-build-jdk18
image: scireum/sirius-build-jdk21
commands:
- mvn clean test -Dtest.excluded.groups=nightly
volumes: *scireum_volumes
Expand All @@ -57,7 +57,7 @@ steps:
- pull_request

- name: deploy
image: scireum/sirius-build-jdk18
image: scireum/sirius-build-jdk21
commands:
- sed -i 's/DEVELOPMENT-SNAPSHOT/${DRONE_TAG}/g' pom.xml
- mvn clean deploy -DskipTests
Expand All @@ -77,7 +77,7 @@ steps:
- tag

- name: sonar
image: scireum/sirius-build-jdk18
image: scireum/sirius-build-jdk21
commands:
- sed -i 's/DEVELOPMENT-SNAPSHOT/${DRONE_TAG}/g' pom.xml
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report sonar:sonar -Dsonar.projectKey=${DRONE_REPO_NAME}
Expand Down
29 changes: 29 additions & 0 deletions .run/mvn clean test - without nightly.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="mvn clean test - without nightly" type="MavenRunConfiguration" factoryName="Maven">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="clean" />
<option value="test" />
<option value="-Dtest.excluded.groups=nightly" />
</list>
</option>
<option name="pomFileName" value="pom.xml" />
<option name="profilesMap">
<map />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method v="2" />
</configuration>
</component>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ the core frameworks and a fair amount of commonly used classes.

## Important files of this module:

* [Default configuration](src/main/resources/component-kernel.conf)
* [Default configuration](src/main/resources/component-050-kernel.conf)
* [Maven setup](pom.xml).

## The Kernel
Expand Down
18 changes: 6 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.scireum</groupId>
<artifactId>sirius-parent</artifactId>
<version>10.2.1</version>
<version>11.5.1</version>
</parent>
<artifactId>sirius-kernel</artifactId>
<name>SIRIUS kernel</name>
Expand All @@ -25,14 +25,14 @@
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>
</dependency>

<!-- Useful helper classes by Google -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.0-jre</version>
<version>32.1.3-jre</version>
</dependency>

<!-- JSR305 annotations like @Nonnull etc. -->
Expand All @@ -46,14 +46,14 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>2.0.3</version>
<version>2.0.9</version>
</dependency>

<!-- Used to auto-start Docker environments. Excluding dependencies not required for docker-compose. -->
<dependency>
<groupId>com.palantir.docker.compose</groupId>
<artifactId>docker-compose-rule-core</artifactId>
<version>1.8.0</version>
<version>2.0.0</version>
<exclusions>
<exclusion>
<groupId>com.palantir.conjure.java.runtime</groupId>
Expand All @@ -69,7 +69,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
<version>2.15.1</version>
</dependency>
<!-- Required, as the version provided by docker-compose-rule-core has security issues -->
<dependency>
Expand All @@ -80,11 +80,5 @@
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- Required, as the version provided by docker-compose-rule-core has security issues -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion src/main/java/sirius/kernel/Classpath.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private String buildRelativePath(File reference, File child) {
List<String> path = new ArrayList<>();
File iter = child;
while (iter != null && !Objects.equals(iter, reference)) {
path.add(0, iter.getName());
path.addFirst(iter.getName());
iter = iter.getParentFile();
}

Expand Down
23 changes: 13 additions & 10 deletions src/main/java/sirius/kernel/Setup.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import java.util.logging.StreamHandler;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
Expand Down Expand Up @@ -238,7 +239,7 @@ protected void setupEncoding() {
/**
* Sets the DNS cache to a sane value.
* <p>
* By default java infinitely caches all DNS entries. Will be changed to 10 seconds...
* By default, java infinitely caches all DNS entries. Will be changed to 10 seconds...
*/
protected void setupDNSCache() {
Sirius.LOG.FINE("Setting DNS-Cache to 10 seconds...");
Expand Down Expand Up @@ -268,7 +269,7 @@ protected static Value getProperty(String property, Object defaultValue, String
* Initializes log4j as logging framework.
* <p>
* In development mode, we log everything to the console. In production mode, we use a rolling file appender and
* log into the logs directory.
* log into the "logs" directory.
*/
protected void setupLogging() {
Logger rootLogger = LogManager.getLogManager().getLogger("");
Expand Down Expand Up @@ -330,8 +331,8 @@ private Config loadConfig(String resourceName, Producer<Config> configMaker, @Nu
/**
* Loads the main application configuration which is shipped with the app.
* <p>
* By default this loads "application.conf" from the classpath. Also "application-*.conf
* are loaded in case it is splitted into several parts.
* By default, this loads "application.conf" from the classpath. Also, "application-*.conf
* are loaded in case it is split into several parts.
*
* @return the main application config. This will override all component configs but be overridden by developer,
* test and instance configs
Expand All @@ -343,9 +344,11 @@ public Config loadApplicationConfig() {
// Load component configurations
Sirius.getClasspath()
.find(Pattern.compile("application-([^.]*?)\\.conf"))
.forEach(value -> result.set(loadConfig(value.group(),
() -> ConfigFactory.parseResources(loader, value.group()),
result.get())));
.map(Matcher::group)
.sorted()
.forEach(configPath -> result.set(loadConfig(configPath,
() -> ConfigFactory.parseResources(loader, configPath),
result.get())));

if (Sirius.class.getResource("/application.conf") != null) {
result.set(loadConfig("application.conf",
Expand All @@ -361,7 +364,7 @@ public Config loadApplicationConfig() {
/**
* Applies the test configuration to the given config object.
* <p>
* By default this loads and applies "test.conf" from the classpath.
* By default, this loads and applies "test.conf" from the classpath.
*
* @param config the config to enhance
* @return the enhanced config
Expand Down Expand Up @@ -396,7 +399,7 @@ public Config applyTestScenarioConfig(@Nullable String scenarioFile, @Nonnull Co
/**
* Applies the corresponding configuration to the given config object.
* <p>
* By default this loads and applies the given "instance.conf", "develop.conf", "staging.conf" or "productive.conf"
* By default, this loads and applies the given "instance.conf", "develop.conf", "staging.conf" or "productive.conf"
* from the file system.
*
* @param config the config to amend
Expand All @@ -419,7 +422,7 @@ public Config applyConfig(@Nonnull Config config, @Nonnull String configType) {
/**
* Loads <b>and parses</b> the environment.
* <p>
* {@link ConfigFactory} by default treats every environment variable as key instead of as path. Therefore we
* {@link ConfigFactory} by default treats every environment variable as key instead of as path. Therefore, we
* manually load the environment be treating variables as path so that compound keys like sirius.nodeName
* can be specified.
*
Expand Down
45 changes: 26 additions & 19 deletions src/main/java/sirius/kernel/Sirius.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
Expand Down Expand Up @@ -279,7 +281,7 @@ private static void init() {
* These are <tt>settings.conf</tt>, <tt>develop.conf</tt>, <tt>test.conf</tt>
* and finally, <tt>instance.conf</tt>.
*/
private static void setupLocalConfig() {
protected static void setupLocalConfig() {
LOG.INFO("Loading local config...");
LOG.INFO(SEPARATOR_LINE);

Expand Down Expand Up @@ -343,27 +345,32 @@ private static void setupApplicationAndSystemConfig() {

if (isStartedAsTest()) {
// Load test configurations (will override component configs)
classpath.find(Pattern.compile("component-test-([^.]*?)\\.conf")).forEach(value -> {
try {
LOG.INFO("Loading test config: %s", value.group());
config = config.withFallback(ConfigFactory.parseResources(setup.getLoader(), value.group()));
} catch (Exception exception) {
handleConfigError(value.group(), exception);
}
});
classpath.find(Pattern.compile("component-test-([^.]*?)\\.conf"))
.map(Matcher::group)
.sorted(Comparator.reverseOrder())
.forEach(configPath -> {
try {
LOG.INFO("Loading test config: %s", configPath);
config = config.withFallback(ConfigFactory.parseResources(setup.getLoader(), configPath));
} catch (Exception exception) {
handleConfigError(configPath, exception);
}
});
}

// Load component configurations
classpath.find(Pattern.compile("component-([^\\-]*?)([^.]*?)\\.conf")).forEach(value -> {
if (!"test".equals(value.group(1))) {
try {
LOG.INFO("Loading config: %s", value.group());
config = config.withFallback(ConfigFactory.parseResources(setup.getLoader(), value.group()));
} catch (Exception exception) {
handleConfigError(value.group(), exception);
}
}
});
classpath.find(Pattern.compile("component-([^\\-]*?)([^.]*?)\\.conf"))
.map(Matcher::group)
.filter(configPath -> !"test".equals(configPath))
.sorted(Comparator.reverseOrder())
.forEach(configPath -> {
try {
LOG.INFO("Loading config: %s", configPath);
config = config.withFallback(ConfigFactory.parseResources(setup.getLoader(), configPath));
} catch (Exception exception) {
handleConfigError(configPath, exception);
}
});

config = config.resolve();

Expand Down
Loading

0 comments on commit 081e457

Please sign in to comment.