Skip to content

Commit d41d789

Browse files
authored
Pass arguments to Gradle via environment variables (#314)
This PR passes arguments to the Gradle builds via the `LOG4J_VERSION` and `LOG4J_REPOSITORY_URL` environment variables. This simplifies the build, since no command line parameters need to be used.
1 parent 6742c95 commit d41d789

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

.github/workflows/gradle-reusable-test.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ jobs:
7171
LOG4J_REPOSITORY_URL: ${{ inputs.log4j-repository-url }}
7272
run: |
7373
./gradlew \
74-
-Plog4j.version=$LOG4J_VERSION \
75-
-Plog4j.repository.url=$LOG4J_REPOSITORY_URL \
7674
:log4j-samples-gradle-metadata:check
7775
7876
- name: Enable KVM
@@ -129,8 +127,6 @@ jobs:
129127
LOG4J_REPOSITORY_URL: ${{ inputs.log4j-repository-url }}
130128
run: |
131129
./gradlew \
132-
-Plog4j.version=$LOG4J_VERSION \
133-
-Plog4j.repository.url=$LOG4J_REPOSITORY_URL \
134130
:app:build :app:connectedCheck
135131
136132
- name: Remove AVD Device

log4j-samples-android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ android {
4949
}
5050
}
5151

52-
def log4jVersion = providers.gradleProperty("log4j.version").get()
52+
def log4jVersion = providers.environmentVariable("LOG4J_VERSION").getOrElse("2.+")
5353

5454
dependencies {
5555

log4j-samples-gradle-metadata/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ plugins {
1818
id("application")
1919
}
2020

21-
def log4jVersion = providers.gradleProperty("log4j.version").getOrElse("2.+")
21+
def log4jVersion = providers.environmentVariable("LOG4J_VERSION").getOrElse("2.+")
2222

2323
application {
2424
mainModule = "org.example.log4j.metadata"

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencyResolutionManagement {
2828
mavenCentral()
2929
// Points to the correct Apache staging repository
3030
var apacheSnapshots = 'https://repository.apache.org/snapshots'
31-
var repositoryUrl = providers.gradleProperty('log4j.repository.url')
31+
var repositoryUrl = providers.environmentVariable('LOG4J_REPOSITORY_URL')
3232
.filter { !it.isEmpty() }
3333
.getOrElse(apacheSnapshots)
3434
maven {

0 commit comments

Comments
 (0)