Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #22 from heroku/malax/2.0
Browse files Browse the repository at this point in the history
2.0
  • Loading branch information
Malax authored Jul 24, 2020
2 parents 1c6fcc4 + 8b19e5e commit ce7457c
Show file tree
Hide file tree
Showing 17 changed files with 339 additions and 293 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
build/
.idea/
*.iml
examples/
examples/

# This file is automatically generated by Gradle
src/main/resources/heroku-gradle.properties
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Heroku Gradle Plugin [![Build Status](https://travis-ci.org/heroku/heroku-gradle.svg?branch=master)](https://travis-ci.org/heroku/heroku-gradle) [ ![Download](https://api.bintray.com/packages/heroku/maven/gradle/images/download.svg) ](https://bintray.com/heroku/maven/gradle/_latestVersion)
# Heroku Gradle Plugin [![Build Status](https://travis-ci.com/heroku/heroku-gradle.svg?branch=master)](https://travis-ci.com/heroku/heroku-gradle)

This plugin is used to deploy Gradle based JVM applications directly to Heroku without pushing to a Git repository. This can be useful when deploying from a CI server.

Expand All @@ -8,11 +8,11 @@ Add the plugin to your `build.gradle`:

```
plugins {
id "com.heroku.sdk.heroku-gradle" version "1.0.4"
id "com.heroku.sdk.heroku-gradle" version "2.0.0"
}
```

Create a Heroku app using the [Heroku CLI](https://toolbelt.heroku.com):
Create a Heroku app using the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli):

```
$ heroku create
Expand Down Expand Up @@ -67,7 +67,7 @@ You can explicitly define the required jdk version (in system.properties)

```
heroku {
jdkVersion = 12
jdkVersion = 11
}
```

Expand Down
105 changes: 32 additions & 73 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,93 +1,52 @@
plugins {
id 'com.gradle.plugin-publish' version '0.10.0'
id 'com.jfrog.bintray' version '1.8.4'

id 'eclipse'
id 'groovy'
id 'idea'
id 'maven-publish'
id 'groovy'
id 'java-gradle-plugin'
id "com.gradle.plugin-publish" version "0.12.0"
}

task createClasspathManifest {
def outputDir = file("$buildDir/$name")

inputs.files sourceSets.main.runtimeClasspath
outputs.dir outputDir
version '2.0.0-SNAPSHOT'

doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").text = sourceSets.main.runtimeClasspath.join("\n")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

repositories {
jcenter()
mavenCentral()
jcenter()
mavenCentral()
}

dependencies {
compile 'com.heroku.sdk:heroku-deploy:2.0.6'
compile 'com.google.guava:guava:18.0'
compile gradleApi()

testCompile gradleTestKit()
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude module: 'groovy-all'
}
testCompile files(createClasspathManifest)
implementation 'com.heroku.sdk:heroku-deploy:3.0.3'
testImplementation 'org.spockframework:spock-core:1.3-groovy-2.5'
}

group = 'com.heroku.sdk'
version = "1.0.5-SNAPSHOT"

task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier 'sources'
}

publishing {
publications {
bintray(MavenPublication) {
from components.java
artifact(sourceJar)
artifact(publishPluginJavaDocsJar)
gradlePlugin {
plugins {
herokuGradle {
id = 'com.heroku.sdk.heroku-gradle'
implementationClass = 'com.heroku.sdk.HerokuGradlePlugin'
}
}
}
}

bintray {
user = System.env.BINTRAY_USER
key = System.env.BINTRAY_KEY
publish = true
pkg {
repo = 'maven'
name = 'gradle'
userOrg = 'heroku'
licenses = ['MIT']
publications = ['bintray']
}
}

bintrayUpload.dependsOn 'generatePomFileForBintrayPublication', 'sourceJar', 'build'

bintrayUpload.onlyIf {
System.env.BINTRAY_USER && System.env.BINTRAY_KEY && project.version ==~ /\d+\.\d+\.\d+/
}

pluginBundle {
website = 'https://github.com/heroku/heroku-gradle'
vcsUrl = 'https://github.com/heroku/heroku-gradle'
description = 'A Gradle plugin for deploying to Heroku.'
tags = ['heroku', 'deployment']

plugins {
herokuPlugin {
id = 'com.heroku.sdk.heroku-gradle'
displayName = 'Heroku Gradle'
website = 'https://github.com/heroku/heroku-gradle'
vcsUrl = 'https://github.com/heroku/heroku-gradle.git'
description = 'A Gradle plugin for deploying to Heroku.'
tags = ['heroku', 'deployment']

plugins {
herokuGradle {
displayName = 'Heroku Gradle'
}
}
}
}

publishPlugins.onlyIf {
project.version ==~ /\d+\.\d+\.\d+/
// To determine the plugin version at runtime, we package a properties file with the current version string:
task writeVersionPropertiesFile(type: WriteProperties) {
outputFile = file('src/main/resources/heroku-gradle.properties')
property 'version', project.version
}

assemble.dependsOn writeVersionPropertiesFile
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Jul 20 17:02:45 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
53 changes: 33 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# 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.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -66,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
22 changes: 21 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down Expand Up @@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
27 changes: 0 additions & 27 deletions release.sh

This file was deleted.

46 changes: 0 additions & 46 deletions src/main/groovy/com/heroku/sdk/gradle/DeployHerokuTask.groovy

This file was deleted.

Loading

0 comments on commit ce7457c

Please sign in to comment.