Skip to content

Commit 48cdc72

Browse files
committed
Trim default Gradle build outputs
1 parent 606fb03 commit 48cdc72

6 files changed

Lines changed: 61 additions & 43 deletions

File tree

.github/workflows/main.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ jobs:
138138
uses: gradle/actions/wrapper-validation@v6.1.0
139139
- name: Test with Gradle Wrapper
140140
run: |
141-
./gradlew :jme3-screenshot-test:screenshotTest
141+
./gradlew :jme3-screenshot-tests:screenshotTest
142142
- name: Upload Test Reports
143143
uses: actions/upload-artifact@v7.0.0
144144
if: always()
@@ -277,8 +277,7 @@ jobs:
277277
shell: bash
278278
run: |
279279
# Normal build plus ZIP distribution and merged javadoc
280-
./gradlew -PuseCommitHashAsVersionName=true -PskipPrebuildLibraries=true \
281-
-x checkstyleMain -x checkstyleTest \
280+
./gradlew -PuseCommitHashAsVersionName=true -PskipPrebuildLibraries=true -PbuildJavaDoc=true \
282281
build createZipDistribution mergedJavadoc
283282
284283
if [ "${{ matrix.deploy }}" = "true" ];
@@ -298,13 +297,13 @@ jobs:
298297
echo "SIGNING_KEY, SIGNING_PASSWORD"
299298
300299
./gradlew publishMavenPublicationToDistRepository \
301-
-PskipPrebuildLibraries=true -PuseCommitHashAsVersionName=true \
300+
-PskipPrebuildLibraries=true -PuseCommitHashAsVersionName=true -PbuildJavaDoc=true \
302301
--console=plain --stacktrace
303302
else
304303
./gradlew publishMavenPublicationToDistRepository \
305304
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
306305
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
307-
-PskipPrebuildLibraries=true -PuseCommitHashAsVersionName=true \
306+
-PskipPrebuildLibraries=true -PuseCommitHashAsVersionName=true -PbuildJavaDoc=true \
308307
--console=plain --stacktrace
309308
fi
310309
@@ -483,6 +482,7 @@ jobs:
483482
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
484483
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
485484
-PuseCommitHashAsVersionName=true \
485+
-PbuildJavaDoc=true \
486486
--console=plain --stacktrace
487487
fi
488488
@@ -546,6 +546,7 @@ jobs:
546546
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
547547
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
548548
-PuseCommitHashAsVersionName=true \
549+
-PbuildJavaDoc=true \
549550
--console=plain --stacktrace
550551
.github/actions/tools/uploadToCentral.sh \
551552
-p '${{ secrets.CENTRAL_PASSWORD }}' \

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,14 @@ Run the Gradle wrapper:
139139

140140
After a successful build,
141141
snapshot jars will be found in the "*/build/libs" subfolders.
142+
The default build skips JavaDoc and source archives for speed; release and
143+
publishing tasks build them explicitly.
142144

143145
### Related Gradle tasks
144146

145147
You can install the Maven artifacts to your local repository:
146-
+ using Bash or PowerShell: `./gradlew install`
147-
+ using Windows Command Prompt: `.\gradlew install`
148+
+ using Bash or PowerShell: `./gradlew -PbuildJavaDoc=true install`
149+
+ using Windows Command Prompt: `.\gradlew -PbuildJavaDoc=true install`
148150

