在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):echocat/gradle-golang-plugin开源软件地址(OpenSource Url):https://github.com/echocat/gradle-golang-plugin开源编程语言(OpenSource Language):Java 99.8%开源软件介绍(OpenSource Introduction):Gradle Golang PluginThis project is still under heavy development. The gradle-golang plugin is is designed to give you the power of a professional build tool (in this case Gradle) to build, test (and other great stuff) with your go code. And this without pain of think about the correct installation go sdk, set the right environment variables, download dependencies, ... TopicsFeatures
... and the best: Gradle already provides you a lot of other great plugins to help you managing your project like:
Find more plugins on Gradle plugin repository. Get it
Plugin dependency for your plugins {
// Use this variant if you use this as primary plugin
// In this case every task is simply named like: build, clean, test, ...
id 'org.echocat.golang' version '<latest version of this plugin>'
// Use this variant if you use this as secondary plugin
// for example if you also use Java in this build file.
// In this case every task is simply named like: golangBuild, golangClean, golangTest, ...
id 'org.echocat.golang-minor' version '<latest version of this plugin>'
} Requirements
See Quick start for information how to install requirements. Quick start
Settings// Package name of your project.
// Example: github.com/my_user/my_project
group = '' // String - REQUIRED (if golang.packageName is not set)
golang {
// Platform of the building host.
hostPlatform = '<automatically detected>' // Platform
// Comma separated list of platforms to build
// If you want multiplatform build just use for example:
// 'linux-386,linux-amd64,windows-386,windows-amd64,darwin-amd64'
platforms = '<by default same as hostPlatform>' // []Platform
// Overwrite the package name of 'group' - be useful for overriding settings for
// specific tasks.
packageName = '<same as group>' // String
// Location where to place the go toolchain and other assets temporarily
cacheRoot = '<home directory>/.go' // Path
dependencies {
// Here you can specify dependencies in Golang familiar way
// configuration:
// * build: Required for build and testing
// * test: Required only for test
// * tool: Tool required only while build process
// packageName: Name of package to import. Should be the same as used in source code for import.
// version: Can identify the branchname, commit revisions, ... of a package.
<configuration> '<packageName>[:<version>]'
// Example: build 'github.com/urfave/cli'
// ...
// Dependency required only for testing
test '<package name>[:<version>]'
// ...
// Tool dependency required only while build process
tool '<package name>[:<version>]'
// ...
// If true it will always download every dependency also if there are no updates available.
forceUpdate = false // Boolean
// If true it will delete unknown dependencies on clean task.
deleteUnknownDependencies = true // Boolean
// If true it will delete all dependencies on clean task.
deleteAllCachedDependenciesOnClean = false // Boolean
// Directory where to cache all dependencies in.
dependencyCache = 'vendor' // Path
// Method to register other VCS Repository provider that are not already supported by this plugin.
// vcsType: One of 'git', 'bzr', 'hg' or 'svn'
// prefix: Dependency prefix that identifies this provider.
// IMPORTANT: Add a slash as suffix.
// name: Name of this provider for display in logs etc.
// dependencyPattern: Regular expression (Java compatible) that should match the whole dependency and
// provides a submatch named <root> which matches the base of the dependency
// and another submatch named <subPath> that matches potential sub paths.
vcsRepositoryProvider('<vcsType>', '<prefix>', '<name>', '<dependencyPattern>')
// Example:
// vcsRepositoryProvider('git', 'github.com/', 'GitHub', '^(?<root>github\\.com/[A-Za-z0-9_.\\-]+/[A-Za-z0-9_.\\-]+)(?<subPath>/[A-Za-z0-9_.\\-]+)*\$')
}
build {
// GOPATH to use for build.
// Will be replaced with a temporary one if useTemporaryGopath is set to true.
gopath = '<GOPATH from environment>' // []Path
// If enabled a temporary GOPATH is created to build in.
useTemporaryGopath = true // Boolean
// Is used to identify sources to be processed
includes = [] // []String
// Is used to identify sources to be NOT processed
excludes = ['.git/**', '.svn/**', 'build.gradle', 'build/**', '.gradle/**', 'gradle/**'] // []String
// Optional arguments to pass to go build tool
arguments = [] // []String
// Name of the generated output filename.
// Placeholders:
// * %{platform} - Platform name like 'linux-amd64'
// * %{extension} - Platform specific executable extension like on Windows='.exe' or Linux=''
// * %{separator} - Separator in paths like on Linux='/' or Windows='\'
// * %{pathSeparator} - Separator to split paths like on Linux=':' or Windows=';'
outputFilenamePattern = 'build/out/<project name>-%{platform}%{extension}' // String
// Definitions to pass to ld
definitions = [] // [String]String
}
testing {
// If true no tests will be executed.
skip = false // Boolean
// Explicit packages to test
// If provided 'includes' and 'excludes' will be ignored.
packages = [] // []String
// Searches in this directories for test go sources to be tested.
includes = [] // []String
// Do not searches in this directories for test go sources to be tested.
excludes = [] // []String
// Optional arguments to pass to the go test tool
arguments = [] // []String
// Optional arguments to pass to the go test itself
testArguments = [] // []String
// Write a coverage profile to the file after all tests have passed.
// Force call "go test" with "-cover" flag.
coverProfile = null // Path
// Write a coverage profile as HTML to the file after all tests have passed.
// Force call "go test" with "-cover" flag.
coverProfileHtml = null // Path
// Will write the test output in the specified file.
// If set to null this file will not be written.
log = "<buildDir>/testing/test.log" // Path
// Will write the test output in JUnit report format in the specified file.
// If set to null this file will not be written.
junitReport = "<buildDir>/testing/junit_report.xml" // Path
}
toolchain {
// Always build toolchain also if already there and working
forceBuildToolchain = false // Boolean
// Used go version
goversion = 'go1.8' // String
// Used GOROOT. This will normally automated detected by validate task
goroot = '<automatically detected>' // Path
// Use cgo or not
cgoEnabled = false // Boolean
// Used GOROOT_BOOTSTRAP. This will normally automated detected by validate task
bootstrapGoroot = '<automatically detected>' // Path
// Location where to download bootstrap toolchain and target toolchain
downloadUriRoot = 'https://storage.googleapis.com/golang/' // URI
}
}
dependencies {
// Here you can define dependencies in Gradle familiar way.
// In this context it is not possible to provide all possible variables and you have to provide more
// meta information than under "golang.dependencies".
// configuration:
// * build: Required for build and testing
// * test: Required only for test
// * tool: Tool required only while build process
// packageName: It is required to split the package up to meet default Gradle behaviours.
// Example: "github.com/urfave/cli" -> "github.com:urfave/cli"
// version: Identifies the version of the dependency package to use. If you want to use the default one
// provide the special keyword "default".
<configuration> '<providerPartOfPackageName>:<restOfPackageName>:<version>'
// Example: build 'github.com:urfave/cli:default'
// ...
} TasksRun tasks using... # On Linux and macOS
./gradlew <task> [...]
# On Windows
gradlew <task> [...]
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论