Visitar URL original
Merge branch 'release/3.0.0-RC2' · apache/polygene-java@6f4e666 · GitHub
Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 6f4e666

Browse files
committed
Merge branch 'release/3.0.0-RC2'
2 parents 7db51ad + 357eb4e commit 6f4e666

716 files changed

Lines changed: 13240 additions & 4765 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎buildSrc/build.gradle‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ repositories {
2828
dependencies {
2929
compile gradleApi()
3030
compile localGroovy()
31-
compile 'gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.3.0'
31+
compile 'gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.3.1'
3232
compile 'gradle.plugin.org.nosphere.honker:honker-gradle:0.3.0'
3333
compile 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
3434
compile 'org.apache.httpcomponents:httpclient:4.5.2'
3535
compile 'org.apache.httpcomponents:httpmime:4.5.2'
36-
compile 'com.bmuschko:gradle-docker-plugin:3.0.5'
36+
compile 'com.bmuschko:gradle-docker-plugin:3.0.7'
3737
compile 'com.moowork.gradle:gradle-node-plugin:1.1.1'
3838

3939
testCompile 'junit:junit:4.12'

‎buildSrc/src/main/groovy/org/apache/polygene/gradle/code/CodePlugin.groovy‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,9 @@ package org.apache.polygene.gradle.code
1919

2020
import groovy.transform.CompileStatic
2121
import org.apache.polygene.gradle.BasePlugin
22-
import org.apache.polygene.gradle.TaskGroups
2322
import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
2423
import org.apache.polygene.gradle.dependencies.DependenciesPlugin
25-
import org.gradle.api.Action
26-
import org.gradle.api.JavaVersion
27-
import org.gradle.api.Plugin
28-
import org.gradle.api.Project
29-
import org.gradle.api.Task
24+
import org.gradle.api.*
3025
import org.gradle.api.plugins.JavaPluginConvention
3126
import org.gradle.api.plugins.osgi.OsgiManifest
3227
import org.gradle.api.tasks.bundling.AbstractArchiveTask
@@ -35,6 +30,7 @@ import org.gradle.api.tasks.testing.Test
3530
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
3631
import org.gradle.jvm.tasks.Jar
3732
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
33+
import org.gradle.testing.jacoco.tasks.JacocoCoverageVerification
3834
import org.gradle.testing.jacoco.tasks.JacocoReport
3935

4036
@CompileStatic
@@ -175,9 +171,11 @@ class CodePlugin implements Plugin<Project>
175171
project.plugins.apply 'jacoco'
176172
def jacoco = project.extensions.getByType JacocoPluginExtension
177173
jacoco.toolVersion = dependencies.buildToolsVersions.jacoco
178-
project.tasks.withType( JacocoReport ) { JacocoReport task ->
179-
task.group = TaskGroups.VERIFICATION
180-
task.description = 'Generates test coverage report.'
174+
project.tasks.withType( JacocoReport ) { Task task ->
175+
task.group = null
176+
}
177+
project.tasks.withType( JacocoCoverageVerification ) { Task task ->
178+
task.group = null
181179
}
182180
}
183181

‎buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import org.gradle.api.artifacts.component.ModuleComponentSelector
2525
@CompileStatic
2626
class DependenciesDeclarationExtension
2727
{
28+
String gradleVersion
2829
final Map<String, String> repositoriesUrls = [ : ]
2930
final Map<String, Object> libraries = [ : ]
3031
final Map<String, List<Object>> defaultDependencies = [ : ]

libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/GenericRestLayer.java renamed to buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/ProjectGroupTasks.groovy

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
17-
*
18-
*
1917
*/
18+
package org.apache.polygene.gradle.structure
2019

21-
package org.apache.polygene.library.restlet.assembly;
20+
import groovy.transform.CompileStatic
21+
import org.apache.polygene.gradle.TaskGroups
22+
import org.gradle.api.Project
23+
import org.gradle.api.Task
2224

23-
import org.apache.polygene.bootstrap.AssemblyException;
24-
import org.apache.polygene.bootstrap.LayerAssembly;
25-
import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
26-
27-
public class GenericRestLayer extends LayeredLayerAssembler
25+
@CompileStatic
26+
class ProjectGroupTasks
2827
{
29-
30-
@Override
31-
public LayerAssembly assemble( LayerAssembly layer )
32-
throws AssemblyException
33-
{
34-
return null;
28+
static void configureProjectGroupTasks( String projectGroup, Project project )
29+
{
30+
project.tasks.create( "check${ projectGroup.capitalize() }" ) { Task task ->
31+
task.group = TaskGroups.VERIFICATION
32+
task.description = "Runs the $projectGroup checks"
33+
task.dependsOn( project.tasks.getByName( "check" ) )
3534
}
35+
}
3636
}

‎buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/RootPlugin.groovy‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ package org.apache.polygene.gradle.structure
1919

2020
import groovy.transform.CompileStatic
2121
import org.apache.polygene.gradle.BasePlugin
22+
import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
2223
import org.gradle.api.Plugin
2324
import org.gradle.api.Project
25+
import org.gradle.api.tasks.wrapper.Wrapper
26+
import org.gradle.util.GradleVersion
2427

2528
@CompileStatic
2629
class RootPlugin implements Plugin<Project>
@@ -34,6 +37,7 @@ class RootPlugin implements Plugin<Project>
3437
{
3538
project.plugins.apply BasePlugin
3639
applyProjectMetadata( project )
40+
applyGradleWrapper( project )
3741
}
3842

3943
private static void applyProjectMetadata( Project project )
@@ -42,4 +46,23 @@ class RootPlugin implements Plugin<Project>
4246
extraProperties.set 'title', PROJECT_TITLE
4347
extraProperties.set 'description', PROJECT_DESCRIPTION
4448
}
49+
50+
private static void applyGradleWrapper( Project project )
51+
{
52+
def dependencies = project.extensions.getByType( DependenciesDeclarationExtension )
53+
def requiredGradleVersion = GradleVersion.version( dependencies.gradleVersion )
54+
def currentGradleVersion = GradleVersion.current()
55+
if( currentGradleVersion != requiredGradleVersion ) {
56+
def warning = "The Apache Polygene™ build is not supported with $currentGradleVersion. " +
57+
"The only supported version is $requiredGradleVersion."
58+
project.logger.error( warning )
59+
project.gradle.buildFinished {
60+
project.logger.error( warning )
61+
}
62+
}
63+
project.tasks.create( 'wrapper', Wrapper) { Wrapper wrapper ->
64+
wrapper.gradleVersion = dependencies.gradleVersion
65+
wrapper.distributionType = Wrapper.DistributionType.ALL
66+
}
67+
}
4568
}

‎buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/core/CorePlugin.groovy‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import org.gradle.api.Plugin
2323
import org.gradle.api.Project
2424
import org.gradle.api.tasks.compile.JavaCompile
2525

26+
import static org.apache.polygene.gradle.structure.ProjectGroupTasks.configureProjectGroupTasks
27+
2628
@CompileStatic
2729
class CorePlugin implements Plugin<Project>
2830
{
@@ -31,6 +33,7 @@ class CorePlugin implements Plugin<Project>
3133
{
3234
project.plugins.apply PublishedCodePlugin
3335
configureJava( project )
36+
configureProjectGroupTasks( "core", project )
3437
}
3538

3639
private static void configureJava( Project project )

‎buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/distributions/DistributionsPlugin.groovy‎

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package org.apache.polygene.gradle.structure.distributions
1919

2020
import groovy.transform.CompileStatic
2121
import groovy.transform.TypeCheckingMode
22-
import org.apache.commons.io.FileUtils
2322
import org.apache.polygene.gradle.BasePlugin
2423
import org.apache.polygene.gradle.TaskGroups
2524
import org.apache.polygene.gradle.code.PublishedCodePlugin
@@ -52,6 +51,7 @@ import org.gradle.plugins.ide.internal.IdeDependenciesExtractor
5251
import org.gradle.plugins.ide.internal.resolver.model.IdeExtendedRepoFileDependency
5352
import org.gradle.plugins.signing.Sign
5453
import org.gradle.plugins.signing.SigningExtension
54+
import org.gradle.process.ExecSpec
5555

5656
import java.nio.file.Files
5757
import java.nio.file.Path
@@ -118,6 +118,7 @@ class DistributionsPlugin implements Plugin<Project>
118118
private static void applySourceDistribution( Project project )
119119
{
120120
def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
121+
def dependenciesDeclaration = project.rootProject.extensions.getByType( DependenciesDeclarationExtension )
121122
def srcDistFilesCopySpec = project.copySpec { CopySpec spec ->
122123
spec.from project.rootProject.projectDir
123124
spec.include '*.txt'
@@ -133,8 +134,8 @@ class DistributionsPlugin implements Plugin<Project>
133134
}
134135
spec.include 'distributions/**'
135136
spec.include 'reports/**'
136-
spec.include 'release/**'
137137
spec.include 'internals/**'
138+
spec.include 'release/**'
138139
spec.include 'manual/**'
139140
spec.include 'samples/**'
140141
spec.include 'tests/**'
@@ -147,7 +148,8 @@ class DistributionsPlugin implements Plugin<Project>
147148
spec.exclude '**/.git*' // Git files
148149
spec.exclude '**/build/**' // Build output
149150
spec.exclude 'gradlew*' // Gradle wrapper scripts
150-
spec.exclude 'gradle/wrapper/*.jar' // Gradle wrapper JAR
151+
spec.exclude 'gradle/wrapper/**' // Gradle wrapper
152+
spec.exclude 'tools/generator-polygene/app/templates/buildtool/wrapper' // Project Generator Gradle wrapper
151153
spec.exclude '**/.gradle/**' // Gradle caches
152154
spec.exclude '**/.gradletasknamecache' // Gradle shell completion cache
153155
spec.exclude '**/node_modules/**' // Node's node_module dir
@@ -168,6 +170,7 @@ class DistributionsPlugin implements Plugin<Project>
168170
def srcDistSupplementaryFilesCopySpec = project.copySpec { CopySpec spec ->
169171
spec.from project.file( 'src/src-dist' )
170172
spec.into '.'
173+
spec.filter { String line -> line.replaceAll( '%REQUIRED_GRADLE_VERSION%', dependenciesDeclaration.gradleVersion ) }
171174
}
172175
def srcDistFilteredFilesTask = project.tasks.create 'srcDistFilteredFiles'
173176
srcDistFilteredFilesTask.description = 'Apply release specification to source distribution build scripts'
@@ -248,6 +251,9 @@ class DistributionsPlugin implements Plugin<Project>
248251
task.group = TaskGroups.DISTRIBUTION_VERIFICATION
249252
task.description = 'Checks the source distribution using Apache RAT.'
250253
task.dependsOn TaskNames.STAGE_SOURCE_DIST
254+
task.plainOutput = true
255+
task.htmlOutput = true
256+
task.xmlOutput = false
251257
task.setInputDir unpackedSrcDistDir.absolutePath
252258
task.onlyIf { !releaseSpec.developmentVersion }
253259
task.excludes = [
@@ -278,15 +284,13 @@ class DistributionsPlugin implements Plugin<Project>
278284
// Graphic Resources
279285
'**/*.svg', '**/*.gif', '**/*.png', '**/*.jpg', '**/*.psd',
280286
// Keystores
281-
'**/*.jceks',
287+
'**/*.jceks', '**/*.p12',
282288
// Syntax Highlighter - MIT
283289
'manual/**/sh*.css', 'manual/**/sh*.js',
284290
// jQuery & plugins - MIT
285291
'manual/**/jquery*.js',
286292
// W3C XML Schemas - W3C Software License
287293
'samples/rental/src/main/resources/*.xsd',
288-
// Polygene Generator Heroes Templates - MIT
289-
'tools/generator-polygene/app/templates/Heroes/**',
290294
]
291295
} as Action<RatTask> )
292296
project.tasks.create( TaskNames.INSPECT_SOURCE_DIST ) { Task task ->
@@ -302,26 +306,44 @@ class DistributionsPlugin implements Plugin<Project>
302306
assertFileAbsent 'gradlew'
303307
assertFileAbsent 'gradlew.bat'
304308
assertFileAbsent 'gradle/wrapper/gradle-wrapper.jar'
305-
assertFilePresent 'gradle/wrapper/gradle-wrapper.properties'
309+
assertFileAbsent 'gradle/wrapper/gradle-wrapper.properties'
310+
assertFilePresent 'gradle/wrapper-install/build.gradle'
311+
312+
def wrapperFiles = []
313+
unpackedSrcDistDir.traverse { File file ->
314+
if(file.file &&
315+
(file.name.contains( 'gradle-wrapper' ) || file.name.contains('gradlew'))) {
316+
wrapperFiles << file
317+
}
318+
}
319+
assert wrapperFiles.empty
306320
}
307321
}
308322
project.tasks.create( TaskNames.BUILD_SOURCE_DIST, ExecLogged, { ExecLogged task ->
309323
task.group = TaskGroups.DISTRIBUTION_VERIFICATION
310-
task.description = 'Checks the source distribution by running `gradle build` inside.'
324+
task.description = 'Checks the source distribution by running `gradle check assemble` inside.'
311325
task.dependsOn TaskNames.STAGE_SOURCE_DIST
312326
task.mustRunAfter TaskNames.RAT_SOURCE_DIST
313327
task.mustRunAfter TaskNames.INSPECT_SOURCE_DIST
314328
def workDir = project.file( "$project.buildDir/tmp/${ TaskNames.BUILD_SOURCE_DIST }" )
315329
task.inputs.dir unpackedSrcDistDir
316330
task.workingDir = workDir
317-
def gradlew = new File( project.rootDir, 'gradlew' ).absolutePath
331+
def gradlew = new File( workDir, 'gradlew' ).absolutePath
318332
def settings = new File( workDir, 'settings.gradle' ).absolutePath
319-
task.commandLine = [ gradlew, '-c', settings, 'build', '-u', '-s', /* '-g', workDir */ ]
333+
task.commandLine = [ gradlew, '-c', settings, 'check', 'assemble', '-u', '-s', /* '-g', workDir */ ]
320334
task.doFirst {
321335
project.copy { CopySpec spec ->
322336
spec.from unpackedSrcDistDir
323337
spec.into workDir
324338
}
339+
def logName = "${ TaskNames.BUILD_SOURCE_DIST }_installWrapper"
340+
def stdout = project.file( "${ project.buildDir }/log/$logName/$logName-stdout.log" )
341+
def stderr = project.file( "${ project.buildDir }/log/$logName/$logName-stderr.log" )
342+
def rootGradlew = new File( project.rootDir, 'gradlew' ).absolutePath
343+
ExecLogged.execLogged( project, stdout, stderr, { ExecSpec spec ->
344+
spec.workingDir = workDir
345+
spec.commandLine = [ rootGradlew, '-i', '-s', '-b', 'gradle/wrapper-install/build.gradle', 'install' ]
346+
} as Action )
325347
}
326348
task.doLast {
327349
if( workDir.exists() )
@@ -359,16 +381,8 @@ class DistributionsPlugin implements Plugin<Project>
359381
}
360382
spec.into '.'
361383
}
362-
def extraDistBinCopySpec = project.copySpec { CopySpec spec ->
363-
releaseSpec.publishedProjects.collect { p ->
364-
spec.from "$p.projectDir/src/dist/"
365-
spec.include '**/*.jar'
366-
spec.include '**/*.jar_'
367-
}
368-
spec.into '.'
369-
}
370384
def binDistNoticesCopySpec = project.copySpec { CopySpec spec ->
371-
spec.from "$project.projectDir/LICENSE.txt"
385+
spec.from "$project.rootProject.projectDir/LICENSE.txt"
372386
spec.from "$project.projectDir/src/bin-dist"
373387
spec.into '.'
374388
}
@@ -377,7 +391,6 @@ class DistributionsPlugin implements Plugin<Project>
377391
spec.with binDistNoticesCopySpec
378392
spec.with docsCopySpec
379393
spec.with extraDistTextCopySpec
380-
spec.with extraDistBinCopySpec
381394
spec.with libsCopySpec
382395
}
383396

@@ -426,6 +439,9 @@ class DistributionsPlugin implements Plugin<Project>
426439
task.description = "Checks the binary distribution using Apache RAT."
427440
task.onlyIf { !releaseSpec.developmentVersion }
428441
task.dependsOn TaskNames.STAGE_BINARY_DIST
442+
task.plainOutput = true
443+
task.htmlOutput = true
444+
task.xmlOutput = false
429445
task.inputDir = unpackedBinDistDir.absolutePath
430446
task.reportDir = project.file( 'build/reports/rat-bin-dist' )
431447
task.excludes = [

‎buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/extensions/ExtensionPlugin.groovy‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ import org.apache.polygene.gradle.code.PublishedCodePlugin
2222
import org.gradle.api.Plugin
2323
import org.gradle.api.Project
2424

25+
import static org.apache.polygene.gradle.structure.ProjectGroupTasks.configureProjectGroupTasks
26+
2527
@CompileStatic
2628
class ExtensionPlugin implements Plugin<Project>
2729
{
2830
@Override
2931
void apply( Project project )
3032
{
3133
project.plugins.apply PublishedCodePlugin
34+
configureProjectGroupTasks( "extensions", project )
3235
}
3336
}

‎buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/internals/InternalDockerPlugin.groovy‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class InternalDockerPlugin implements Plugin<Project>
7676
project.rootProject.extensions.extraProperties.set( CodePlugin.DOCKER_DISABLED_EXTRA_PROPERTY, true )
7777
if( project.hasProperty( 'skipDocker' ) )
7878
{
79-
project.logger.lifecycle 'skipDocker property is set, all Docker tasks will be SKIPPED'
79+
project.logger.lifecycle 'skipDocker property is set, all Docker tasks will be SKIPPED'
8080
}
8181
else if( project.logger.isEnabled( LogLevel.INFO ) )
8282
{

‎buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/internals/InternalPlugin.groovy‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import org.gradle.api.Project
2525
@CompileStatic
2626
class InternalPlugin implements Plugin<Project>
2727
{
28-
@Override
29-
void apply( Project project )
30-
{
31-
project.plugins.apply CodePlugin
32-
}
28+
@Override
29+
void apply( Project project )
30+
{
31+
project.plugins.apply CodePlugin
32+
}
3333
}

0 commit comments

Comments
 (0)