mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-06-18 17:00:45 +02:00
Improve Java Test compilation time
Co-authored-by: Sebastian Sdorra<sebastian.sdorra@cloudogu.com> Co-authored-by: Thomas Zerr<thomas.zerr@cloudogu.com> Pushed-by: Thomas Zerr<thomas.zerr@cloudogu.com> Pushed-by: Sebastian Sdorra<sebastian.sdorra@cloudogu.com>
This commit is contained in:
@@ -28,6 +28,7 @@ package com.cloudogu.scm
|
||||
import com.moowork.gradle.node.task.NodeTask
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.Nested
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
@@ -67,7 +68,12 @@ class RunTask extends DefaultTask {
|
||||
@TaskAction
|
||||
void exec() {
|
||||
List<Closure<Void>> actions = new ArrayList<>()
|
||||
actions.add(createBackend())
|
||||
|
||||
// resolve the classpath on a thread which is controlled by gradle
|
||||
Configuration serverClasspath = project.buildscript.configurations.classpath
|
||||
serverClasspath.resolve()
|
||||
|
||||
actions.add(createBackend(serverClasspath))
|
||||
if (frontend) {
|
||||
actions.add(createFrontend())
|
||||
}
|
||||
@@ -89,7 +95,7 @@ class RunTask extends DefaultTask {
|
||||
return
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace()
|
||||
System.out.println("scm-server not reachable, retrying...")
|
||||
}
|
||||
Thread.sleep(500)
|
||||
}
|
||||
@@ -110,7 +116,7 @@ class RunTask extends DefaultTask {
|
||||
})
|
||||
}
|
||||
|
||||
private Closure<Void> createBackend() {
|
||||
private Closure<Void> createBackend(Configuration serverClasspath) {
|
||||
Map<String, String> scmProperties = System.getProperties().findAll { e ->
|
||||
{
|
||||
return e.key.startsWith("scm") || e.key.startsWith("sonia")
|
||||
@@ -129,7 +135,7 @@ class RunTask extends DefaultTask {
|
||||
args(new File(project.buildDir, 'server/config.json').toString())
|
||||
environment 'NODE_ENV', 'development'
|
||||
environment 'SCM_WEBAPP_HOMEDIR', extension.getHome()
|
||||
classpath project.buildscript.configurations.classpath
|
||||
classpath serverClasspath
|
||||
if (configFileDirectory != '') {
|
||||
classpath configFileDirectory
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ ext {
|
||||
|
||||
legmanVersion = '2.0.3'
|
||||
|
||||
mapstructVersion = '1.3.1.Final'
|
||||
mapstructVersion = '1.6.0'
|
||||
jaxbVersion = '4.0.1'
|
||||
shiroVersion = '1.12.0'
|
||||
sspVersion = '1.3.0'
|
||||
@@ -76,7 +76,7 @@ ext {
|
||||
swaggerJaxRs: 'io.swagger.core.v3:swagger-jaxrs2-jakarta:2.2.19',
|
||||
|
||||
// dto mapping
|
||||
mapstruct: "org.mapstruct:mapstruct-jdk8:${mapstructVersion}",
|
||||
mapstruct: "org.mapstruct:mapstruct:${mapstructVersion}",
|
||||
mapstructProcessor: "org.mapstruct:mapstruct-processor:${mapstructVersion}",
|
||||
|
||||
// events
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -46,3 +46,9 @@ dependencies {
|
||||
|
||||
testImplementation libraries.guava
|
||||
}
|
||||
|
||||
test {
|
||||
//Requiered by set environment variable annotation
|
||||
//Explanation: https://junit-pioneer.org/docs/environment-variables/#warnings-for-reflective-access
|
||||
jvmArgs("--add-opens=java.base/java.util=ALL-UNNAMED", "--add-opens=java.base/java.lang=ALL-UNNAMED")
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
{}
|
||||
{
|
||||
"chromeWebSecurity": false
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import sonia.scm.SCMContextProvider;
|
||||
import sonia.scm.net.ahc.AdvancedHttpClient;
|
||||
import sonia.scm.net.ahc.AdvancedHttpRequest;
|
||||
import sonia.scm.net.ahc.AdvancedHttpResponse;
|
||||
import sonia.scm.util.SystemUtil;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -86,7 +87,9 @@ class PluginInstallerTest {
|
||||
Path arg = ic.getArgument(0);
|
||||
return directory.resolve(arg);
|
||||
});
|
||||
InstalledPluginDescriptor supportedPlugin = createPluginDescriptor(new PluginCondition("1.0.0", List.of("linux"), "64"));
|
||||
InstalledPluginDescriptor supportedPlugin = createPluginDescriptor(
|
||||
new PluginCondition("1.0.0", List.of(SystemUtil.getOS()), SystemUtil.getArch())
|
||||
);
|
||||
lenient().when(extractor.extractPluginDescriptor(any())).thenReturn(supportedPlugin);
|
||||
}
|
||||
|
||||
@@ -166,7 +169,9 @@ class PluginInstallerTest {
|
||||
@Test
|
||||
void shouldFailForUnsupportedPlugin() throws IOException {
|
||||
mockContent("42");
|
||||
InstalledPluginDescriptor supportedPlugin = createPluginDescriptor(new PluginCondition("1.0.0", List.of("linux"), "42"));
|
||||
InstalledPluginDescriptor supportedPlugin = createPluginDescriptor(
|
||||
new PluginCondition("1.0.0", List.of(SystemUtil.getOS()), "42")
|
||||
);
|
||||
when(extractor.extractPluginDescriptor(any())).thenReturn(supportedPlugin);
|
||||
|
||||
PluginInstallationContext context = PluginInstallationContext.empty();
|
||||
@@ -179,7 +184,9 @@ class PluginInstallerTest {
|
||||
void shouldFailForNameMismatch() throws IOException {
|
||||
mockContent("42");
|
||||
|
||||
InstalledPluginDescriptor supportedPlugin = createPluginDescriptor("scm-svn-plugin", "1.0.0", new PluginCondition("1.0.0", List.of("linux"), "64"));
|
||||
InstalledPluginDescriptor supportedPlugin = createPluginDescriptor("scm-svn-plugin", "1.0.0",
|
||||
new PluginCondition("1.0.0", List.of(SystemUtil.getOS()), SystemUtil.getArch())
|
||||
);
|
||||
when(extractor.extractPluginDescriptor(any())).thenReturn(supportedPlugin);
|
||||
|
||||
PluginInstallationContext context = PluginInstallationContext.empty();
|
||||
@@ -193,7 +200,9 @@ class PluginInstallerTest {
|
||||
void shouldFailForVersionMismatch() throws IOException {
|
||||
mockContent("42");
|
||||
|
||||
InstalledPluginDescriptor supportedPlugin = createPluginDescriptor("scm-git-plugin", "1.1.0", new PluginCondition("42.0.0", List.of("linux"), "64"));
|
||||
InstalledPluginDescriptor supportedPlugin = createPluginDescriptor("scm-git-plugin", "1.1.0",
|
||||
new PluginCondition("42.0.0", List.of(SystemUtil.getOS()), SystemUtil.getArch())
|
||||
);
|
||||
when(extractor.extractPluginDescriptor(any())).thenReturn(supportedPlugin);
|
||||
|
||||
PluginInstallationContext context = PluginInstallationContext.empty();
|
||||
|
||||
@@ -83,13 +83,13 @@ if (settings.hasProperty("enablePackaging")) {
|
||||
|
||||
buildCache {
|
||||
local {
|
||||
enabled = false
|
||||
enabled = true
|
||||
}
|
||||
remote(HttpBuildCache) {
|
||||
enabled = true
|
||||
useExpectContinue = true
|
||||
url = 'https://build-cache.scm-manager.org/cache/'
|
||||
push = true
|
||||
push = "develop".equals(System.getenv("BRANCH_NAME"))
|
||||
credentials {
|
||||
username = System.getenv('GRADLE_BUILD_CACHE_USER')
|
||||
password = System.getenv('GRADLE_BUILD_CACHE_PASSWORD')
|
||||
|
||||
Reference in New Issue
Block a user