echocat / gradle-golang-plugin

Gradle plugin to build, test and do other stuff of Golang projects.
https://github.com/echocat/gradle-golang-plugin
Mozilla Public License 2.0
44 stars 8 forks source link

Exclude packages from testing #22

Open tglaeser opened 7 years ago

tglaeser commented 7 years ago

I'm trying to build project github.com/tendermint/tendermint.

My environment is Cygwin under Windows. That's not my preferred environment, but I need to stick to it right now.

Following my build.gradle file from directory github.com/tendermint/tendermint.

plugins {
id "org.echocat.golang" version "0.1.15"
}
group 'github.com/tendermint/tendermint'
golang {
    toolchain {
        goroot = '/cygdrive/c/opt/go'
    }
    build {
    useTemporaryGopath = false
   }
   testing {
//      packages = ['github.com/tendermint/tendermint/types']
//      includes = ['./types']
//      excludes = ['./']
   }
}

First, without setting golang.toolchain.goroot, the build fails with error ...

$ gradle --no-daemon build
:baseValidate
:validate
:prepareToolchain
Go toolchain for windows-amd64 build.
:prepareToolchain FAILED
Execution failed for task ':prepareToolchain'.
go SDK in C:\Users\foo\\.go\sdk\go1.8 has expected of version go1.8 but it is null.

Second, whenever I try to filter the packages for testing, ether using golang.testing.packages or golang.testing.includes, the build always fails with error ...

$ gradle --no-daemon build
:baseValidate
:validate
:prepareToolchain
:baseGetTools
:getTools
:basePrepareSources
:prepareSources
:baseTest
github.com/tendermint/tendermint/types tested.
:test
:baseBuild
can't load package: package github.com/tendermint/tendermint: no buildable Go source files in C:\home\projects\go\src\github.com\tendermint\tendermint
:baseBuild FAILED

The error is in a way correct, there are no Go sources directly under package github.com/tendermint/tendermint, but that's why I'm trying to set the filter in the first place.

Please advice. Thanks.

blaubaer commented 7 years ago

Hi @tglaeser!

Thanks for your report. I will try to reproduce your reported behavior (with cygwin) within the next days. Please stand by. πŸ˜„

Cheers

tglaeser commented 7 years ago

I do have an architectural question in this context ...

Why introducing new properties project.golang.build.includes and project.golang.testing.includes? According to the Gradle DSL, shouldn't we be able to filter on a Golang SourceSet instead via project.sourceSets.main.golang.includes and project.sourceSets.test.golang.includes?

tglaeser commented 7 years ago

Do you have an update for me? Is the plugin still actively maintained/developed?

blaubaer commented 7 years ago

Hey @tglaeser: Currently I does not explicitly work on this issue but I still maintain/develop this project. I still focused on older issues at first. πŸ˜„

maksim77 commented 7 years ago

+1 to this issue. In one of our projects there is no code in the root folder. And building fails with the error:

can't load package: package our.git/folder1/folder2: no buildable Go source files in