Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
Merge pull request #70 from ysb33r/development
Browse files Browse the repository at this point in the history
Release 1.0-beta11
  • Loading branch information
ysb33r authored May 26, 2017
2 parents 1878fee + 8f2e068 commit 45f3bb8
Show file tree
Hide file tree
Showing 24 changed files with 107 additions and 37 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build_script:

test_script:
- gradlew.bat test integrationTest --info --no-daemon
- gradlew.bat test compatibilityTest --info --no-daemon -DgradleTest.versions=2.0,2.1,2.2,2.3 -DnonLegacyOnlyGradleTest.versions=2.13
- gradlew.bat test compatibilityTest --info --no-daemon -DgradleTest.versions=2.0,2.1,2.2,2.3
- gradlew.bat test compatibilityTest --info --no-daemon -DgradleTest.versions=2.4,2.5,2.6,2.7 -DnonLegacyOnlyGradleTest.versions=2.14.1
- gradlew.bat test compatibilityTest --info --no-daemon -DgradleTest.versions=2.8,2.9,2.10,2.11 -DnonLegacyOnlyGradleTest.versions=3.0
- gradlew.bat test compatibilityTest --info --no-daemon -DgradleTest.versions=2.12,2.13,2.14.1 -DnonLegacyOnlyGradleTest.versions=3.1
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'groovy'
id 'maven'
id 'org.ysb33r.bintray' version '1.5'
id 'com.gradle.plugin-publish' version '0.9.4'
id 'com.gradle.plugin-publish' version '0.9.7'
id 'com.github.hierynomus.license' version '0.13.1'
id 'org.asciidoctor.convert' version '1.5.3'
id 'org.ysb33r.cloudci' version '1.0'
Expand All @@ -14,7 +14,7 @@ import org.asciidoctor.gradle.AsciidoctorTask

group = 'org.ysb33r.gradle'
archivesBaseName = 'gradletest'
version = '1.0-beta10'
version = '1.0-beta11'

apply from : 'gradle/integration-tests.gradle'
apply from : 'gradle/compatibility-tests.gradle'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// correct during compatibility testing.
buildscript {
dependencies {
classpath gradleTestKit()
// classpath gradleTestKit()
}
}

