Skip to content

Commit

Permalink
fix publishing and prepare next version
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredsburrows committed Apr 10, 2022
1 parent b9f5afa commit c603626
Show file tree
Hide file tree
Showing 18 changed files with 353 additions and 445 deletions.
54 changes: 29 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: build

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
types: [ opened, labeled, unlabeled, synchronize ]

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"
Expand All @@ -15,47 +20,47 @@ jobs:
api-level:
- 23
java-version:
- 1.8
- 11

steps:
- name: Checkout Project
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1.0.4

- name: Cache Gradle dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper/
~/.android/build-cache
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Checkout Project
uses: actions/checkout@v2

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Configure JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3.1.0
with:
distribution: temurin
java-version: ${{ matrix.java-version }}

- name: Build the Plugin
run: ./gradlew clean ktlintCheck build jar docsJar sourcesJar testsJar reportsZip generatePomFileForMavenPublication -s --scan
run: ./gradlew clean ktlintCheck build -s

- name: Run Unit Tests
run: rm -rf ~/.m2/repository/com/jaredsburrows/gradle-spoon-plugin/ && ./gradlew publishMavenPublicationToMavenLocal -x test -s --scan
run: rm -rf ~/.m2/repository/com/jaredsburrows/gradle-spoon-plugin/ && ./gradlew publishToMavenLocal -x test -s

- name: Run Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
script: cd test-app && ../gradlew clean spoonDebugAndroidTest checkReports -s --scan && cd ..
script: cd test-app && ../gradlew clean spoonDebugAndroidTest checkReports -s && cd ..
env:
API_LEVEL: ${{ matrix.api-level }}

- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3.0.0
if: always()
with:
name: gradle-spoon-plugin-${{ github.workflow }}-${{ github.run_id }}
Expand All @@ -76,20 +81,19 @@ jobs:

steps:
- name: Checkout Project
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v1.0.4

- name: Configure JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v3.0.0
with:
java-version: 1.8
distribution: 'adopt'
java-version: 11

