Skip to content

Commit

Permalink
Upgrade plugin project setup (#10)
Browse files Browse the repository at this point in the history
Description
===========

To have a streamlined and cleaner project setup, we moved the
biolerplate gradle setup into a single plugin `net.wooga.plugins` This
base plugin needs gradle 4.

Changes
=======

![UPDATE] gradle version to 4.0
![IMPROVE] project setup
  • Loading branch information
Larusso authored Nov 23, 2017
1 parent 902898b commit 95a6967
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 87 deletions.
86 changes: 1 addition & 85 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,12 @@
*/

plugins {
id 'groovy'
id 'idea'
id 'maven-publish'
id 'com.gradle.plugin-publish' version '0.9.7'
id 'nebula.release' version '5.0.0'
id 'jacoco'
id "com.github.kt3k.coveralls" version "2.8.1"
id 'net.wooga.plugins' version '0.1.1'
}

group 'net.wooga.gradle'
description = 'Unity3D plugin for Gradle.'

sourceSets {
integrationTest {
groovy {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integrationTest/groovy')
}
resources.srcDir 'src/integrationTest/resources'
}
}

configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}

idea.module {
testSourceDirs += file('src/integrationTest/groovy')
scopes.TEST.plus += [configurations.integrationTestCompile]
}

pluginBundle {
website = 'https://github.com/wooga/atlas-unity'
vcsUrl = 'https://github.com/wooga/atlas-unity'
Expand All @@ -63,68 +36,11 @@ pluginBundle {
}
}

repositories {
jcenter()
mavenCentral()
}

dependencies {
testCompile('org.spockframework:spock-core:1.0-groovy-2.4') {
exclude module: 'groovy-all'
}

testCompile 'com.netflix.nebula:nebula-test:latest.release'
testCompile('org.jfrog.artifactory.client:artifactory-java-client-services:+') {
exclude module: 'logback-classic'
}

compile 'org.apache.maven:maven-artifact:3.0.3'
compile "org.yaml:snakeyaml:1.17"
compile gradleApi()
compile localGroovy()
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}

task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
}

check.dependsOn integrationTest
integrationTest.mustRunAfter test

tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}

jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}

executionData(test)
executionData(integrationTest)
}

tasks.coveralls {
onlyIf {System.getenv("CI") && JavaVersion.current().isJava8Compatible()}
}

project.tasks.releaseCheck.dependsOn project.tasks.check
project.tasks.release.dependsOn project.tasks.assemble

project.tasks.final.dependsOn project.tasks.publishPlugins
project.tasks.publishPlugins.mustRunAfter project.tasks.postRelease

project.tasks.snapshot.dependsOn project.tasks.publishToMavenLocal

project.tasks.publishToMavenLocal.mustRunAfter project.tasks.postRelease
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ class TestIntegrationSpec extends UnityIntegrationSpec {
def "can set reports location via reports extension in task"() {
given: "destination path"
def destination = "out/reports/test.xml"

and: "a build script with fake test unity location"
buildFile << """
task (mUnity, type: wooga.gradle.unity.tasks.Test) {
reports.xml.destination = "$destination"
reports.xml.destination = file("$destination")
}
""".stripIndent()

Expand Down
11 changes: 11 additions & 0 deletions src/main/groovy/wooga/gradle/unity/tasks/AbstractUnityTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ abstract class AbstractUnityTask<T extends AbstractUnityTask> extends Convention
this.taskType = taskType
}

@Override
void setExecutable(String executable) {
batchModeAction.executable(executable)

}

@Override
void setWorkingDir(File dir) {
batchModeAction.setWorkingDir(dir)
}

@TaskAction
protected void exec() {
batchModeResult = batchModeAction.execute()
Expand Down

0 comments on commit 95a6967

Please sign in to comment.