Expand Down
3 changes: 1 addition & 2 deletions gradle/compatibility-tests.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ task compatibilityTest( type : GradleBuild ) {
dependsOn 'integrationTestRepo', 'jar'
mustRunAfter 'test', 'integrationTest'

// tasks = ['gradleTest','nonLegacyOnlyGradleTest']
tasks = ['nonLegacyOnlyGradleTest']
tasks = ['gradleTest','nonLegacyOnlyGradleTest']
dir = file("${projectDir}/compatibility")
buildFile = 'compatibility/compatibility.gradle'
startParameter.projectProperties.compatibilityVersion = version
Expand Down
2 changes: 1 addition & 1 deletion src/docs/landingPage/display-versions.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# List versions in order that they should appear on the landing page
#
1.0-beta10
1.0-beta11
0.5.5
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand All @@ -11,7 +11,6 @@
*
* ============================================================================
*/

task runGradleTest << {
throw new GradleException('We expect this test to fail')
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2016
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,37 @@
*/
package org.ysb33r.gradle.gradlerunner

import groovy.transform.Undefined
import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.util.GradleVersion
import org.ysb33r.gradle.gradlerunner.internal.GradleRunnerFactory

/** Adds a default task called {@code gradleRunner}
*
* @since 1.0
*/
class GradleRunnerPlugin implements Plugin<Project> {
static final String DEFAULT_TASK = 'gradleRunner'
static final String CLASSPATH_CONFIGURATION = '$$gradleRunner$$classpath$$'
static final String CLASSPATH_EXTENSION = '$$gradleRunner$$extension$$'

@Override
void apply(Project project) {

if (GradleVersion.current() < GradleVersion.version('2.14.1')) {
throw new GradleException('This plugin requires a minimum version of 2.14.1')
}


project.configurations.create(CLASSPATH_CONFIGURATION).with {
visible = false
}

project.dependencies.add(CLASSPATH_CONFIGURATION,project.dependencies.gradleTestKit())

project.extensions.create(CLASSPATH_EXTENSION,GradleRunnerFactory,project)

project.tasks.create DEFAULT_TASK, GradleRunnerSteps
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.gradle.api.tasks.TaskAction
import org.gradle.internal.FileUtils
import org.ysb33r.gradle.gradlerunner.internal.ActionStep
import org.ysb33r.gradle.gradlerunner.internal.ClosureStep
import org.ysb33r.gradle.gradlerunner.internal.GradleRunnerFactory
import org.ysb33r.gradle.gradlerunner.internal.GradleStep

/** Executes a set of staps including running Gradle with tasks and capturing the output
Expand Down Expand Up @@ -94,7 +95,9 @@ class GradleRunnerSteps extends DefaultTask {
* @param gradleArgs Arguments to pass to Gradle
*/
void step(final String name, Iterable<String> gradleArgs) {
this.steps.add new GradleStep(name,gradleArgs,false)
this.steps.add new GradleStep(
(GradleRunnerFactory)(project.extensions.getByName(GradleRunnerPlugin.CLASSPATH_EXTENSION)),
name,gradleArgs,false)
}

/** Execute a Gradle step in the directory specified by {@link #getWorkingDir()}.
Expand All @@ -116,7 +119,9 @@ class GradleRunnerSteps extends DefaultTask {
* @param gradleArgs Arguments to pass to Gradle
*/
void failingStep(final String name, Iterable<String> gradleArgs) {
this.steps.add new GradleStep(name,gradleArgs,true)
this.steps.add new GradleStep(
(GradleRunnerFactory)(project.extensions.getByName(GradleRunnerPlugin.CLASSPATH_EXTENSION)),
name,gradleArgs,true)
}

/** Execute a failing Gradle step in the directory specified by {@link #getWorkingDir()}.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* ============================================================================
* (C) Copyright Schalk W. Cronje 2015 - 2017
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
*
* 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.
*
* ============================================================================
*/
package org.ysb33r.gradle.gradlerunner.internal

import groovy.transform.CompileStatic
import org.gradle.api.Project
import org.ysb33r.gradle.gradlerunner.GradleRunnerPlugin

import java.lang.reflect.Method

/** Provides a private project extension for loading GradleRunner instances.
*
* @since 1.0
*/
@CompileStatic
class GradleRunnerFactory {

GradleRunnerFactory(Project project) {
URL[] urls = project.configurations.getByName(GradleRunnerPlugin.CLASSPATH_CONFIGURATION).files.collect { File f ->
f.absoluteFile.toURI().toURL()
} as URL[]
URLClassLoader loader = URLClassLoader.newInstance(urls,this.getClass().classLoader)
this.gradleRunner = loader.loadClass('org.gradle.testkit.runner.GradleRunner')
}

def createRunner() {
Method createMethod = gradleRunner.getDeclaredMethod('create')
createMethod.invoke(gradleRunner)
}

private Class gradleRunner
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,38 @@
*/
package org.ysb33r.gradle.gradlerunner.internal

import groovy.transform.CompileDynamic
import groovy.transform.CompileStatic
import org.gradle.api.Project
import org.gradle.api.invocation.Gradle
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.ysb33r.gradle.gradlerunner.GradleRunnerPlugin
import org.ysb33r.gradle.gradlerunner.Step
import org.ysb33r.gradle.gradlerunner.StepInfo

import java.lang.reflect.Method

/** Runs a Gradle execution.
*
* @since 1.0
*/
@CompileStatic
class GradleStep extends AbstractStep {

GradleStep(final String name, final List<String> args,boolean expectFailure) {
super(name)
this.args = args
this.expectFailure = expectFailure
}
// GradleStep(final Project project,final String name, final List<String> args,boolean expectFailure) {
// super(name)
// this.project = project
// this.args = args
// this.expectFailure = expectFailure
// }

GradleStep(final String name,final Iterable<String> args,boolean expectFailure) {
GradleStep(final GradleRunnerFactory factory,final String name,final Iterable<String> args,boolean expectFailure) {
super(name)
this.args = []
this.args.addAll(args)
this.expectFailure = expectFailure
this.factory = factory
}

@Override
Expand All @@ -63,9 +71,12 @@ class GradleStep extends AbstractStep {
this.errorFile
}

private BuildResult run(final File projDir, final File outFile,final File errFile) {
BuildResult result
GradleRunner runner = GradleRunner.create().withArguments(this.args).withProjectDir(projDir)
@CompileDynamic
private def run(final File projDir, final File outFile,final File errFile) {

def result
def runner = factory.createRunner()
runner.withArguments(this.args).withProjectDir(projDir)
outFile.withPrintWriter { PrintWriter out ->
errFile.withPrintWriter { PrintWriter err ->
runner.forwardStdError(err).forwardStdOutput(out)
Expand All @@ -79,6 +90,6 @@ class GradleStep extends AbstractStep {
private File errorFile

private final List<String> args
private boolean expectFailure

private final boolean expectFailure
private final GradleRunnerFactory factory
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class GradleRunnerSpec extends Specification {

def 'Add basic steps and execute'() {
when:
GradleRunnerSteps gradleRunner = project.tasks.create('gradleRunner',GradleRunnerSteps)
project.apply plugin : 'org.ysb33r.gradlerunner'
GradleRunnerSteps gradleRunner = project.tasks.getByName('gradleRunner')

gradleRunner.step'closure', {
StepInfo info -> println project.name
Expand Down
2 changes: 1 addition & 1 deletion website
Submodule website updated 53 files
+1 −0 1.0-beta11/api/allclasses-frame.html
+1 −1 1.0-beta11/api/deprecated-list.html
+ 1.0-beta11/api/groovy.ico
+1 −1 1.0-beta11/api/help-doc.html
+8 −2 1.0-beta11/api/index-all.html
+0 −0 1.0-beta11/api/index.html
+ 1.0-beta11/api/inherit.gif
+30 −4 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/GradleRunnerPlugin.html
+6 −6 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/GradleRunnerSteps.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/Step.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/StepInfo.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/internal/AbstractStep.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/internal/ActionStep.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/internal/ClosureStep.html
+294 −0 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/internal/GradleRunnerFactory.html
+8 −22 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/internal/GradleStep.html
+1 −1 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/internal/package-frame.html
+8 −0 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/internal/package-summary.html
+0 −0 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/package-frame.html
+0 −0 1.0-beta11/api/org/ysb33r/gradle/gradlerunner/package-summary.html
+6 −6 1.0-beta11/api/org/ysb33r/gradle/gradletest/ClasspathManifest.html
+6 −6 1.0-beta11/api/org/ysb33r/gradle/gradletest/GradleTest.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/GradleTestBasePlugin.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/GradleTestPlugin.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/Names.html
+6 −6 1.0-beta11/api/org/ysb33r/gradle/gradletest/TestGenerator.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/TestSet.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/AvailableDistributions.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/CompatibilityTestResult.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/DeprecatingGradleTestExtension.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/Distribution.html
+6 −6 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/GradleTest.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/GradleTestExtension.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/LegacyGradleTestPlugin.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/internal/AvailableDistributionsInternal.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/internal/DistributionInternal.html
+6 −6 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/internal/GradleTestDownloader.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/internal/Infrastructure.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/internal/TestRunner.html
+4 −4 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/internal/Unpacker.html
+0 −0 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/internal/package-frame.html
+0 −0 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/internal/package-summary.html
+0 −0 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/package-frame.html
+0 −0 1.0-beta11/api/org/ysb33r/gradle/gradletest/legacy20/package-summary.html
+0 −0 1.0-beta11/api/org/ysb33r/gradle/gradletest/package-frame.html
+0 −0 1.0-beta11/api/org/ysb33r/gradle/gradletest/package-summary.html
+1 −1 1.0-beta11/api/overview-frame.html
+1 −1 1.0-beta11/api/overview-summary.html
+0 −0 1.0-beta11/api/package-list
+0 −0 1.0-beta11/api/stylesheet.css
+4 −4 1.0-beta11/docs/changelog.html
+8 −8 1.0-beta11/docs/product-documentation.html
+6 −6 index.html

0 comments on commit 45f3bb8

Please sign in to comment.