This gem provides the following tasks:
-
rake buildfor cross-compiling for the specified architectures -
rake zipcommand for making ZIP files that contain binary builds -
rake testfor running tests for the native architecture -
rake cleanfor deleting the ZIP files
zip depends on build and test (in that order).
build uses go install, test uses go test.
The reason only the native runtime is supported in test is that go test for a different operating system does not work. That's a pity.
Installation and usage
- Install Go and Ruby.
- Install go4rake:
gem install go4rake. - Enable go4rake in
Rakefile: includerequire 'go4rake'in it (create the file, if missing).
(Unix users can do:echo "require 'go4rake'" >> Rakefile.) - Specify your platforms in
go4rake.yml. See below for configuration. - Run
rake buildorrake zip.
Configuration
zip, build and clean tasks expect a YAML config, go4rake.yml. Say, we
have this config.
This way, you run rake zip and you get the following ZIP files
containing the static binary builds in your ~/Downloads directory:
win32.zipwin64.ziplinux_amd64.ziplinux_386.zipmac.zip
For each platform:
-
nameis OS name -
archis arch -
zipis ZIP file name (optional)
These files will be also included into the ZIP files:
README.mdNOTICE
Please note that:
- If
outis specified, ZIP files will appear in the specified directory; if not, they will be in~/Downloads.
Prior to 1.5.2 the default value was. - Also please note that current files with the same names as your targets are overwritten.
- If
filesare not specified, aNOTICEfile will be included in ZIP files, if it's found in the project directory -
archis appended to the file name ifarchis a list