Skip to content

Commit c867379

Browse files
authored
Streamline README for Gradle and cross-architecture builds & upgrade gogradle plugin (#1122)
* Fix parameter names for inmline type tests * Update gogradle and improve docs * Streamline the README instructions and provide better description of archs. * Streamline the README instructions and provide better description of archs. * Streamline the README instructions and provide better description of archs. * Streamline the README instructions and provide better description of archs. * Streamline the README instructions and provide better description of archs. * Streamline the README instructions and provide better description of archs. * Streamline the README instructions and provide better description of archs. * Streamline the README instructions and provide better description of archs.
1 parent af80c22 commit c867379

4 files changed

Lines changed: 61 additions & 35 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Packages/
4141

4242
# Gradle
4343
.gradle
44+
.gogradle
4445
build/
4546

4647
#emacs

README.md

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
2323
[![Build Status](https://travis-ci.com/apache/openwhisk-wskdeploy.svg?branch=master)](https://travis-ci.com/apache/openwhisk-wskdeploy)
2424

25-
`wskdeploy` is a utility to help you describe and deploy any part of the OpenWhisk programming model using a Manifest file written in YAML. Use it to deploy all your OpenWhisk [Packages](https://github.com/apache/openwhisk/blob/master/docs/packages.md), [Actions](https://github.com/apache/openwhisk/blob/master/docs/actions.md), [Triggers, and Rules](https://github.com/apache/openwhisk/blob/master/docs/triggers_rules.md) using a single command!
25+
`wskdeploy` is a utility to help you describe and deploy any part of the OpenWhisk programming model using a YAML manifest file. Use it to deploy all of your OpenWhisk project's [Packages](https://github.com/apache/openwhisk/blob/master/docs/packages.md), [Actions](https://github.com/apache/openwhisk/blob/master/docs/actions.md), [Triggers, and Rules](https://github.com/apache/openwhisk/blob/master/docs/triggers_rules.md), together, using a single command!
2626

2727
#### Running `wskdeploy` standalone
2828

@@ -61,15 +61,20 @@ Here are some quick links to help you get started:
6161

6262
## Downloading released binaries
6363

64-
Binaries of `wskdeploy` are available for download on the project's GitHub release page:
64+
Executable binaries of `wskdeploy` are available for download on the project's GitHub [releases](https://github.com/apache/openwhisk-wskdeploy/releases) page:
6565
- [https://github.com/apache/openwhisk-wskdeploy/releases](https://github.com/apache/openwhisk-wskdeploy/releases).
6666
67-
For each release, we typically provide binaries built for Linux, Mac OS (Darwin) and Windows on the AMD64 architecture. However, we provide instructions on how to build your own binaries as well from source code with the Go tool. See [Building the project](#building-the-project).
67+
We currently provide binaries for the following Operating Systems (OS) and architecture combinations:
6868
69-
_If you are a Developer or Contributor, **we recommend building from the latest source code** from the project's master branch._
69+
Operating System | Architectures
70+
--- | ---
71+
Linux | 386, AMD64, ARM, ARM64, PPC64 (Power), S/390 and IBM Z
72+
Mac OS (Darwin) | 386<sup>[1](#1)</sup>, AMD64
73+
Windows | 386, AMD64
7074
71-
for end-users, please use versioned releases of binaries.
72-
- [https://github.com/apache/openwhisk-wskdeploy/releases](https://github.com/apache/openwhisk-wskdeploy/releases)
75+
1. Mac OS, 32-bit (386) released versions are not available for builds using Go lang version 1.15 and greater.
76+
77+
We also provide instructions on how to build your own binaries from source code. See [Building the project](#building-the-project).
7378
7479
---
7580
@@ -107,64 +112,65 @@ if you just want to build the code and do not intend to be a Contributor, you ca
107112
git clone git@github.com:apache/openwhisk-wskdeploy
108113
```
109114
110-
or you can specify a release (tag) if you do not want the latest code by using the `--branch <tag>` flag. For example, you can clone the source code for the tagged 1.1.0 [release](https://github.com/apache/openwhisk-wskdeploy/releases)
115+
or you can specify a release (tag) if you do not want the latest code by using the `--branch <tag>` flag. For example, you can clone the source code for the tagged 1.1.0 [release](https://github.com/apache/openwhisk-wskdeploy/releases/tag/1.1.0)
111116
112117
```sh
113118
git clone --branch 1.1.0 git@github.com:apache/openwhisk-wskdeploy
114119
```
115120
116121
You can also pull the code from a fork of the repository. If you intend to become a Contributor to the project, read the section [Contributing to the project](#contributing-to-the-project) below on how to setup a fork.
117122
118-
### Building using `go build`
123+
### Build using `go build`
119124
120-
Use the Go utility to build the ```wskdeploy``` binary
125+
Use the Go utility to build the ```wskdeploy``` binary.
121126
122127
Change into the cloned project directory and use `go build` with the target output name for the binary:
123128
124129
```sh
125130
$ go build -o wskdeploy
126131
```
127132
128-
an executable named `wskdeploy` will be created in the current directory for your current operating system and architecture.
129-
130-
### Building for other Operating Systems (GOOS) and Architectures (GOARCH)
133+
If successful, an executable named `wskdeploy` will be created in the project directory compatible with your current operating system and architecture.
131134
132-
If you would like to build the binary for a specific operating system, you may add the arguments GOOS and GOARCH into the Go build command. You may set
135+
#### Building for other Operating Systems (GOOS) and Architectures (GOARCH)
133136
134-
- ```GOOS``` to "linux", "darwin" or "windows"
135-
- ```GOARCH``` to "amd64" or "386"
137+
If you would like to build the binary for a specific operating system and processor architecture, you may add the arguments `GOOS` and `GOARCH` into the Go build command (as inline environment variables).
136138
137139
For example, run the following command to build the binary for 64-bit Linux:
138140
139141
```sh
140142
$ GOOS=linux GOARCH=amd64 go build -o wskdeploy
141143
```
142144
143-
### How to Cross Compile Binary with Gradle/Docker
144-
145-
If you don't want to bother with go installation, build, git clone etc, and you can do it with Gradle/Docker.
145+
Supported value combinations include:
146146
147-
After compiling, a suitable wskdeploy binary that works for your OS platform will be available under /bin directory.
147+
`GOOS` | `GOARCH`
148+
--- | ---
149+
linux | 386 (32-bit), amd64 (64-bit), s390x (S/390, Z), ppc64le (Power), arm (32-bit), arm64 (64-bit)
150+
darwin (Mac OS) | amd64
151+
windows | 386 (32-bit), amd64 (64-bit)
148152
149-
1. First you need a docker daemon running locally on your machine.
153+
### Build using Gradle
150154
151-
1. Make sure you have Java 8 or above installed.
155+
The project includes its own packaged version of Gradle called Gradle Wrapper which is invoked using the `gradlew` command on Linux/Unix/Mac or `gradlew.bat` on Windows.
152156
153-
1. Clone the wskdeploy repo with command ```git clone https://github.com/apache/openwhisk-wskdeploy.git```
157+
1. Gradle requires requires you to [install Java JDK version 8](https://gradle.org/install/) or higher
154158
155-
1. Verify your installed Gradle version is `5.5.1` (or higher)
159+
1. Clone the `openwhisk-wskdeploy` repo:
156160
157-
- On Windows OS, type ```gradlew.bat -version ```.
158-
- On Unix/Linux/Mac, please type ```./gradlew -version```.
161+
```sh
162+
git clone https://github.com/apache/openwhisk-wskdeploy
163+
```
159164
160-
> **Note** Gradle v6 is not yet supported.
165+
and change into the project directory.
161166
162167
1. Cross-compile binaries for all supported Operating Systems and Architectures:
163168
164-
- On Windows, type ```gradlew.bat goBuild```
165-
- On Linux/Unix/Mac, please type ```./gradlew goBuild```.
169+
```sh
170+
./gradlew goBuild
171+
```
166172
167-
1. Upon a successful build, all binaries can be found within the `./build` directory of your project:
173+
1. Upon a successful build, the `wskdeploy` binaries can be found under the corresponding `build/<os>-<architecture>/` folder of your project:
168174
169175
```sh
170176
$ ls build
@@ -196,9 +202,26 @@ After compiling, a suitable wskdeploy binary that works for your OS platform wil
196202
buildWindowsAmd64 - Custom go task.
197203
```
198204
199-
> Note: The `buildWindows386` option is only supported on Golang versions less than 1.15.
205+
> **Note**: The `buildWindows386` option is only supported on Golang versions less than 1.15.
206+
207+
1. Build using one of these tasks, for example:
208+
209+
```sh
210+
$ ./gradlew buildDarwinAmd64
211+
```
212+
213+
#### Using your own local Gradle to build
214+
215+
Alternatively, you can choose to [Install Gradle](https://gradle.org/install/) and use it instead of the project's Gradle Wrapper. If so, you would use the `gradle` command instead of `gradlew`. If you do elect to use your own Gradle, verify its version is `5.5.1` or higher:
216+
217+
```sh
218+
gradle -version
219+
```
220+
221+
> **Note** If using your own local Gradle installation, use the `gradle` command instead of the `./gradlew` command in the build instructions below.
222+
200223

201-
#### Building for Internationalization
224+
#### Building for internationalization
202225

203226
Please follow this process for building any changes to translatable strings:
204227
- [How to generate the file i18n_resources.go for internationalization](https://github.com/apache/openwhisk-wskdeploy/blob/master/wski18n/README.md)
@@ -242,7 +265,7 @@ $ go run main.go -m tests/usecases/triggerrule/manifest.yml -d tests/usecases/tr
242265

243266
You can now use `git push` to push local `commit` changes to your `origin` repository and submit pull requests to the `upstream` project repository.
244267

245-
1. Optionally, prevent accidental pushes to `upstream` using this command:
268+
1. Optionally, prevent accidental pushes to `upstream` using this command:
246269

247270
```sh
248271
git remote set-url --push upstream no_push
@@ -295,7 +318,7 @@ go get github.com/project/libname@aee5cab1c
295318
Although you could edit the version directly in the go.mod file, it is better to use the `go edit` command:
296319

297320
```sh
298-
go mod edit -go=1.14
321+
go mod edit -go=1.15
299322
```
300323

301324
### Creating Tagged Releases

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ buildscript {
2626
}
2727
}
2828

29+
// Gogradle Config:
30+
// https://github.com/gogradle/gogradle/blob/master/docs/getting-started.md#configuration
2931
plugins {
30-
id 'com.github.blindpirate.gogradle' version '0.8.1'
32+
id 'com.github.blindpirate.gogradle' version '0.10'
3133
}
3234

3335
apply plugin: "org.nosphere.apache.rat"

parsers/manifest_parser_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,7 @@ func TestParseYAML_param(t *testing.T) {
19431943
case "expand7":
19441944
assert.Equal(t, nil, param.Value, "Get param value failed.")
19451945
default:
1946-
t.Error("Get param name failed")
1946+
t.Error("Get param name [" + param_name + "] failed")
19471947
}
19481948
}
19491949
default:

0 commit comments

Comments
 (0)