build: introduce zest extension for shorted dependency notation plus, it detangles publishing coordinates from project dependencies
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/17754489 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/17754489 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/17754489 Branch: refs/heads/develop Commit: 1775448929e524bea44ed99bfbc78c5354bf1373 Parents: 93355d6 Author: Paul Merlin <[email protected]> Authored: Fri Nov 11 19:03:46 2016 +0100 Committer: Paul Merlin <[email protected]> Committed: Fri Nov 11 19:03:46 2016 +0100 ---------------------------------------------------------------------- build.gradle | 5 ++ .../org/apache/zest/gradle/ZestExtension.groovy | 69 ++++++++++++++++++++ .../org/apache/zest/gradle/ZestPlugin.groovy | 32 +++++++++ 3 files changed, 106 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/17754489/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 5760720..cc78501 100644 --- a/build.gradle +++ b/build.gradle @@ -18,10 +18,15 @@ * */ import org.apache.tools.ant.filters.ReplaceTokens +import org.apache.zest.gradle.ZestPlugin import org.apache.zest.gradle.doc.AsciidocBuildInfoPlugin import org.apache.zest.gradle.release.ModuleReleaseSpec import org.apache.zest.gradle.version.VersionClassPlugin +allprojects { + apply plugin: ZestPlugin +} + project.ext { title = "Apache Zest⢠(Java Edition) SDK" description = "Apache Zest⢠(Java Edition) is a framework for domain centric application development, including evolved concepts from AOP, DI and DDD." http://git-wip-us.apache.org/repos/asf/zest-java/blob/17754489/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy ---------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy new file mode 100644 index 0000000..954291d --- /dev/null +++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.zest.gradle + +import org.gradle.api.Project +import org.gradle.api.artifacts.Dependency + +class ZestExtension +{ + private final Project project + final Core core + + ZestExtension( Project project ) + { + this.project = project + this.core = new Core() + } + + class Core + { + Dependency api = core( 'api' ) + Dependency spi = core( 'spi' ) + Dependency runtime = core( 'runtime' ) + Dependency bootstrap = core( 'bootstrap' ) + Dependency testsupport = core( 'testsupport' ) + Dependency io = core( 'io' ) + Dependency functional = core( 'functional' ) + } + + private Dependency core( String name ) + { + return dependency( 'org.apache.zest.core', "org.apache.zest.core.$name" ) + } + + Dependency library( String name ) + { + return dependency( 'org.apache.zest.libraries', "org.apache.zest.library.$name" ) + } + + Dependency extension( String name ) + { + return dependency( 'org.apache.zest.extensions', "org.apache.zest.extension.$name" ) + } + + Dependency tool( String name ) + { + return dependency( 'org.apache.zest.tools', "org.apache.zest.tool.$name" ) + } + + private Dependency dependency( String group, String name ) + { + project.dependencies.project( path: ":$group:$name" ) + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/17754489/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestPlugin.groovy ---------------------------------------------------------------------- diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestPlugin.groovy new file mode 100644 index 0000000..2752311 --- /dev/null +++ b/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestPlugin.groovy @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.zest.gradle + +import groovy.transform.CompileStatic +import org.gradle.api.Plugin +import org.gradle.api.Project + +@CompileStatic +class ZestPlugin implements Plugin<Project> +{ + @Override + void apply( final Project project ) + { + project.extensions.create( "zest", ZestExtension, project ) + } +}
