Skip to content

Commit

Permalink
first commit after forking
Browse files Browse the repository at this point in the history
  • Loading branch information
augi committed Apr 18, 2021
1 parent 6ce5b82 commit 64c0f3e
Show file tree
Hide file tree
Showing 21 changed files with 150 additions and 95 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Check with Gradle
run: ./gradlew check --info
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Check with Gradle
run: ./gradlew check --info -Pversion=${{ github.event.release.tag_name }}
- name: Publish with Gradle to Gradle Plugins portal
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository publishPlugins --info -Pversion=${{ github.event.release.tag_name }}
env:
GRADLE_PORTAL_KEY: ${{ secrets.GRADLE_PORTAL_KEY }}
GRADLE_PORTAL_SECRET: ${{ secrets.GRADLE_PORTAL_SECRET }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
9 changes: 0 additions & 9 deletions Dockerfile

This file was deleted.

6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Scalafmt Gradle plugin

[![Build Status](https://travis-ci.org/alenkacz/gradle-scalafmt.svg)](https://travis-ci.org/alenkacz/gradle-scalafmt) [ ![Download](https://api.bintray.com/packages/alenkacz/maven/gradle-scalafmt/images/download.svg) ](https://bintray.com/alenkacz/maven/gradle-scalafmt/_latestVersion)
# Gradle scalafmt plugin [![Build](https://github.com/augi/gradle-scalafmt/actions/workflows/build.yml/badge.svg)](https://github.com/augi/gradle-scalafmt/actions/workflows/build.yml)

This plugin will allow you to format your scala code as a part of your build process. In the background, it uses [scalafmt](https://github.com/scalameta/scalafmt) library.

Expand All @@ -12,7 +10,7 @@ Usage
====================

plugins {
id 'cz.alenkacz.gradle.scalafmt' version '$latestVersion'
id 'cz.augi.gradle.scalafmt' version 'putCurrentVersionHere'
}

scalafmt {
Expand Down
140 changes: 78 additions & 62 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,88 +1,104 @@
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.gradle.publish:plugin-publish-plugin:0.14.0'
}
}

plugins {
id 'net.researchgate.release' version '2.8.1'
id 'groovy'
id 'maven-publish'
id 'java-gradle-plugin'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0'
id 'com.gradle.plugin-publish' version '0.14.0'
}

group 'cz.alenkacz'
group 'cz.augi'
version = version == 'unspecified' ? 'DEVELOPER-SNAPSHOT' : version

apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.gradle.plugin-publish'

repositories {
jcenter()
mavenCentral()
}

dependencies {
compile gradleApi()
compile 'org.scalameta:scalafmt-dynamic_2.12:2.7.5'
compile 'org.scala-lang.modules:scala-xml_2.12:1.3.0'
testCompile 'junit:junit:4.13'
testCompile gradleTestKit()
testCompile ('org.spockframework:spock-core:1.3-groovy-2.4') {
api gradleApi()
api 'org.scalameta:scalafmt-dynamic_2.12:2.7.5'
api 'org.scala-lang.modules:scala-xml_2.12:1.3.0'

testImplementation 'junit:junit:4.13.2'
testImplementation gradleTestKit()
testImplementation ('org.spockframework:spock-core:2.0-M5-groovy-3.0') {
exclude group:'org.codehaus.groovy'
}
}

test {
useJUnitPlatform()
testLogging {
events 'failed'
exceptionFormat 'full'
}
}

task sourcesJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier = 'sources'
sourceCompatibility = JavaVersion.VERSION_1_8

project.ext.set('gradle.publish.key', System.getenv('GRADLE_PORTAL_KEY'))
project.ext.set('gradle.publish.secret', System.getenv('GRADLE_PORTAL_SECRET'))
pluginBundle {
website = 'https://github.com/augi/gradle-scalafmt'
vcsUrl = 'https://github.com/augi/gradle-scalafmt'
description = 'Gradle plugin to apply scalafmt (Scala linting tool)'
tags = ['gradle', 'scala', 'scalafmt']

plugins {
wartremoverPlugin {
id = 'cz.augi.gradle.scalafmt'
displayName = 'Gradle scalafmt plugin'
}
}
}

artifacts {
archives sourcesJar

java {
withJavadocJar()
withSourcesJar()
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
configurations = ['archives']
publish = true
pkg {
repo = 'maven'
name = 'gradle-scalafmt'
desc = 'Gradle plugin that can run scalafmt as a part of your build.'
licenses = ['MIT']
vcsUrl = 'https://github.com/alenkacz/gradle-scalafmt.git'
websiteUrl = 'https://github.com/alenkacz/gradle-scalafmt'
issueTrackerUrl = 'https://github.com/alenkacz/gradle-scalafmt/issues'
labels = ['scala', 'scalafmt', 'formatting']
version {
name = project.version
vcsTag = project.version
afterEvaluate {
publishing.publications.forEach {
it.pom {
name = 'Gradle scalafmt Plugin'
description = 'Gradle plugin to apply scalafmt (Scala linting tool)'
url = 'https://github.com/augi/gradle-scalafmt'
licenses {
license {
name = 'The MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
}
}
developers {
developer {
id = 'augi'
name = 'Michal Augustýn'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/augi/gradle-scalafmt.git'
developerConnection = 'scm:git:ssh://github.com/augi/gradle-scalafmt.git'
url = 'https://github.com/augi/gradle-scalafmt'
}
}
}
}

project.ext.set('gradle.publish.key', System.getenv('GRADLE_PORTAL_KEY'))
project.ext.set('gradle.publish.secret', System.getenv('GRADLE_PORTAL_SECRET'))
pluginBundle {
website = 'https://github.com/alenkacz/gradle-scalafmt'
vcsUrl = 'https://github.com/alenkacz/gradle-scalafmt'
description = 'Gradle plugin that can run scalafmt as a part of your build.'
tags = ['scalafmt', 'scala', "formatting"]
signing {
String base64Key = System.getenv('SIGNING_KEY')
if (base64Key) {
useInMemoryPgpKeys(new String(Base64.decoder.decode(base64Key)), System.getenv('SIGNING_PASSWORD'))
sign publishing.publications
}
}

plugins {
scalafmtPlugin {
id = 'cz.alenkacz.gradle.scalafmt'
displayName = 'Gradle Scalafmt plugin'
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
5 changes: 5 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

import org.gradle.api.Project
import org.gradle.api.logging.Logger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

class PluginExtension {
String configFilePath = ".scalafmt.conf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.TaskAction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

import org.gradle.api.DefaultTask
import org.gradle.api.plugins.JavaBasePlugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

import org.gradle.api.GradleException

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

import org.gradle.api.Plugin
import org.gradle.api.Project
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.TaskAction
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
implementation-class=cz.alenkacz.gradle.scalafmt.ScalafmtPlugin
implementation-class=cz.augi.gradle.scalafmt.ScalafmtPlugin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
implementation-class=cz.alenkacz.gradle.scalafmt.ScalafmtPlugin
implementation-class=cz.augi.gradle.scalafmt.ScalafmtPlugin
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

import java.nio.file.Files
import java.nio.file.Paths
Expand Down Expand Up @@ -58,7 +58,7 @@ class ProjectMother {
configFile(absoluteFile.toString())
def srcFile = Files.createFile(Paths.get(srcFolder.absolutePath, "Test.scala"))
srcFile.write """import java.nio.file.{Paths, Files}
|object Test { foo(a, "src/test/scala/cz/alenkacz/gradle/scalafmt/test", "src/test/scala/cz/alenkacz/gradle/scalafmt/test", "src/test/scala/cz/alenkacz/gradle/scalafmt/test"
|object Test { foo(a, "src/test/scala/cz/augi/gradle/scalafmt/test", "src/test/scala/cz/augi/gradle/scalafmt/test", "src/test/scala/cz/augi/gradle/scalafmt/test"
| b)}
""".stripMargin()
testProject = new TestProject(absoluteFile, srcFile.toFile())
Expand All @@ -84,8 +84,8 @@ class ProjectMother {
|object Test { foo(a, // comment
| b)}
""".stripMargin()
private static def sourceFilePath = "src/main/scala/cz/alenkacz/gradle/scalafmt/test"
private static def testSourceFilePath = "src/test/scala/cz/alenkacz/gradle/scalafmt/test"
private static def sourceFilePath = "src/main/scala/cz/augi/gradle/scalafmt/test"
private static def testSourceFilePath = "src/test/scala/cz/augi/gradle/scalafmt/test"

static def projectWithConfig() {
TestProject testProject = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt


import org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration
import org.gradle.testfixtures.ProjectBuilder
import spock.lang.Specification

Expand Down Expand Up @@ -86,7 +86,7 @@ class ScalafmtCheckTaskTest extends Specification {
mavenCentral()
}
project.dependencies {
compile 'org.scala-lang:scala-library:2.12.10'
implementation 'org.scala-lang:scala-library:2.12.10'
}

when:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

import org.gradle.api.Project
import org.gradle.api.Task
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

import org.gradle.api.Task
import org.gradle.testfixtures.ProjectBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.alenkacz.gradle.scalafmt
package cz.augi.gradle.scalafmt

class TestProject {
private File projectRoot
Expand Down

0 comments on commit 64c0f3e

Please sign in to comment.