- name: Publish
run: ./gradlew clean artifactoryPublish -s --scan
run: ./gradlew clean publish -s
env:
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
BINTRAY_USERNAME: ${{ secrets.BINTRAY_USERNAME }}
GRADLE_KEY: ${{ secrets.GRADLE_KEY }}
GRADLE_SECRET: ${{ secrets.GRADLE_SECRET }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Gradle Spoon Plugin

[![License](https://img.shields.io/badge/license-apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
[![Build](https://github.com/jaredsburrows/gradle-spoon-plugin/workflows/build/badge.svg)](https://github.com/jaredsburrows/gradle-spoon-plugin/actions)
[![Build](https://github.com/jaredsburrows/gradle-spoon-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/jaredsburrows/gradle-spoon-plugin/actions/workflows/build.yml)
[![Twitter Follow](https://img.shields.io/twitter/follow/jaredsburrows.svg?style=social)](https://twitter.com/jaredsburrows)

Gradle plugin for [Spoon](https://github.com/square/spoon) 2+ and [Android Gradle Plugin](https://developer.android.com/studio/releases/gradle-plugin.html) 3+.
Expand All @@ -12,12 +12,12 @@ Gradle plugin for [Spoon](https://github.com/square/spoon) 2+ and [Android Gradl
```groovy
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } // For Spoon snapshot, until 2.0.0 is released
}
dependencies {
classpath 'com.jaredsburrows:gradle-spoon-plugin:1.5.1'
classpath 'com.jaredsburrows:gradle-spoon-plugin:1.5.0'
}
}
Expand All @@ -32,7 +32,7 @@ dependencies {
androidTestCompile 'com.squareup.spoon:spoon-client:2.0.0-SNAPSHOT' // For Spoon snapshot, until 2.0.0 is released
}
```
Release versions are available in the [JFrog Bintray repository](https://jcenter.bintray.com/com/jaredsburrows/gradle-spoon-plugin/).
Release versions are available in the [Sonatype's release repository](https://repo1.maven.org/maven2/com/jaredsburrows/gradle-spoon-plugin/).

**Snapshot:**
```groovy
Expand All @@ -43,7 +43,7 @@ buildscript {
}
dependencies {
classpath 'com.jaredsburrows:gradle-spoon-plugin:1.5.2-SNAPSHOT'
classpath 'com.jaredsburrows:gradle-spoon-plugin:1.6.0-SNAPSHOT'
}
}
Expand All @@ -58,13 +58,13 @@ dependencies {
androidTestCompile 'com.squareup.spoon:spoon-client:2.0.0-SNAPSHOT' // For Spoon snapshot, until 2.0.0 is released
}
```
Snapshot versions are available in the [JFrog Artifactory repository](https://oss.jfrog.org/artifactory/libs-snapshot/com/jaredsburrows/gradle-spoon-plugin/).
Snapshot versions are available in the [Sonatype's snapshots repository](https://oss.sonatype.org/content/repositories/snapshots/com/jaredsburrows/gradle-spoon-plugin/).

**Library modules:**

This plugin allows Spoon to be run on library modules too!

```
```groovy
apply plugin: 'com.android.library'
apply plugin: 'com.jaredsburrows.spoon'
Expand Down Expand Up @@ -153,17 +153,18 @@ spoon {
```

## License
```
Copyright (C) 2017 Jared Burrows
Copyright (C) 2017 Jared Burrows

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
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
http://www.apache.org/licenses/LICENSE-2.0
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.
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.
```
105 changes: 79 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter

plugins {
id 'com.jfrog.artifactory' version '4.18.3'
id 'com.jfrog.bintray' version '1.8.5'
id 'com.github.ben-manes.versions' version '0.36.0'
id 'com.gradle.plugin-publish' version '0.12.0'
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
id 'org.jetbrains.dokka' version '0.10.0'
id 'org.jlleitschuh.gradle.ktlint' version '9.4.1'
id 'org.jetbrains.kotlin.jvm' version '1.6.20'
id 'org.jetbrains.dokka' version '1.6.10'
id 'org.jlleitschuh.gradle.ktlint' version '10.2.1'
id 'com.vanniktech.maven.publish' version '0.18.0'
id 'com.gradle.plugin-publish' version '0.21.0'
id 'com.github.ben-manes.versions' version '0.42.0'
id 'java-gradle-plugin'
id 'java-library'
id 'groovy'
id 'maven-publish'
}

repositories {
gradlePluginPortal()
google()
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } // For Spoon snapshot, until 2.0.0 is released
}

apply from: 'gradle/dependencies.gradle'
apply from: 'gradle/compile.gradle'
apply from: 'gradle/publish.gradle'

group = GROUP
version = VERSION_NAME
description = POM_DESCRIPTION

sourceCompatibility = versions.java
targetCompatibility = versions.java

jar {
manifest {
attributes(
'Implementation-Title': POM_NAME,
'Implementation-Version': archiveVersion,
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion)
}
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
Expand All @@ -58,12 +47,76 @@ dependencies {
implementation deps.android.tools.build.gradle
implementation deps.android.tools.ddmlib

testImplementation deps.junit
testImplementation localGroovy()
testImplementation deps.spock, { exclude module: 'groovy-all' } // Use localGroovy()
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
gradlePlugin {
plugins {
spoonPlugin {
id = PLUGIN_NAME
implementationClass = PLUGIN_NAME_CLASS
}
}
}

tasks.withType(Jar).configureEach {
def dateFile = new File(buildDir, 'jar-manifest-date.txt')
if (!dateFile.exists()) {
def date = DateTimeFormatter.ofPattern('EEE MMM dd HH:mm:ss zzz yyyy').
format(ZonedDateTime.now())
dateFile.parentFile.mkdirs()
dateFile.text = date.trim()
}

manifest {
attributes(
'Created-By': POM_DEVELOPER_NAME,
'Implementation-Title': POM_NAME,
'Implementation-Version': VERSION_NAME,
'Implementation-Vendor': POM_DEVELOPER_NAME,
'Built-By': System.getProperty('user.name'),
'Built-Date': dateFile.text.trim(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion)
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = rootProject.versions.java
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

tasks.withType(JavaCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

configure(options) {
compilerArgs << '-Xlint:all'
compilerArgs << '-Xlint:-options'
encoding = 'utf-8'
}
}

tasks.withType(GroovyCompile).configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

configure(options) {
compilerArgs << '-Xlint:all'
compilerArgs << '-Xlint:-options'
encoding = 'utf-8'
}
}

tasks.withType(Test).configureEach {
testLogging {
exceptionFormat 'full'
showCauses true
showExceptions true
showStackTraces true
events 'failed', 'skipped'
}
}
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
GROUP=com.jaredsburrows
VERSION_NAME=1.5.2-SNAPSHOT
POM_ARTIFACT_ID=gradle-spoon-plugin
VERSION_NAME=1.6.0-SNAPSHOT

POM_NAME=Gradle Spoon Plugin
POM_ARTIFACT_ID=gradle-spoon-plugin
POM_DESCRIPTION=Gradle plugin that provides a task to run Android instrumentation tests via Spoon.
POM_INCEPTION_YEAR=2017
POM_PACKAGING=jar
POM_URL=https://github.com/jaredsburrows/gradle-spoon-plugin

Expand All @@ -14,14 +15,13 @@ POM_SCM_URL=https://github.com/jaredsburrows/gradle-spoon-plugin
POM_SCM_CONNECTION=scm:git:git://github.com/jaredsburrows/gradle-spoon-plugin.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/jaredsburrows/gradle-spoon-plugin.git

POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_LICENSE_NAME=The Apache Software License, Version 2.0
POM_LICENSE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENSE_DIST=repo

POM_DEVELOPER_ID=jaredsburrows
POM_DEVELOPER_NAME=Jared Burrows
POM_DEVELOPER_EMAIL=jaredsburrows@gmail.com

BINTRAY_GITHUB_REPO=jaredsburrows/gradle-spoon-plugin
PLUGIN_NAME=com.jaredsburrows.spoon
PLUGIN_NAME_CLASS=com.jaredsburrows.spoon.SpoonPlugin
34 changes: 0 additions & 34 deletions gradle/compile.gradle

This file was deleted.

Loading

0 comments on commit c603626

Please # to comment.