diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 98cc8fd5..cd322038 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -22,3 +22,13 @@ plugins { repositories { jcenter() } + +dependencies { + // NOTE: keep plugin versions in sync with settings.gradle.kts + + // "com.jfrog.bintray" plugin + implementation( "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4" ) + + // "com.jfrog.artifactory" plugin + implementation( "org.jfrog.buildinfo:build-info-extractor-gradle:4.13.0" ) +} diff --git a/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts b/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts new file mode 100644 index 00000000..dee9ff6a --- /dev/null +++ b/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts @@ -0,0 +1,116 @@ +/* + * Copyright 2020 FormDev Software GmbH + * + * Licensed 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 + * + * https://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. + */ + + +open class PublishExtension { + var artifactId: String? = null + var name: String? = null + var description: String? = null +} + +val extension = project.extensions.create( "flatlafPublish" ) + + +plugins { + `maven-publish` + id( "com.jfrog.bintray" ) + id( "com.jfrog.artifactory" ) +} + +publishing { + publications { + create( "maven" ) { + afterEvaluate { + artifactId = extension.artifactId + } + groupId = "com.formdev" + + from( components["java"] ) + + pom { + afterEvaluate { + this@pom.name.set( extension.name ) + this@pom.description.set( extension.description ) + } + url.set( "https://github.com/JFormDesigner/FlatLaf" ) + + licenses { + license { + name.set( "The Apache License, Version 2.0" ) + url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) + } + } + + developers { + developer { + name.set( "Karl Tauber" ) + organization.set( "FormDev Software GmbH" ) + organizationUrl.set( "https://www.formdev.com/" ) + } + } + + scm { + url.set( "https://github.com/JFormDesigner/FlatLaf" ) + } + } + } + } +} + +bintray { + user = rootProject.extra["bintray.user"] as String? + key = rootProject.extra["bintray.key"] as String? + + setPublications( "maven" ) + + with( pkg ) { + repo = "flatlaf" + afterEvaluate { + this@with.name = extension.artifactId + } + setLicenses( "Apache-2.0" ) + vcsUrl = "https://github.com/JFormDesigner/FlatLaf" + + with( version ) { + name = project.version.toString() + } + + publish = rootProject.extra["bintray.publish"] as Boolean + dryRun = rootProject.extra["bintray.dryRun"] as Boolean + } +} + +artifactory { + setContextUrl( "https://oss.jfrog.org" ) + + publish( closureOf { + repository( delegateClosureOf { + setProperty( "repoKey", "oss-snapshot-local" ) + setProperty( "username", rootProject.extra["bintray.user"] as String? ) + setProperty( "password", rootProject.extra["bintray.key"] as String? ) + } ) + + defaults( delegateClosureOf { + invokeMethod( "publications", "maven" ) + setProperty( "publishArtifacts", true ) + setProperty( "publishPom", true ) + } ) + } ) + + resolve( delegateClosureOf { + setProperty( "repoKey", "jcenter" ) + } ) +} diff --git a/flatlaf-core/build.gradle.kts b/flatlaf-core/build.gradle.kts index 180ad03a..74a03b38 100644 --- a/flatlaf-core/build.gradle.kts +++ b/flatlaf-core/build.gradle.kts @@ -18,9 +18,7 @@ plugins { `java-library` `flatlaf-module-info` `flatlaf-java9` - `maven-publish` - id( "com.jfrog.bintray" ) - id( "com.jfrog.artifactory" ) + `flatlaf-publish` } java { @@ -55,81 +53,8 @@ tasks { } } -publishing { - publications { - create( "maven" ) { - artifactId = "flatlaf" - groupId = "com.formdev" - - from( components["java"] ) - - pom { - name.set( "FlatLaf" ) - description.set( "Flat Look and Feel" ) - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - - licenses { - license { - name.set( "The Apache License, Version 2.0" ) - url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) - } - } - - developers { - developer { - name.set( "Karl Tauber" ) - organization.set( "FormDev Software GmbH" ) - organizationUrl.set( "https://www.formdev.com/" ) - } - } - - scm { - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - } - } - } - } -} - -bintray { - user = rootProject.extra["bintray.user"] as String? - key = rootProject.extra["bintray.key"] as String? - - setPublications( "maven" ) - - with( pkg ) { - repo = "flatlaf" - name = "flatlaf" - setLicenses( "Apache-2.0" ) - vcsUrl = "https://github.com/JFormDesigner/FlatLaf" - - with( version ) { - name = project.version.toString() - } - - publish = rootProject.extra["bintray.publish"] as Boolean - dryRun = rootProject.extra["bintray.dryRun"] as Boolean - } -} - -artifactory { - setContextUrl( "https://oss.jfrog.org" ) - - publish( closureOf { - repository( delegateClosureOf { - setProperty( "repoKey", "oss-snapshot-local" ) - setProperty( "username", rootProject.extra["bintray.user"] as String? ) - setProperty( "password", rootProject.extra["bintray.key"] as String? ) - } ) - - defaults( delegateClosureOf { - invokeMethod( "publications", "maven" ) - setProperty( "publishArtifacts", true ) - setProperty( "publishPom", true ) - } ) - } ) - - resolve( delegateClosureOf { - setProperty( "repoKey", "jcenter" ) - } ) +flatlafPublish { + artifactId = "flatlaf" + name = "FlatLaf" + description = "Flat Look and Feel" } diff --git a/flatlaf-extras/build.gradle.kts b/flatlaf-extras/build.gradle.kts index e5c8370b..740b63c3 100644 --- a/flatlaf-extras/build.gradle.kts +++ b/flatlaf-extras/build.gradle.kts @@ -16,9 +16,7 @@ plugins { `java-library` - `maven-publish` - id( "com.jfrog.bintray" ) - id( "com.jfrog.artifactory" ) + `flatlaf-publish` } dependencies { @@ -41,81 +39,8 @@ tasks { } } -publishing { - publications { - create( "maven" ) { - artifactId = "flatlaf-extras" - groupId = "com.formdev" - - from( components["java"] ) - - pom { - name.set( "FlatLaf Extras" ) - description.set( "Flat Look and Feel Extras" ) - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - - licenses { - license { - name.set( "The Apache License, Version 2.0" ) - url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) - } - } - - developers { - developer { - name.set( "Karl Tauber" ) - organization.set( "FormDev Software GmbH" ) - organizationUrl.set( "https://www.formdev.com/" ) - } - } - - scm { - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - } - } - } - } -} - -bintray { - user = rootProject.extra["bintray.user"] as String? - key = rootProject.extra["bintray.key"] as String? - - setPublications( "maven" ) - - with( pkg ) { - repo = "flatlaf" - name = "flatlaf-extras" - setLicenses( "Apache-2.0" ) - vcsUrl = "https://github.com/JFormDesigner/FlatLaf" - - with( version ) { - name = project.version.toString() - } - - publish = rootProject.extra["bintray.publish"] as Boolean - dryRun = rootProject.extra["bintray.dryRun"] as Boolean - } -} - -artifactory { - setContextUrl( "https://oss.jfrog.org" ) - - publish( closureOf { - repository( delegateClosureOf { - setProperty( "repoKey", "oss-snapshot-local" ) - setProperty( "username", rootProject.extra["bintray.user"] as String? ) - setProperty( "password", rootProject.extra["bintray.key"] as String? ) - } ) - - defaults( delegateClosureOf { - invokeMethod( "publications", "maven" ) - setProperty( "publishArtifacts", true ) - setProperty( "publishPom", true ) - } ) - } ) - - resolve( delegateClosureOf { - setProperty( "repoKey", "jcenter" ) - } ) +flatlafPublish { + artifactId = "flatlaf-extras" + name = "FlatLaf Extras" + description = "Flat Look and Feel Extras" } diff --git a/flatlaf-intellij-themes/build.gradle.kts b/flatlaf-intellij-themes/build.gradle.kts index 18d6eeb0..87e3a2ab 100644 --- a/flatlaf-intellij-themes/build.gradle.kts +++ b/flatlaf-intellij-themes/build.gradle.kts @@ -17,9 +17,7 @@ plugins { `java-library` `flatlaf-module-info` - `maven-publish` - id( "com.jfrog.bintray" ) - id( "com.jfrog.artifactory" ) + `flatlaf-publish` } dependencies { @@ -45,81 +43,8 @@ tasks { } } -publishing { - publications { - create( "maven" ) { - artifactId = "flatlaf-intellij-themes" - groupId = "com.formdev" - - from( components["java"] ) - - pom { - name.set( "FlatLaf IntelliJ Themes Pack" ) - description.set( "Flat Look and Feel IntelliJ Themes Pack" ) - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - - licenses { - license { - name.set( "The Apache License, Version 2.0" ) - url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) - } - } - - developers { - developer { - name.set( "Karl Tauber" ) - organization.set( "FormDev Software GmbH" ) - organizationUrl.set( "https://www.formdev.com/" ) - } - } - - scm { - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - } - } - } - } -} - -bintray { - user = rootProject.extra["bintray.user"] as String? - key = rootProject.extra["bintray.key"] as String? - - setPublications( "maven" ) - - with( pkg ) { - repo = "flatlaf" - name = "flatlaf-intellij-themes" - setLicenses( "Apache-2.0" ) - vcsUrl = "https://github.com/JFormDesigner/FlatLaf" - - with( version ) { - name = project.version.toString() - } - - publish = rootProject.extra["bintray.publish"] as Boolean - dryRun = rootProject.extra["bintray.dryRun"] as Boolean - } -} - -artifactory { - setContextUrl( "https://oss.jfrog.org" ) - - publish( closureOf { - repository( delegateClosureOf { - setProperty( "repoKey", "oss-snapshot-local" ) - setProperty( "username", rootProject.extra["bintray.user"] as String? ) - setProperty( "password", rootProject.extra["bintray.key"] as String? ) - } ) - - defaults( delegateClosureOf { - invokeMethod( "publications", "maven" ) - setProperty( "publishArtifacts", true ) - setProperty( "publishPom", true ) - } ) - } ) - - resolve( delegateClosureOf { - setProperty( "repoKey", "jcenter" ) - } ) +flatlafPublish { + artifactId = "flatlaf-intellij-themes" + name = "FlatLaf IntelliJ Themes Pack" + description = "Flat Look and Feel IntelliJ Themes Pack" } diff --git a/flatlaf-jide-oss/build.gradle.kts b/flatlaf-jide-oss/build.gradle.kts index 680cf6b2..09b929d3 100644 --- a/flatlaf-jide-oss/build.gradle.kts +++ b/flatlaf-jide-oss/build.gradle.kts @@ -16,9 +16,7 @@ plugins { `java-library` - `maven-publish` - id( "com.jfrog.bintray" ) - id( "com.jfrog.artifactory" ) + `flatlaf-publish` } dependencies { @@ -41,81 +39,8 @@ tasks { } } -publishing { - publications { - create( "maven" ) { - artifactId = "flatlaf-jide-oss" - groupId = "com.formdev" - - from( components["java"] ) - - pom { - name.set( "FlatLaf addon for JIDE Common Layer" ) - description.set( "Flat Look and Feel addon for JIDE Common Layer" ) - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - - licenses { - license { - name.set( "The Apache License, Version 2.0" ) - url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) - } - } - - developers { - developer { - name.set( "Karl Tauber" ) - organization.set( "FormDev Software GmbH" ) - organizationUrl.set( "https://www.formdev.com/" ) - } - } - - scm { - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - } - } - } - } -} - -bintray { - user = rootProject.extra["bintray.user"] as String? - key = rootProject.extra["bintray.key"] as String? - - setPublications( "maven" ) - - with( pkg ) { - repo = "flatlaf" - name = "flatlaf-jide-oss" - setLicenses( "Apache-2.0" ) - vcsUrl = "https://github.com/JFormDesigner/FlatLaf" - - with( version ) { - name = project.version.toString() - } - - publish = rootProject.extra["bintray.publish"] as Boolean - dryRun = rootProject.extra["bintray.dryRun"] as Boolean - } -} - -artifactory { - setContextUrl( "https://oss.jfrog.org" ) - - publish( closureOf { - repository( delegateClosureOf { - setProperty( "repoKey", "oss-snapshot-local" ) - setProperty( "username", rootProject.extra["bintray.user"] as String? ) - setProperty( "password", rootProject.extra["bintray.key"] as String? ) - } ) - - defaults( delegateClosureOf { - invokeMethod( "publications", "maven" ) - setProperty( "publishArtifacts", true ) - setProperty( "publishPom", true ) - } ) - } ) - - resolve( delegateClosureOf { - setProperty( "repoKey", "jcenter" ) - } ) +flatlafPublish { + artifactId = "flatlaf-jide-oss" + name = "FlatLaf addon for JIDE Common Layer" + description = "Flat Look and Feel addon for JIDE Common Layer" } diff --git a/flatlaf-swingx/build.gradle.kts b/flatlaf-swingx/build.gradle.kts index 27aa351d..92f486a3 100644 --- a/flatlaf-swingx/build.gradle.kts +++ b/flatlaf-swingx/build.gradle.kts @@ -16,9 +16,7 @@ plugins { `java-library` - `maven-publish` - id( "com.jfrog.bintray" ) - id( "com.jfrog.artifactory" ) + `flatlaf-publish` } dependencies { @@ -41,81 +39,8 @@ tasks { } } -publishing { - publications { - create( "maven" ) { - artifactId = "flatlaf-swingx" - groupId = "com.formdev" - - from( components["java"] ) - - pom { - name.set( "FlatLaf addon for SwingX" ) - description.set( "Flat Look and Feel addon for SwingX" ) - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - - licenses { - license { - name.set( "The Apache License, Version 2.0" ) - url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) - } - } - - developers { - developer { - name.set( "Karl Tauber" ) - organization.set( "FormDev Software GmbH" ) - organizationUrl.set( "https://www.formdev.com/" ) - } - } - - scm { - url.set( "https://github.com/JFormDesigner/FlatLaf" ) - } - } - } - } -} - -bintray { - user = rootProject.extra["bintray.user"] as String? - key = rootProject.extra["bintray.key"] as String? - - setPublications( "maven" ) - - with( pkg ) { - repo = "flatlaf" - name = "flatlaf-swingx" - setLicenses( "Apache-2.0" ) - vcsUrl = "https://github.com/JFormDesigner/FlatLaf" - - with( version ) { - name = project.version.toString() - } - - publish = rootProject.extra["bintray.publish"] as Boolean - dryRun = rootProject.extra["bintray.dryRun"] as Boolean - } -} - -artifactory { - setContextUrl( "https://oss.jfrog.org" ) - - publish( closureOf { - repository( delegateClosureOf { - setProperty( "repoKey", "oss-snapshot-local" ) - setProperty( "username", rootProject.extra["bintray.user"] as String? ) - setProperty( "password", rootProject.extra["bintray.key"] as String? ) - } ) - - defaults( delegateClosureOf { - invokeMethod( "publications", "maven" ) - setProperty( "publishArtifacts", true ) - setProperty( "publishPom", true ) - } ) - } ) - - resolve( delegateClosureOf { - setProperty( "repoKey", "jcenter" ) - } ) +flatlafPublish { + artifactId = "flatlaf-swingx" + name = "FlatLaf addon for SwingX" + description = "Flat Look and Feel addon for SwingX" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 83a023c6..dc56e133 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,6 +27,7 @@ include( "flatlaf-theme-editor" ) pluginManagement { plugins { + // NOTE: keep plugin versions in sync with buildSrc/build.gradle.kts id( "com.jfrog.bintray" ) version "1.8.4" id( "com.jfrog.artifactory" ) version "4.13.0" }