149151
You can restore the project to a pristine state:
150152
+ using Bash or PowerShell: `./gradlew clean`

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ Read our [contribution guide](https://github.com/jMonkeyEngine/jmonkeyengine/blo
9797

9898
After a successful build,
9999
fresh JARs will be found in "*/build/libs".
100+
The default build skips JavaDoc and source archives for speed; release and
101+
publishing tasks build them explicitly.
100102

101103
You can install the JARs to your local Maven repository:
102-
+ using Bash or Fish or PowerShell or Zsh: `./gradlew install`
103-
+ using Windows Command Prompt: `.\gradlew install`
104+
+ using Bash or Fish or PowerShell or Zsh: `./gradlew -PbuildJavaDoc=true install`
105+
+ using Windows Command Prompt: `.\gradlew -PbuildJavaDoc=true install`
104106

105107
You can run the "jme3-examples" app:
106108
+ using Bash or Fish or PowerShell or Zsh: `./gradlew run`

common.gradle

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
//
44

55
apply plugin: 'java-library'
6-
apply plugin: 'groovy'
6+
group = 'org.jmonkeyengine'
7+
version = jmeFullVersion
8+
9+
def groovySourcePresent = project.file('src/main/groovy').exists() || project.file('src/test/groovy').exists()
10+
11+
if (groovySourcePresent) {
12+
apply plugin: 'groovy'
13+
}
14+
715
apply plugin: 'maven-publish'
816
apply plugin: 'signing'
917
apply plugin: 'eclipse'
@@ -12,8 +20,6 @@ apply plugin: 'checkstyle'
1220
eclipse.jdt.file.withProperties { props ->
1321
props.setProperty "org.eclipse.jdt.core.circularClasspath", "warning"
1422
}
15-
group = 'org.jmonkeyengine'
16-
version = jmeFullVersion
1723

1824
java {
1925
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -24,7 +30,7 @@ java {
2430
}
2531
}
2632

27-
tasks.withType(JavaCompile) { // compile-time options:
33+
tasks.withType(JavaCompile).configureEach { // compile-time options:
2834
//options.compilerArgs << '-Xlint:deprecation' // to show deprecation warnings
2935
options.compilerArgs << '-Xlint:unchecked'
3036
options.encoding = 'UTF-8'
@@ -44,8 +50,10 @@ dependencies {
4450
testImplementation libs.junit.jupiter
4551
testImplementation libs.mokito.core
4652
testImplementation libs.mokito.junit.jupiter
47-
testImplementation libs.groovy.test
4853
testRuntimeOnly libs.junit.platform.launcher
54+
if (groovySourcePresent) {
55+
testImplementation libs.groovy.test
56+
}
4957
}
5058

5159
// Uncomment if you want to see the status of every test that is run and
@@ -67,7 +75,7 @@ jar {
6775
}
6876
}
6977

70-
javadoc {
78+
tasks.named('javadoc', Javadoc) {
7179
failOnError = false
7280
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
7381
options.docTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
@@ -90,14 +98,18 @@ test {
9098
}
9199
}
92100

93-
task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
101+
def sourcesJar = tasks.register('sourcesJar', Jar) {
102+
dependsOn classes
103+
description = 'Creates a jar from the source files.'
94104
archiveClassifier = 'sources'
95105
from sourceSets*.allSource
96106
}
97107

98-
task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
108+
def javadocJar = tasks.register('javadocJar', Jar) {
109+
dependsOn javadoc
110+
description = 'Creates a jar from the javadoc files.'
99111
archiveClassifier = 'javadoc'
100-
from javadoc.destinationDir
112+
from tasks.named('javadoc', Javadoc).map { it.destinationDir }
101113
}
102114

103115
ext.pomConfig = {
@@ -125,18 +137,16 @@ ext.pomConfig = {
125137
}
126138
}
127139

128-
tasks.named('assemble') {
129-
dependsOn sourcesJar
130-
if (buildJavaDoc == "true") {
131-
dependsOn javadocJar
132-
}
133-
}
140+
def hasSigningKey = providers.gradleProperty('signingKey').isPresent()
141+
def publishedModuleName = "${project.name}-${jmeFullVersion}"
134142

135143
publishing {
136144
publications {
137145
maven(MavenPublication) {
138-
artifact javadocJar
139146
artifact sourcesJar
147+
if (buildJavaDoc == "true") {
148+
artifact javadocJar
149+
}
140150
from components.java
141151
pom {
142152
description = POM_DESCRIPTION
@@ -197,10 +207,12 @@ publishing {
197207
}
198208
}
199209

200-
publishToMavenLocal.doLast {
201-
println 'published ' + project.getName() + "-${jmeFullVersion} to mavenLocal"
210+
tasks.named('publishToMavenLocal') {
211+
doLast {
212+
println "published ${publishedModuleName} to mavenLocal"
213+
}
202214
}
203-
task('install') {
215+
tasks.register('install') {
204216
dependsOn 'publishToMavenLocal'
205217
}
206218

@@ -211,8 +223,8 @@ signing {
211223

212224
sign publishing.publications.maven
213225
}
214-
tasks.withType(Sign) {
215-
onlyIf { gradle.rootProject.hasProperty('signingKey') }
226+
tasks.withType(Sign).configureEach {
227+
onlyIf { hasSigningKey }
216228
}
217229

218230
def checkstyleSupported = JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)
@@ -230,7 +242,7 @@ checkstyleTest {
230242
source ='src/test/java'
231243
}
232244

233-
tasks.withType(Checkstyle) {
245+
tasks.withType(Checkstyle).configureEach {
234246
enabled = checkstyleSupported
235247
reports {
236248
xml.required.set(false)

gradle.properties

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ useCommitHashAsVersionName = false
1212
# generated version.
1313
includeBranchInVersion = false
1414

15-
# specify if JavaDoc should be built
16-
buildJavaDoc = true
17-
18-
# Let Gradle fetch missing JDKs for toolchains automatically.
19-
org.gradle.java.installations.auto-download=true
20-
21-
# specify if SDK and Native libraries get built
22-
buildNativeProjects = false
23-
buildAndroidExamples = false
15+
# specify if JavaDoc should be built
16+
buildJavaDoc = false
17+
18+
# Let Gradle fetch missing JDKs for toolchains automatically.
19+
org.gradle.java.installations.auto-download=true
20+
21+
# specify if SDK and Native libraries get built
22+
buildNativeProjects = false
23+
buildAndroidExamples = false
2424

2525
# Forcefully ignore prebuilt libraries
2626
skipPrebuildLibraries=false

jme3-examples/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
ext.mainClassName = 'jme3test.TestChooser'
1+
def examplesMainClassName = 'jme3test.TestChooser'
2+
ext.mainClassName = examplesMainClassName
23

34
def androidProject = project(':jme3-android')
45
def androidNativeProject = project(':jme3-android-native')
56

67
task run(dependsOn: 'build', type:JavaExec) {
7-
mainClass = mainClassName
8+
mainClass = examplesMainClassName
89
classpath = sourceSets.main.runtimeClasspath
910

1011
if (System.properties['java.util.logging.config.file'] != null) {
@@ -208,7 +209,7 @@ jar.doFirst{
208209
// 'Implementation-Title' : appName,
209210
// 'Implementation-Version' : version,
210211
// 'Implementation-Vendor' : vendor,
211-
'Main-Class' : getProperty('mainClassName'),
212+
'Main-Class' : examplesMainClassName,
212213
// Add dependencies to manifest, remove version
213214
'Class-Path' : configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts.collect {
214215
'lib/' +

0 commit comments

Comments
 (0)