Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move publishing to Gradle Plugin Portal #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions PUBLISH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To publish
* 2.10
```
./gradlew clean build :gradle-scalastyle-plugin_2.10:publishPlugin
```
* 2.11
```
./gradlew clean build :gradle-scalastyle-plugin_2.11:publishPlugin
```
* 2.12
```
./gradlew clean build :gradle-scalastyle-plugin_2.12:publishPlugin
```
13 changes: 0 additions & 13 deletions Publish.md

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Scala Style Gradle Plugin

Forked from https://github.com/ngbinh/gradle-scalastyle-plugin. We switched to using the gradle publish plugin since bintray/JCenter has been EOL.

[![Build Status](https://travis-ci.org/ngbinh/gradle-scalastyle-plugin.svg?branch=master)](https://travis-ci.org/ngbinh/gradle-scalastyle-plugin)

### Instructions
Expand Down
154 changes: 31 additions & 123 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}

plugins {
id "com.jfrog.bintray" version "1.3.1"
id "com.gradle.plugin-publish" version "0.15.0"
}

version = projectVersion
Expand All @@ -35,50 +38,43 @@ twoTenProject.ext.scalaDist = "2.10"
twoElevenProject.ext.scalaDist = "2.11"
twoTwelveProject.ext.scalaDist = "2.12"

task wrapper(type: Wrapper) {
gradleVersion = "4.7"
}

subprojects {
apply plugin: "java"
apply plugin: "scala"
apply plugin: "groovy"
apply plugin: 'signing' // For pushing to Sonatype OSS Staging repository
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
apply plugin: "groovy"
apply plugin: "scala"
apply plugin: "java"
apply plugin: "java-gradle-plugin"
apply from: file("${rootDir}/versionInfo.gradle")


sourceCompatibility = 1.8
targetCompatibility = 1.8

// JRE 1.6 should work
sourceCompatibility = 1.6
targetCompatibility = 1.6

version = projectVersion
group = projectGroup
version = projectVersion
group = projectGroup

ext {
versions = [:]
}

versions.scalaDist = scalaDist
versions.scalaStyle = "1.0.0"
versions.junit = "4.11"
versions.scalaDist = scalaDist

repositories {

repositories {
mavenCentral()
jcenter()
}
}


dependencies {
compile gradleApi()
compile localGroovy()
dependencies {

compile "org.scalastyle:scalastyle_${versions.scalaDist}:${versions.scalaStyle}"
testCompile 'junit:junit:${versions.junit}'
testCompile ('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude group:'org.codehaus.groovy'
implementation "org.scalastyle:scalastyle_${versions.scalaDist}:${versions.scalastyle}"
api "junit:junit:${versions.junit}"
api ("org.spockframework:spock-core:${versions.spock}") {
exclude group:"org.codehaus.groovy"
}
}
}


sourceSets {
sourceSets {
main {
resources {
srcDirs +=files([file("$rootDir/gradle-scalastyle-plugin_source/src/main/resources")])
Expand All @@ -96,98 +92,10 @@ subprojects {
srcDirs +=files([file("$rootDir/gradle-scalastyle-plugin_source/src/test/groovy")])
}
}
}

compileGroovy.dependsOn(compileScala)

// Required for Sonatype
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
classifier "sources"
extension "jar"
}

task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier "javadoc"
extension "jar"
}

configurations.create("sources")
configurations.create("javadoc")
configurations.archives {
extendsFrom configurations.sources
extendsFrom configurations.javadoc
}

// Used for testing the plugin in a local project.
task unversionedJar(type: Jar, dependsOn: 'jar') {
version = null
from sourceSets.main.output
}

task installPlugin(type: Copy, dependsOn: 'unversionedJar') {
def gradleInstallDir = gradle.gradleHomeDir
group = 'installation'
description = 'Installs the plugin jar in your gradle distribution.'
from "${buildDir}/libs/${unversionedJar.archiveName}"
into "/${gradleInstallDir}/lib/plugins"
doLast {
println "Installed in: ${gradleInstallDir}/lib/plugins as: ${unversionedJar.archiveName}"
}
}

task uninstallPlugin(type: Delete) {
def gradleInstallDir = gradle.gradleHomeDir
group = 'installation'
description = 'Removes the plugin from your gradle distribution.'
delete("/${gradleInstallDir}/lib/plugins/${unversionedJar.archiveName}")
}

artifacts {
sources(sourcesJar) {
type "jar"
}
javadoc(javadocJar) {
type "javadoc"
}
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
groupId = projectGroup

artifact sourcesJar {
classifier "sources"
}
compileGroovy.dependsOn(compileScala)


artifact javadocJar {
classifier "javadoc"
}
}
}
}

bintray {

user = project.hasProperty('bintray_user') ? project.bintray_user : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintray_key') ? project.bintray_key : System.getenv('BINTRAY_API_KEY')

publications = ['mavenJava']
pkg {
repo = 'maven'
name = project.name
desc = 'gradle-scalastyle is a Gradle plugin for running the Scalastyle style checker.'
licenses = ['Apache-2.0']
labels = [version]
desc = 'Gradle plugin for scalaStyle'
websiteUrl = projectHomepage
issueTrackerUrl = 'https://github.com/ngbinh/gradle-scalastyle-plugin/issues'
vcsUrl = 'https://github.com/ngbinh/gradle-scalastyle-plugin.git'
licenses = ['Apache-2.0']
publicDownloadNumbers = true
}
}
}
22 changes: 22 additions & 0 deletions gradle-scalastyle-plugin_2.10/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,25 @@
*/

