mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-30 02:30:12 +08:00
[gradle+deps] Adjust memory limit for test Gradle instances
This commit is contained in:
parent
5c4a3aeb38
commit
9540bc95c5
2
.github/workflows/check-publishing.yml
vendored
2
.github/workflows/check-publishing.yml
vendored
@ -129,4 +129,4 @@ jobs:
|
|||||||
run: ./gradlew :mirai-deps-test:publishMiraiArtifactsToMavenLocal ${{ env.gradleArgs }} "-Porg.gradle.parallel=${{ matrix.parallelCompilation }}"
|
run: ./gradlew :mirai-deps-test:publishMiraiArtifactsToMavenLocal ${{ env.gradleArgs }} "-Porg.gradle.parallel=${{ matrix.parallelCompilation }}"
|
||||||
|
|
||||||
- name: Check Publication
|
- name: Check Publication
|
||||||
run: ./gradlew :mirai-deps-test:check ${{ env.gradleArgs }} "-Dmirai.deps.test.must.run=true"
|
run: ./gradlew :mirai-deps-test:check ${{ env.gradleArgs }} "-Dmirai.deps.test.must.run=true" "-Porg.gradle.parallel=${{ matrix.parallelCompilation }}"
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
enableLocalPublishingTest: 'false'
|
enableLocalPublishingTest: 'false'
|
||||||
# All targets MUST be enabled. See #2270.
|
# All targets MUST be enabled. See #2270.
|
||||||
gradleArgs: --scan "-Dmirai.target=other" "-Pkotlin.compiler.execution.strategy=in-process"
|
gradleArgs: --scan "-Dmirai.target=other" "-Pkotlin.compiler.execution.strategy=in-process" "-Dorg.gradle.jvmargs=-Xmx4096m" "-Dfile.encoding=UTF-8"
|
||||||
isMac: ${{ startsWith(matrix.os, 'macos') }}
|
isMac: ${{ startsWith(matrix.os, 'macos') }}
|
||||||
isWindows: ${{ startsWith(matrix.os, 'windows') }}
|
isWindows: ${{ startsWith(matrix.os, 'windows') }}
|
||||||
isUbuntu: ${{ startsWith(matrix.os, 'ubuntu') }}
|
isUbuntu: ${{ startsWith(matrix.os, 'ubuntu') }}
|
||||||
|
@ -23,7 +23,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
|
|||||||
object Versions {
|
object Versions {
|
||||||
val project = System.getenv("mirai.build.project.version")?.takeIf { it.isNotBlank() }
|
val project = System.getenv("mirai.build.project.version")?.takeIf { it.isNotBlank() }
|
||||||
?: System.getProperty("mirai.build.project.version")?.takeIf { it.isNotBlank() }
|
?: System.getProperty("mirai.build.project.version")?.takeIf { it.isNotBlank() }
|
||||||
?: /*PROJECT_VERSION_START*/"2.14.0-dev-shadow-6"/*PROJECT_VERSION_END*/
|
?: /*PROJECT_VERSION_START*/"2.14.0-dev-shadow-8"/*PROJECT_VERSION_END*/
|
||||||
// DO NOT ADD SPACE BETWEEN!
|
// DO NOT ADD SPACE BETWEEN!
|
||||||
|
|
||||||
val core get() = project
|
val core get() = project
|
||||||
|
@ -38,11 +38,13 @@ abstract class AbstractTest {
|
|||||||
.forwardOutput()
|
.forwardOutput()
|
||||||
.withEnvironment(System.getenv())
|
.withEnvironment(System.getenv())
|
||||||
.withArguments(buildList {
|
.withArguments(buildList {
|
||||||
add("--no-daemon")
|
|
||||||
add("-Pkotlin.compiler.execution.strategy=in-process")
|
|
||||||
add("-Dorg.gradle.jvmargs=-Xmx256m")
|
|
||||||
add("-Dfile.encoding=UTF-8")
|
|
||||||
addAll(arguments)
|
addAll(arguments)
|
||||||
|
add("-P")
|
||||||
|
add("kotlin.compiler.execution.strategy=in-process")
|
||||||
|
add("-D")
|
||||||
|
add("org.gradle.jvmargs=-Xmx512m")
|
||||||
|
add("-D")
|
||||||
|
add("file.encoding=UTF-8")
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
@ -113,6 +113,7 @@ val publishMiraiLocalArtifacts = tasks.register("publishMiraiLocalArtifacts", Ex
|
|||||||
"--scan",
|
"--scan",
|
||||||
"-Pkotlin.compiler.execution.strategy=in-process"
|
"-Pkotlin.compiler.execution.strategy=in-process"
|
||||||
)
|
)
|
||||||
|
|
||||||
standardOutput = System.out
|
standardOutput = System.out
|
||||||
errorOutput = System.err
|
errorOutput = System.err
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ package net.mamoe.mirai.deps.test
|
|||||||
|
|
||||||
import org.gradle.api.internal.artifacts.mvnsettings.DefaultMavenFileLocations
|
import org.gradle.api.internal.artifacts.mvnsettings.DefaultMavenFileLocations
|
||||||
import org.gradle.testkit.runner.GradleRunner
|
import org.gradle.testkit.runner.GradleRunner
|
||||||
|
import org.gradle.testkit.runner.internal.DefaultGradleRunner
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.extension.AfterEachCallback
|
import org.junit.jupiter.api.extension.AfterEachCallback
|
||||||
import org.junit.jupiter.api.extension.RegisterExtension
|
import org.junit.jupiter.api.extension.RegisterExtension
|
||||||
@ -89,6 +90,7 @@ abstract class AbstractTest {
|
|||||||
lateinit var settingsFile: File
|
lateinit var settingsFile: File
|
||||||
lateinit var propertiesFile: File
|
lateinit var propertiesFile: File
|
||||||
|
|
||||||
|
private inline fun <reified T> Any?.cast(): T = this as T
|
||||||
|
|
||||||
@OptIn(ExperimentalStdlibApi::class)
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
fun runGradle(vararg arguments: String) {
|
fun runGradle(vararg arguments: String) {
|
||||||
@ -99,13 +101,19 @@ abstract class AbstractTest {
|
|||||||
.withGradleVersion("7.2")
|
.withGradleVersion("7.2")
|
||||||
.forwardOutput()
|
.forwardOutput()
|
||||||
.withEnvironment(System.getenv())
|
.withEnvironment(System.getenv())
|
||||||
.withArguments(buildList {
|
.cast<DefaultGradleRunner>().withJvmArguments(buildList {
|
||||||
add("--no-daemon")
|
add("-Xmx512m") // Kotlin MPP may need memory to build
|
||||||
add("-Pkotlin.compiler.execution.strategy=in-process")
|
|
||||||
add("-Dorg.gradle.jvmargs=-Xmx512m")
|
|
||||||
add("-Dfile.encoding=UTF-8")
|
add("-Dfile.encoding=UTF-8")
|
||||||
add("--stacktrace")
|
})
|
||||||
|
.withArguments(buildList {
|
||||||
addAll(arguments)
|
addAll(arguments)
|
||||||
|
add("-P")
|
||||||
|
add("kotlin.compiler.execution.strategy=in-process")
|
||||||
|
add("-D")
|
||||||
|
add("org.gradle.jvmargs=-Xmx512m")
|
||||||
|
add("-D")
|
||||||
|
add("file.encoding=UTF-8")
|
||||||
|
add("--stacktrace")
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
@ -157,12 +157,13 @@ class CoreShadowRelocationTest : AbstractTest() {
|
|||||||
// mirai-core-all-2.99.0-deps-test-all.jar
|
// mirai-core-all-2.99.0-deps-test-all.jar
|
||||||
val miraiCoreAllJar =
|
val miraiCoreAllJar =
|
||||||
mavenLocalDir.resolve("net/mamoe/mirai-core-all/$miraiLocalVersion/mirai-core-all-$miraiLocalVersion-all.jar")
|
mavenLocalDir.resolve("net/mamoe/mirai-core-all/$miraiLocalVersion/mirai-core-all-$miraiLocalVersion-all.jar")
|
||||||
assertTrue("'${miraiCoreAllJar.absolutePath}' does not exist") { miraiCoreAllJar.exists() }
|
val path = miraiCoreAllJar.absolutePath.replace("\\", "/") // overcome string escape in source files.
|
||||||
|
assertTrue("'$path' does not exist") { miraiCoreAllJar.exists() }
|
||||||
|
|
||||||
buildFile.appendText(
|
buildFile.appendText(
|
||||||
"""
|
"""
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(fileTree("${miraiCoreAllJar.absolutePath}"))
|
implementation(fileTree("$path"))
|
||||||
}
|
}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user