Skip to content

Commit 794f427

Browse files
committed
Trim default Gradle build outputs
1 parent 46d5938 commit 794f427

File tree

6 files changed

+57
-39
lines changed

6 files changed

+57
-39
lines changed

.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@v5.0.2
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()
@@ -285,8 +285,7 @@ jobs:
285285
shell: bash
286286
run: |
287287
# Normal build plus ZIP distribution and merged javadoc
288-
./gradlew -PuseCommitHashAsVersionName=true -PskipPrebuildLibraries=true \
289-
-x checkstyleMain -x checkstyleTest \
288+
./gradlew -PuseCommitHashAsVersionName=true -PskipPrebuildLibraries=true -PbuildJavaDoc=true \
290289
build createZipDistribution mergedJavadoc
291290
292291
if [ "${{ matrix.deploy }}" = "true" ];
@@ -306,13 +305,13 @@ jobs:
306305
echo "SIGNING_KEY, SIGNING_PASSWORD"
307306
308307
./gradlew publishMavenPublicationToDistRepository \
309-
-PskipPrebuildLibraries=true -PuseCommitHashAsVersionName=true \
308+
-PskipPrebuildLibraries=true -PuseCommitHashAsVersionName=true -PbuildJavaDoc=true \
310309
--console=plain --stacktrace
311310
else
312311
./gradlew publishMavenPublicationToDistRepository \
313312
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
314313
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
315-
-PskipPrebuildLibraries=true -PuseCommitHashAsVersionName=true \
314+
-PskipPrebuildLibraries=true -PuseCommitHashAsVersionName=true -PbuildJavaDoc=true \
316315
--console=plain --stacktrace
317316
fi
318317
@@ -491,6 +490,7 @@ jobs:
491490
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
492491
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
493492
-PuseCommitHashAsVersionName=true \
493+
-PbuildJavaDoc=true \
494494
--console=plain --stacktrace
495495
fi
496496
@@ -554,6 +554,7 @@ jobs:
554554
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
555555
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
556556
-PuseCommitHashAsVersionName=true \
557+
-PbuildJavaDoc=true \
557558
--console=plain --stacktrace
558559
.github/actions/tools/uploadToCentral.sh \
559560
-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,15 +20,13 @@ 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
2026
targetCompatibility = JavaVersion.VERSION_1_8
2127
}
2228

23-
tasks.withType(JavaCompile) { // compile-time options:
29+
tasks.withType(JavaCompile).configureEach { // compile-time options:
2430
//options.compilerArgs << '-Xlint:deprecation' // to show deprecation warnings
2531
options.compilerArgs << '-Xlint:unchecked'
2632
options.encoding = 'UTF-8'
@@ -42,8 +48,10 @@ dependencies {
4248
testImplementation libs.junit.jupiter
4349
testImplementation libs.mokito.core
4450
testImplementation libs.mokito.junit.jupiter
45-
testImplementation libs.groovy.test
4651
testRuntimeOnly libs.junit.platform.launcher
52+
if (groovySourcePresent) {
53+
testImplementation libs.groovy.test
54+
}
4755
}
4856

4957
// Uncomment if you want to see the status of every test that is run and
@@ -65,7 +73,7 @@ jar {
6573
}
6674
}
6775

68-
javadoc {
76+
tasks.named('javadoc', Javadoc) {
6977
failOnError = false
7078
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
7179
options.docTitle = "jMonkeyEngine ${jmeFullVersion} ${project.name} Javadoc"
@@ -88,14 +96,18 @@ test {
8896
}
8997
}
9098

91-
task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
99+
def sourcesJar = tasks.register('sourcesJar', Jar) {
100+
dependsOn classes
101+
description = 'Creates a jar from the source files.'
92102
archiveClassifier = 'sources'
93103
from sourceSets*.allSource
94104
}
95105

96-
task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
106+
def javadocJar = tasks.register('javadocJar', Jar) {
107+
dependsOn javadoc
108+
description = 'Creates a jar from the javadoc files.'
97109
archiveClassifier = 'javadoc'
98-
from javadoc.destinationDir
110+
from tasks.named('javadoc', Javadoc).map { it.destinationDir }
99111
}
100112

101113
ext.pomConfig = {
@@ -123,18 +135,16 @@ ext.pomConfig = {
123135
}
124136
}
125137

126-
tasks.named('assemble') {
127-
dependsOn sourcesJar
128-
if (buildJavaDoc == "true") {
129-
dependsOn javadocJar
130-
}
131-
}
138+
def hasSigningKey = providers.gradleProperty('signingKey').isPresent()
139+
def publishedModuleName = "${project.name}-${jmeFullVersion}"
132140

133141
publishing {
134142
publications {
135143
maven(MavenPublication) {
136-
artifact javadocJar
137144
artifact sourcesJar
145+
if (buildJavaDoc == "true") {
146+
artifact javadocJar
147+
}
138148
from components.java
139149
pom {
140150
description = POM_DESCRIPTION
@@ -195,10 +205,12 @@ publishing {
195205
}
196206
}
197207

198-
publishToMavenLocal.doLast {
199-
println 'published ' + project.getName() + "-${jmeFullVersion} to mavenLocal"
208+
tasks.named('publishToMavenLocal') {
209+
doLast {
210+
println "published ${publishedModuleName} to mavenLocal"
211+
}
200212
}
201-
task('install') {
213+
tasks.register('install') {
202214
dependsOn 'publishToMavenLocal'
203215
}
204216

@@ -209,8 +221,8 @@ signing {
209221

210222
sign publishing.publications.maven
211223
}
212-
tasks.withType(Sign) {
213-
onlyIf { gradle.rootProject.hasProperty('signingKey') }
224+
tasks.withType(Sign).configureEach {
225+
onlyIf { hasSigningKey }
214226
}
215227

216228
def checkstyleSupported = JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)
@@ -228,7 +240,7 @@ checkstyleTest {
228240
source ='src/test/java'
229241
}
230242

231-
tasks.withType(Checkstyle) {
243+
tasks.withType(Checkstyle).configureEach {
232244
enabled = checkstyleSupported
233245
reports {
234246
xml.required.set(false)

gradle.properties

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

15-
# specify if JavaDoc should be built
16-
buildJavaDoc = true
17-
18-
# specify if SDK and Native libraries get built
19-
buildNativeProjects = false
15+
# specify if JavaDoc should be built
16+
buildJavaDoc = false
17+
18+
# specify if SDK and Native libraries get built
19+
buildNativeProjects = false
2020
buildAndroidExamples = false
2121

2222
buildForPlatforms = Linux64,Linux32,Windows64,Windows32,Mac64

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) {
@@ -46,7 +47,7 @@ jar.doFirst{
4647
// 'Implementation-Title' : appName,
4748
// 'Implementation-Version' : version,
4849
// 'Implementation-Vendor' : vendor,
49-
'Main-Class' : getProperty('mainClassName'),
50+
'Main-Class' : examplesMainClassName,
5051
// Add dependencies to manifest, remove version
5152
'Class-Path' : configurations.compileClasspath.resolvedConfiguration.resolvedArtifacts.collect {
5253
'lib/' +

0 commit comments

Comments
 (0)