Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sw-samuraj committed Apr 7, 2018
2 parents 462b805 + 7398707 commit a1d168e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
13 changes: 12 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
language: groovy
script: ./gradlew clean build --daemon
script:
- ./gradlew clean build --daemon
- cd example
- ../gradlew clean build --daemon
matrix:
include:
- os: linux
Expand All @@ -8,6 +11,14 @@ matrix:
jdk: oraclejdk9
- os: osx
osx_image: xcode9.3beta
env:
- GOPATH=$HOME/go
- PATH=$PATH:$GOPATH/bin
before_install:
- mkdir -p $HOME/go/bin
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
before_install:
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -rf $HOME/.gradle/caches/*/plugin-resolution/
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
compile localGroovy()
}

version = '0.2.1'
version = '0.3.0'
group = 'cz.swsamuraj'

jar {
Expand Down
16 changes: 15 additions & 1 deletion example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
plugins {
id 'cz.swsamuraj.godep' version '0.2.1'
id 'cz.swsamuraj.godep' version '0.3.0'
}
/*
buildscript {
repositories {
flatDir {
dirs '../build/libs'
}
}
dependencies {
classpath 'gradle.plugin.cz.swsamuraj:gradle-godep-plugin:0.3.0-SNAPSHOT'
}
}
apply plugin: 'cz.swsamuraj.godep'
*/

godep {
importPath = 'github.com/sw-samuraj/hello'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ import org.gradle.api.provider.Property
class GoDepExtension {

final Property<String> importPath
final Property<Boolean> depOptional

GoDepExtension(Project project) {
importPath = project.objects.property(String)
importPath.set('github.com/user/package')

depOptional = project.objects.property(Boolean)
depOptional.set(false)
}
}
15 changes: 15 additions & 0 deletions src/main/groovy/cz/swsamuraj/gradle/godep/GoDepPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ package cz.swsamuraj.gradle.godep
import groovy.transform.CompileStatic
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.ProjectEvaluationListener
import org.gradle.api.ProjectState

@CompileStatic
class GoDepPlugin implements Plugin<Project> {
Expand All @@ -53,5 +55,18 @@ class GoDepPlugin implements Plugin<Project> {
project.tasks.create('build', GoBuildTask) {
it.importPath = extension.importPath
}

project.gradle.addProjectEvaluationListener(new ProjectEvaluationListener() {
@Override
void beforeEvaluate(Project proj) {
}

@Override
void afterEvaluate(Project proj, ProjectState projectState) {
if (extension.depOptional.get()) {
proj.tasks.getByName('dep').enabled = false
}
}
})
}
}

0 comments on commit a1d168e

Please sign in to comment.