// Empty for now

plugins {
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish'
}

pluginBundle {
website = "https://github.com/Workday"
vcsUrl = "https://github.com/Workday/gradle-scalastyle-plugin"
tags = ["scalastyle", "gradle"]
}

gradlePlugin {
plugins {
greetingsPlugin {
id = "com.workday.warp.scalastyle_2.10"
displayName = "Gradle Scalastyle"
description = "Gradle plugin for running the Scalastyle style checker"
implementationClass = "com.workday.warp.scalastyle.ScalaStylePlugin"
}
}
}
22 changes: 22 additions & 0 deletions gradle-scalastyle-plugin_2.11/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,25 @@
*/

// Empty for now

plugins {
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish'
}

pluginBundle {
website = "https://github.com/Workday"
vcsUrl = "https://github.com/Workday/gradle-scalastyle-plugin"
tags = ["scalastyle", "gradle"]
}

gradlePlugin {
plugins {
greetingsPlugin {
id = "com.workday.warp.scalastyle_2.11"
displayName = "Gradle Scalastyle"
description = "Gradle plugin for running the Scalastyle style checker"
implementationClass = "com.workday.warp.scalastyle.ScalaStylePlugin"
}
}
}
22 changes: 22 additions & 0 deletions gradle-scalastyle-plugin_2.12/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,25 @@
*/

// Empty for now

plugins {
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish'
}

pluginBundle {
website = "https://github.com/Workday"
vcsUrl = "https://github.com/Workday/gradle-scalastyle-plugin"
tags = ["scalastyle", "gradle"]
}

gradlePlugin {
plugins {
greetingsPlugin {
id = "com.workday.warp.scalastyle_2.12"
displayName = "Gradle Scalastyle"
description = "Gradle plugin for running the Scalastyle style checker"
implementationClass = "com.workday.warp.scalastyle.ScalaStylePlugin"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.github.ngbinh.scalastyle
package com.workday.warp.scalastyle

import org.gradle.api.Plugin
import org.gradle.api.Project

/**
* @author Richie Wang
* @since 6/9/2021
* @author Binh Nguyen
* @since 12/16/2014
* @author Muhammad Ashraf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.github.ngbinh.scalastyle
package com.workday.warp.scalastyle


import org.gradle.api.file.FileTree
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.SkipWhenEmpty
import org.gradle.api.tasks.SourceTask
Expand All @@ -28,28 +32,44 @@ import org.scalastyle.TextOutput
import org.scalastyle.XmlOutput

/**
* @author Richie Wang
* @since 6/9/2021
* @author Binh Nguyen
* @since 12/16/2014
* @author Muhammad Ashraf
* @since 5/11/13
*/
class ScalaStyleTask extends SourceTask {
@InputDirectory
File buildDirectory = project.buildDir
@Input
String configLocation
@Input
String testConfigLocation
@OutputFile
String outputFile = buildDirectory.absolutePath + "/scala_style_result.xml"
@Input
String outputEncoding = "UTF-8"
@Input
Boolean failOnViolation = true
@Input
Boolean failOnWarning = false
@Input
Boolean skip = false
@Input
Boolean verbose = false
@Input
Boolean quiet = false
@Input
Boolean includeTestSourceDirectory = true
@Input
String inputEncoding = "UTF-8"
ScalaStyleUtils scalaStyleUtils = new ScalaStyleUtils()
@Input
String testSource
@InputDirectory
FileTree testSourceDir
@Internal
ScalaStyleUtils scalaStyleUtils = new ScalaStyleUtils()

ScalaStyleTask() {
super()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# limitations under the License.
#

implementation-class=org.github.ngbinh.scalastyle.ScalaStylePlugin
implementation-class=com.workday.warp.scalastyle.ScalaStylePlugin
Loading