Compare commits

...

51 commits
main ... v2.0.1

Author SHA1 Message Date
Renan DelValle
8d67d8c2f3
Releasing 2.0.1. 2019-01-08 15:59:56 -08:00
Renan DelValle
e13349db26
Initial support for Thermos and GPU resources. 2019-01-07 14:39:47 -08:00
Renan DelValle
afcdaa84b8
Initial support for generating Thermos data objects. 2018-12-28 11:46:14 -08:00
Renan DelValle
51597ecb32
Changing paths to refer to gorealis v2 in order for dependencies to be correct. 2018-12-27 10:09:22 -08:00
Renan DelValle
acbe9ad9e5
Upgrading vendor folder dependencies. 2018-12-27 09:58:53 -08:00
Renan DelValle
4a0cbcd770
Updating codecov badge to point to the right placce. 2018-12-26 18:17:05 -08:00
Renan DelValle
b776bd301d
Adding v2 to module. 2018-12-23 12:44:26 -08:00
Renan DelValle
e4e8a1c0b3
Adding a check for 401. This reduces the retries on the end to end test and fails fast when a wrong/unathorized username and password are provided to interact with Aurora. 2018-12-18 17:14:48 -08:00
Renan DelValle
71d41de2e4
Fixing bug for logger which passed everything as an array instead of unrolling the array to the printer. 2018-12-18 16:41:31 -08:00
Renan DelValle
84e8762495
Refactoring URL validation tets to be more terse as suggested by Pinglei. 2018-12-18 12:44:08 -08:00
Renan DelValle
11c71b0463
Upgrading container where MacOS tests run to 1.11. Upgrading tuo thrift 12 for binding generation. 2018-12-18 12:38:58 -08:00
Renan DelValle
8f9a678b7d
Using more golang standard constant naming. 2018-12-18 12:38:25 -08:00
Renan DelValle
fdd94e9bea
Adding a shiro.ini configuration in order to test bad password using compose setup. 2018-12-18 12:37:50 -08:00
Renan DelValle
67b37d5a42
Improving detection of protocol to not accidentally add one protocol in front of the other. 2018-12-17 18:06:40 -08:00
Renan DelValle
56b325ed80
Aurora endpoint may now be explicitly provided with or without protocol and with or without port. 2018-12-17 18:00:20 -08:00
Renan DelValle
ef421f60c3
Adding mod support to gorealis. 2018-12-12 19:06:51 -08:00
Renan DelValle
c4691c7347
Bumping travis CI to go 1.11 2018-12-12 14:34:46 -08:00
Renan DelValle
533591ab89
Ran project through newest goimports. 2018-12-12 14:25:06 -08:00
Renan DelValle
0c00765995
Refactoring tests to reflect API changes. 2018-12-12 14:14:58 -08:00
Renan DelValle
0b43a58b15
Refactoring test to reduce code size. 2018-12-12 14:14:31 -08:00
Renan DelValle
992e52eba2
Changing realis API to use new JobUpdate struct and to use concrete JobKey types. 2018-12-12 14:13:45 -08:00
Renan DelValle
0c32a7e683
Refactored client.go example to match new api. Fixed typeo in jobUpdate function JobUpdateFromConfig. 2018-12-12 14:12:31 -08:00
Renan DelValle
e1906542a6
Allowing task and job to return job keys. Job keys are now passed around as concrete types (not pointers) due to the possiblity of side effects being cause if pointers to job keys inside of another struct are passed around. Cloning now uses the TaskFromThrift method to do a deep copy of an AuroraTask. 2018-12-12 14:01:26 -08:00
Renan DelValle
005980fc44
Refactor of update job code to use an AuroraTask underneath it and forward the necessary pointer receivers down to the AuroraTask. Code and tests for doing a deep copy of AuroraTask have been included. 2018-12-11 17:45:49 -08:00
Renan DelValle
98b4061513
Renamed Task to AuroraTask to avoid confusion with Mesos tasks. Added constants to access certain resources to avoid confusion and to ensure compile time safety. 2018-12-11 16:51:50 -08:00
Renan DelValle
e00e0a0492
Changing all containers to use pointer receiver since they are sharing around a single pointer inside the struct, I want to convey to users that the data is all being shared by a pointer. 2018-12-11 16:49:37 -08:00
Renan DelValle
5836ede37b
Splitting off Aurora task from Aurora Job since Update mechanism only needs task. 2018-12-10 18:57:16 -08:00
Renan DelValle
b0c25e9013
Refactor updatejob to JobUpdate to be more in line with Aurora terminology. 2018-12-10 18:13:28 -08:00
Renan DelValle
76300782ba
Renaming RealisClient to Client to avoid stuttering. Moving monitors under Client. Making configuration object private. Deleted legacy code to generate configuration object. 2018-12-08 08:57:15 -08:00
Renan DelValle
c1be2fe62b
Monitors are now all pointer receivers for RealisClient. 2018-12-07 16:08:49 -08:00
Renan DelValle
133938b307
Adding Tier. 2018-12-07 16:01:23 -08:00
Renan DelValle
c071e5ca62
Updating json client to use new API. 2018-12-04 15:19:08 -08:00
Renan DelValle
c00b83b14c
Making changes to sample client to match the refactoring done to main library. 2018-12-04 15:17:22 -08:00
Renan DelValle
47d955d4a4
Adding Gopkg.lock to ignore from diff file for github. 2018-11-29 17:47:12 -08:00
Renan DelValle
99b03c1254
Remove vendored folder and gen-go from Github diffs. 2018-11-29 17:45:19 -08:00
Renan DelValle
7967270b3b
Refactoring NewJob to use struct literals for clarity. 2018-11-29 17:06:45 -08:00
Renan DelValle
54378b2d8a
Changing the signature for some API. Specifically, result objects that hold a single variable are now returning that variable instead of a result object. Tests have been refcatored to use new v2 API. All tests are currently passing. 2018-11-28 20:13:49 -08:00
Renan DelValle
59e3a7065e
Refactoring code to be compatible with Thrift 0.12.0 generated code. Tests are still not refactored. 2018-11-27 18:45:10 -08:00
Renan DelValle
cec9c001fb
Upgrading dependencies 2018-11-27 18:44:33 -08:00
Renan DelValle
366599fb80
Regenerating Thrift bindings with Thrift 0.12.0 2018-11-27 18:05:33 -08:00
Renan DelValle
356978cb42
Upgrading dependency to Thrift 0.12.0 2018-11-27 18:03:50 -08:00
Renan DelValle
3e4590dcc0
Changing monitors to use time.Duration to be more explicit in code and to have tighter control. 2018-11-22 14:03:51 -08:00
Renan DelValle
b6effe66b7
Moving cluster struct factory from realis to clusters. 2018-11-22 12:23:20 -08:00
Renan DelValle
848b5f7971
Eliminating deprecated response code check since retry call does this automatically. 2018-11-22 12:23:20 -08:00
Renan DelValle
d747a48626
Simplifying API. Many API calls have gone from a tuple of two returns to a single return. 2018-11-22 12:23:18 -08:00
Renan DelValle
573e45a59c
Simplifying code to use bare structs. 2018-11-22 12:22:26 -08:00
Renan DelValle
8a9a97c150
Removing unnecessary interface from Aurora Job. 2018-11-22 12:22:26 -08:00
Renan DelValle
1146736c2b
Refactoring variable names and variable types to saner versions. 2018-11-22 12:22:25 -08:00
Renan DelValle
c65a47f6e2
Changing Certspath to CertsPath 2018-11-22 12:22:25 -08:00
Renan DelValle
4471c62659
Removing retries as an option since it's a dup of Backoff. 2018-11-22 12:22:25 -08:00
Renan DelValle
a23bd1b2cc
Shedding interface because there is no good reason to have it. 2018-11-22 12:22:22 -08:00
1411 changed files with 144110 additions and 62292 deletions

View file

@ -0,0 +1,5 @@
[users]
aurora = secret, admin
[roles]
admin = *

3
.gitattributes vendored Normal file
View file

@ -0,0 +1,3 @@
gen-go/ linguist-generated=true
vendor/ linguist-generated=true
Gopkg.lock linguist-generated=true

View file

@ -3,7 +3,7 @@ sudo: required
language: go
go:
- "1.10.x"
- "1.11.x"
env:
global:

32
Gopkg.lock generated
View file

@ -2,43 +2,59 @@
[[projects]]
branch = "0.10.0-http-client-fix"
branch = "0.12.0"
digest = "1:89696c38cec777120b8b1bb5e2d363d655cf2e1e7d8c851919aaa0fd576d9b86"
name = "git.apache.org/thrift.git"
packages = ["lib/go/thrift"]
revision = "cb1afec972a85791e9b24a04b60fc9dbbfc3cda3"
source = "github.com/rdelval/thrift"
pruneopts = ""
revision = "384647d290e2e4a55a14b1b7ef1b7e66293a2c33"
[[projects]]
digest = "1:0deddd908b6b4b768cfc272c16ee61e7088a60f7fe2f06c547bd3d8e1f8b8e77"
name = "github.com/davecgh/go-spew"
packages = ["spew"]
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
version = "v1.1.0"
pruneopts = ""
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
version = "v1.1.1"
[[projects]]
digest = "1:df48fb76fb2a40edea0c9b3d960bc95e326660d82ff1114e1f88001f7a236b40"
name = "github.com/pkg/errors"
packages = ["."]
pruneopts = ""
revision = "e881fd58d78e04cf6d0de1217f8707c8cc2249bc"
[[projects]]
digest = "1:256484dbbcd271f9ecebc6795b2df8cad4c458dd0f5fd82a8c2fa0c29f233411"
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
pruneopts = ""
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
digest = "1:78bea5e26e82826dacc5fd64a1013a6711b7075ec8072819b89e6ad76cb8196d"
name = "github.com/samuel/go-zookeeper"
packages = ["zk"]
pruneopts = ""
revision = "471cd4e61d7a78ece1791fa5faa0345dc8c7d5a5"
[[projects]]
digest = "1:c587772fb8ad29ad4db67575dad25ba17a51f072ff18a22b4f0257a4d9c24f75"
name = "github.com/stretchr/testify"
packages = ["assert"]
revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c"
version = "v1.2.0"
pruneopts = ""
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "fdb631400420ca7299ad56b66175c9157ca073e3de52f666a84fc1d6fa893978"
input-imports = [
"git.apache.org/thrift.git/lib/go/thrift",
"github.com/pkg/errors",
"github.com/samuel/go-zookeeper/zk",
"github.com/stretchr/testify/assert",
]
solver-name = "gps-cdcl"
solver-version = 1

View file

@ -1,7 +1,6 @@
[[constraint]]
name = "git.apache.org/thrift.git"
branch = "0.10.0-http-client-fix"
source = "github.com/rdelval/thrift"
branch = "0.12.0"
[[constraint]]
name = "github.com/pkg/errors"

View file

@ -1,4 +1,4 @@
# gorealis [![GoDoc](https://godoc.org/github.com/paypal/gorealis?status.svg)](https://godoc.org/github.com/paypal/gorealis) [![Build Status](https://travis-ci.org/paypal/gorealis.svg?branch=master)](https://travis-ci.org/paypal/gorealis) [![codecov](https://codecov.io/gh/paypal/gorealis/branch/master/graph/badge.svg)](https://codecov.io/gh/paypal/gorealis)
# gorealis [![GoDoc](https://godoc.org/github.com/paypal/gorealis?status.svg)](https://godoc.org/github.com/paypal/gorealis) [![Build Status](https://travis-ci.org/paypal/gorealis.svg?branch=master)](https://travis-ci.org/paypal/gorealis) [![codecov](https://codecov.io/gh/paypal/gorealis/branch/master-v2.0/graph/badge.svg)](https://codecov.io/gh/paypal/gorealis/branch/master-v2.0)
Go library for interacting with [Apache Aurora](https://github.com/apache/aurora).

View file

@ -54,3 +54,14 @@ func LoadClusters(config string) (map[string]Cluster, error) {
return m, nil
}
func GetDefaultClusterFromZKUrl(zkURL string) *Cluster {
return &Cluster{
Name: "defaultCluster",
AuthMechanism: "UNAUTHENTICATED",
ZK: zkURL,
SchedZKPath: "/aurora/scheduler",
AgentRunDir: "latest",
AgentRoot: "/var/lib/mesos",
}
}

View file

@ -18,7 +18,7 @@ import (
"fmt"
"testing"
"github.com/paypal/gorealis"
realis "github.com/paypal/gorealis/v2"
"github.com/stretchr/testify/assert"
)

View file

@ -15,35 +15,31 @@
package realis
import (
"github.com/paypal/gorealis/gen-go/apache/aurora"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
)
type Container interface {
Build() *aurora.Container
}
type MesosContainer struct {
container *aurora.MesosContainer
}
type DockerContainer struct {
container *aurora.DockerContainer
}
func NewDockerContainer() DockerContainer {
return DockerContainer{container: aurora.NewDockerContainer()}
func NewDockerContainer() *DockerContainer {
return &DockerContainer{container: aurora.NewDockerContainer()}
}
func (c DockerContainer) Build() *aurora.Container {
func (c *DockerContainer) Build() *aurora.Container {
return &aurora.Container{Docker: c.container}
}
func (c DockerContainer) Image(image string) DockerContainer {
func (c *DockerContainer) Image(image string) *DockerContainer {
c.container.Image = image
return c
}
func (c DockerContainer) AddParameter(name, value string) DockerContainer {
func (c *DockerContainer) AddParameter(name, value string) *DockerContainer {
c.container.Parameters = append(c.container.Parameters, &aurora.DockerParameter{
Name: name,
Value: value,
@ -51,15 +47,19 @@ func (c DockerContainer) AddParameter(name, value string) DockerContainer {
return c
}
func NewMesosContainer() MesosContainer {
return MesosContainer{container: aurora.NewMesosContainer()}
type MesosContainer struct {
container *aurora.MesosContainer
}
func (c MesosContainer) Build() *aurora.Container {
func NewMesosContainer() *MesosContainer {
return &MesosContainer{container: aurora.NewMesosContainer()}
}
func (c *MesosContainer) Build() *aurora.Container {
return &aurora.Container{Mesos: c.container}
}
func (c MesosContainer) DockerImage(name, tag string) MesosContainer {
func (c *MesosContainer) DockerImage(name, tag string) *MesosContainer {
if c.container.Image == nil {
c.container.Image = aurora.NewImage()
}
@ -68,7 +68,7 @@ func (c MesosContainer) DockerImage(name, tag string) MesosContainer {
return c
}
func (c MesosContainer) AppcImage(name, imageId string) MesosContainer {
func (c *MesosContainer) AppcImage(name, imageId string) *MesosContainer {
if c.container.Image == nil {
c.container.Image = aurora.NewImage()
}
@ -76,3 +76,12 @@ func (c MesosContainer) AppcImage(name, imageId string) MesosContainer {
c.container.Image.Appc = &aurora.AppcImage{Name: name, ImageId: imageId}
return c
}
func (c *MesosContainer) AddVolume(hostPath, containerPath string, mode aurora.Mode) *MesosContainer {
c.container.Volumes = append(c.container.Volumes, &aurora.Volume{
HostPath: hostPath,
ContainerPath: containerPath,
Mode: mode})
return c
}

View file

@ -65,6 +65,12 @@ services:
CLUSTER_NAME: test-cluster
ZK_ENDPOINTS: "192.168.33.2:2181"
MESOS_MASTER: "zk://192.168.33.2:2181/mesos"
EXTRA_SCHEDULER_ARGS: >
-http_authentication_mechanism=BASIC
-shiro_realm_modules=INI_AUTHNZ
-shiro_ini_path=/etc/aurora/security.ini
volumes:
- ./.aurora-config:/etc/aurora
networks:
aurora_cluster:
ipv4_address: 192.168.33.7

View file

@ -17,7 +17,7 @@ package realis
// Using a pattern described by Dave Cheney to differentiate errors
// https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully
// Timeout errors are returned when a function is unable to continue executing due
// Timedout errors are returned when a function is unable to continue executing due
// to a time constraint or meeting a set number of retries.
type timeout interface {
Timedout() bool

View file

@ -17,24 +17,22 @@ package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"strings"
"time"
"github.com/paypal/gorealis"
"github.com/paypal/gorealis/gen-go/apache/aurora"
"github.com/paypal/gorealis/response"
realis "github.com/paypal/gorealis/v2"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
)
var cmd, executor, url, clustersConfig, clusterName, updateId, username, password, zkUrl, hostList, role string
var caCertsPath string
var clientKey, clientCert string
var CONNECTION_TIMEOUT = 20000
var ConnectionTimeout = 20 * time.Second
func init() {
flag.StringVar(&cmd, "cmd", "", "Job request type to send to Aurora Scheduler")
flag.StringVar(&cmd, "cmd", "", "Aurora Job request type to send to Aurora Scheduler")
flag.StringVar(&executor, "executor", "thermos", "Executor to use")
flag.StringVar(&url, "url", "", "URL at which the Aurora Scheduler exists as [url]:[port]")
flag.StringVar(&clustersConfig, "clusters", "", "Location of the clusters.json file used by aurora.")
@ -74,15 +72,14 @@ func init() {
func main() {
var job realis.Job
var job *realis.AuroraJob
var err error
var monitor *realis.Monitor
var r realis.Realis
var r *realis.Client
clientOptions := []realis.ClientOption{
realis.BasicAuth(username, password),
realis.ThriftJSON(),
realis.TimeoutMS(CONNECTION_TIMEOUT),
realis.Timeout(ConnectionTimeout),
realis.BackOff(realis.Backoff{
Steps: 2,
Duration: 10 * time.Second,
@ -92,7 +89,7 @@ func main() {
realis.Debug(),
}
//check if zkUrl is available.
// Check if zkUrl is available.
if zkUrl != "" {
fmt.Println("zkUrl: ", zkUrl)
clientOptions = append(clientOptions, realis.ZKUrl(zkUrl))
@ -101,39 +98,36 @@ func main() {
}
if caCertsPath != "" {
clientOptions = append(clientOptions, realis.Certspath(caCertsPath))
clientOptions = append(clientOptions, realis.CertsPath(caCertsPath))
}
if clientKey != "" && clientCert != "" {
clientOptions = append(clientOptions, realis.ClientCerts(clientKey, clientCert))
}
r, err = realis.NewRealisClient(clientOptions...)
r, err = realis.NewClient(clientOptions...)
if err != nil {
log.Fatalln(err)
}
monitor = &realis.Monitor{r}
defer r.Close()
switch executor {
case "thermos":
payload, err := ioutil.ReadFile("examples/thermos_payload.json")
if err != nil {
log.Fatalln("Error reading json config file: ", err)
}
thermosExec := realis.ThermosExecutor{}
thermosExec.AddProcess(realis.NewThermosProcess("boostrap", "echo bootsrapping")).
AddProcess(realis.NewThermosProcess("hello_gorealis", "while true; do echo hello world from gorealis; sleep 10; done"))
job = realis.NewJob().
Environment("prod").
Role("vagrant").
Name("hello_world_from_gorealis").
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
ExecutorData(string(payload)).
CPU(1).
RAM(64).
Disk(100).
IsService(true).
InstanceCount(1).
AddPorts(1)
AddPorts(1).
ThermosExecutor(thermosExec)
case "compose":
job = realis.NewJob().
Environment("prod").
@ -167,14 +161,13 @@ func main() {
switch cmd {
case "create":
fmt.Println("Creating job")
resp, err := r.CreateJob(job)
err := r.CreateJob(job)
if err != nil {
log.Fatalln(err)
}
fmt.Println(resp.String())
if ok, mErr := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 5, 50); !ok || mErr != nil {
_, err := r.KillJob(job.JobKey())
if ok, mErr := r.InstancesMonitor(job.JobKey(), job.GetInstanceCount(), 5*time.Second, 50*time.Second); !ok || mErr != nil {
err := r.KillJob(job.JobKey())
if err != nil {
log.Fatalln(err)
}
@ -184,18 +177,17 @@ func main() {
case "createService":
// Create a service with three instances using the update API instead of the createJob API
fmt.Println("Creating service")
settings := realis.NewUpdateSettings()
job.InstanceCount(3)
resp, result, err := r.CreateService(job, settings)
settings := realis.JobUpdateFromAuroraTask(job.AuroraTask()).InstanceCount(3)
result, err := r.CreateService(settings)
if err != nil {
log.Println("error: ", err)
log.Fatal("response: ", resp.String())
log.Fatal("error: ", err)
}
fmt.Println(result.String())
if ok, mErr := monitor.JobUpdate(*result.GetKey(), 5, 180); !ok || mErr != nil {
_, err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out")
_, err = r.KillJob(job.JobKey())
if ok, mErr := r.JobUpdateMonitor(*result.GetKey(), 5*time.Second, 180*time.Second); !ok || mErr != nil {
err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out")
err = r.KillJob(job.JobKey())
if err != nil {
log.Fatal(err)
}
@ -206,14 +198,13 @@ func main() {
fmt.Println("Creating a docker based job")
container := realis.NewDockerContainer().Image("python:2.7").AddParameter("network", "host")
job.Container(container)
resp, err := r.CreateJob(job)
err := r.CreateJob(job)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.String())
if ok, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 10, 300); !ok || err != nil {
_, err := r.KillJob(job.JobKey())
if ok, err := r.InstancesMonitor(job.JobKey(), job.GetInstanceCount(), 10*time.Second, 300*time.Second); !ok || err != nil {
err := r.KillJob(job.JobKey())
if err != nil {
log.Fatal(err)
}
@ -223,14 +214,13 @@ func main() {
fmt.Println("Creating a docker based job")
container := realis.NewMesosContainer().DockerImage("python", "2.7")
job.Container(container)
resp, err := r.CreateJob(job)
err := r.CreateJob(job)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.String())
if ok, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 10, 300); !ok || err != nil {
_, err := r.KillJob(job.JobKey())
if ok, err := r.InstancesMonitor(job.JobKey(), job.GetInstanceCount(), 10*time.Second, 300*time.Second); !ok || err != nil {
err := r.KillJob(job.JobKey())
if err != nil {
log.Fatal(err)
}
@ -241,50 +231,44 @@ func main() {
// Cron config
job.CronSchedule("* * * * *")
job.IsService(false)
resp, err := r.ScheduleCronJob(job)
err := r.ScheduleCronJob(job)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.String())
case "startCron":
fmt.Println("Starting a Cron job")
resp, err := r.StartCronJob(job.JobKey())
err := r.StartCronJob(job.JobKey())
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.String())
case "descheduleCron":
fmt.Println("Descheduling a Cron job")
resp, err := r.DescheduleCronJob(job.JobKey())
err := r.DescheduleCronJob(job.JobKey())
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.String())
case "kill":
fmt.Println("Killing job")
resp, err := r.KillJob(job.JobKey())
err := r.KillJob(job.JobKey())
if err != nil {
log.Fatal(err)
}
if ok, err := monitor.Instances(job.JobKey(), 0, 5, 50); !ok || err != nil {
if ok, err := r.InstancesMonitor(job.JobKey(), 0, 5*time.Second, 50*time.Second); !ok || err != nil {
log.Fatal("Unable to kill all instances of job")
}
fmt.Println(resp.String())
case "restart":
fmt.Println("Restarting job")
resp, err := r.RestartJob(job.JobKey())
err := r.RestartJob(job.JobKey())
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.String())
case "liveCount":
fmt.Println("Getting instance count")
@ -303,114 +287,110 @@ func main() {
log.Fatal(err)
}
fmt.Println("Number of live instances: ", len(live))
fmt.Println("Active instances: ", live)
case "flexUp":
fmt.Println("Flexing up job")
numOfInstances := int32(4)
numOfInstances := 4
live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES)
if err != nil {
log.Fatal(err)
}
currInstances := int32(len(live))
currInstances := len(live)
fmt.Println("Current num of instances: ", currInstances)
var instId int32
for k := range live {
instId = k
}
resp, err := r.AddInstances(aurora.InstanceKey{
JobKey: job.JobKey(),
InstanceId: instId,
key := job.JobKey()
err = r.AddInstances(aurora.InstanceKey{
JobKey: &key,
InstanceId: live[0],
},
numOfInstances)
int32(numOfInstances))
if err != nil {
log.Fatal(err)
}
if ok, err := monitor.Instances(job.JobKey(), currInstances+numOfInstances, 5, 50); !ok || err != nil {
if ok, err := r.InstancesMonitor(job.JobKey(), int32(currInstances+numOfInstances), 5*time.Second, 50*time.Second); !ok || err != nil {
fmt.Println("Flexing up failed")
}
fmt.Println(resp.String())
case "flexDown":
fmt.Println("Flexing down job")
numOfInstances := int32(2)
numOfInstances := 2
live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES)
if err != nil {
log.Fatal(err)
}
currInstances := int32(len(live))
currInstances := len(live)
fmt.Println("Current num of instances: ", currInstances)
resp, err := r.RemoveInstances(job.JobKey(), numOfInstances)
err = r.RemoveInstances(job.JobKey(), numOfInstances)
if err != nil {
log.Fatal(err)
}
if ok, err := monitor.Instances(job.JobKey(), currInstances-numOfInstances, 5, 100); !ok || err != nil {
if ok, err := r.InstancesMonitor(job.JobKey(), int32(currInstances-numOfInstances), 5*time.Second, 100*time.Second); !ok || err != nil {
fmt.Println("flexDown failed")
}
fmt.Println(resp.String())
case "update":
fmt.Println("Updating a job with with more RAM and to 5 instances")
live, err := r.GetInstanceIds(job.JobKey(), aurora.ACTIVE_STATES)
if err != nil {
log.Fatal(err)
}
var instId int32
for k := range live {
instId = k
}
key := job.JobKey()
taskConfig, err := r.FetchTaskConfig(aurora.InstanceKey{
JobKey: job.JobKey(),
InstanceId: instId,
JobKey: &key,
InstanceId: live[0],
})
if err != nil {
log.Fatal(err)
}
updateJob := realis.NewDefaultUpdateJob(taskConfig)
updateJob.InstanceCount(5).RAM(128)
updateJob := realis.JobUpdateFromConfig(taskConfig).InstanceCount(5).RAM(128)
resp, err := r.StartJobUpdate(updateJob, "")
result, err := r.StartJobUpdate(updateJob, "")
if err != nil {
log.Fatal(err)
}
jobUpdateKey := response.JobUpdateKey(resp)
monitor.JobUpdate(*jobUpdateKey, 5, 500)
jobUpdateKey := result.GetKey()
_, err = r.JobUpdateMonitor(*jobUpdateKey, 5*time.Second, 6*time.Minute)
if err != nil {
log.Fatal(err)
}
case "pauseJobUpdate":
resp, err := r.PauseJobUpdate(&aurora.JobUpdateKey{
Job: job.JobKey(),
key := job.JobKey()
err := r.PauseJobUpdate(&aurora.JobUpdateKey{
Job: &key,
ID: updateId,
}, "")
if err != nil {
log.Fatal(err)
}
fmt.Println("PauseJobUpdate response: ", resp.String())
case "resumeJobUpdate":
resp, err := r.ResumeJobUpdate(&aurora.JobUpdateKey{
Job: job.JobKey(),
key := job.JobKey()
err := r.ResumeJobUpdate(&aurora.JobUpdateKey{
Job: &key,
ID: updateId,
}, "")
if err != nil {
log.Fatal(err)
}
fmt.Println("ResumeJobUpdate response: ", resp.String())
case "pulseJobUpdate":
key := job.JobKey()
resp, err := r.PulseJobUpdate(&aurora.JobUpdateKey{
Job: job.JobKey(),
Job: &key,
ID: updateId,
})
if err != nil {
@ -420,9 +400,10 @@ func main() {
fmt.Println("PulseJobUpdate response: ", resp.String())
case "updateDetails":
resp, err := r.JobUpdateDetails(aurora.JobUpdateQuery{
key := job.JobKey()
result, err := r.JobUpdateDetails(aurora.JobUpdateQuery{
Key: &aurora.JobUpdateKey{
Job: job.JobKey(),
Job: &key,
ID: updateId,
},
Limit: 1,
@ -432,12 +413,13 @@ func main() {
log.Fatal(err)
}
fmt.Println(response.JobUpdateDetails(resp))
fmt.Println(result)
case "abortUpdate":
fmt.Println("Abort update")
resp, err := r.AbortJobUpdate(aurora.JobUpdateKey{
Job: job.JobKey(),
key := job.JobKey()
err := r.AbortJobUpdate(aurora.JobUpdateKey{
Job: &key,
ID: updateId,
},
"")
@ -445,12 +427,12 @@ func main() {
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.String())
case "rollbackUpdate":
fmt.Println("Abort update")
resp, err := r.RollbackJobUpdate(aurora.JobUpdateKey{
Job: job.JobKey(),
key := job.JobKey()
err := r.RollbackJobUpdate(aurora.JobUpdateKey{
Job: &key,
ID: updateId,
},
"")
@ -458,7 +440,6 @@ func main() {
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.String())
case "taskConfig":
fmt.Println("Getting job info")
@ -467,14 +448,10 @@ func main() {
log.Fatal(err)
}
var instId int32
for k := range live {
instId = k
break
}
key := job.JobKey()
config, err := r.FetchTaskConfig(aurora.InstanceKey{
JobKey: job.JobKey(),
InstanceId: instId,
JobKey: &key,
InstanceId: live[0],
})
if err != nil {
@ -485,9 +462,10 @@ func main() {
case "updatesummary":
fmt.Println("Getting job update summary")
key := job.JobKey()
jobquery := &aurora.JobUpdateQuery{
Role: &job.JobKey().Role,
JobKey: job.JobKey(),
Role: &key.Role,
JobKey: &key,
}
updatesummary, err := r.GetJobUpdateSummaries(jobquery)
if err != nil {
@ -498,10 +476,11 @@ func main() {
case "taskStatus":
fmt.Println("Getting task status")
key := job.JobKey()
taskQ := &aurora.TaskQuery{
Role: &job.JobKey().Role,
Environment: &job.JobKey().Environment,
JobName: &job.JobKey().Name,
Role: &key.Role,
Environment: &key.Environment,
JobName: &key.Name,
}
tasks, err := r.GetTaskStatus(taskQ)
if err != nil {
@ -513,10 +492,11 @@ func main() {
case "tasksWithoutConfig":
fmt.Println("Getting task status")
key := job.JobKey()
taskQ := &aurora.TaskQuery{
Role: &job.JobKey().Role,
Environment: &job.JobKey().Environment,
JobName: &job.JobKey().Name,
Role: &key.Role,
Environment: &key.Environment,
JobName: &key.Name,
}
tasks, err := r.GetTasksWithoutConfigs(taskQ)
if err != nil {
@ -532,17 +512,17 @@ func main() {
log.Fatal("No hosts specified to drain")
}
hosts := strings.Split(hostList, ",")
_, result, err := r.DrainHosts(hosts...)
_, err := r.DrainHosts(hosts...)
if err != nil {
log.Fatalf("error: %+v\n", err.Error())
}
// Monitor change to DRAINING and DRAINED mode
hostResult, err := monitor.HostMaintenance(
hostResult, err := r.HostMaintenanceMonitor(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
5,
10)
5*time.Second,
10*time.Second)
if err != nil {
for host, ok := range hostResult {
if !ok {
@ -552,8 +532,6 @@ func main() {
log.Fatalf("error: %+v\n", err.Error())
}
fmt.Print(result.String())
case "SLADrainHosts":
fmt.Println("Setting hosts to DRAINING using SLA aware draining")
if hostList == "" {
@ -563,17 +541,17 @@ func main() {
policy := aurora.SlaPolicy{PercentageSlaPolicy: &aurora.PercentageSlaPolicy{Percentage: 50.0}}
result, err := r.SLADrainHosts(&policy, 30, hosts...)
_, err := r.SLADrainHosts(&policy, 30, hosts...)
if err != nil {
log.Fatalf("error: %+v\n", err.Error())
}
// Monitor change to DRAINING and DRAINED mode
hostResult, err := monitor.HostMaintenance(
hostResult, err := r.HostMaintenanceMonitor(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
5,
10)
5*time.Second,
10*time.Second)
if err != nil {
for host, ok := range hostResult {
if !ok {
@ -583,25 +561,23 @@ func main() {
log.Fatalf("error: %+v\n", err.Error())
}
fmt.Print(result.String())
case "endMaintenance":
fmt.Println("Setting hosts to ACTIVE")
if hostList == "" {
log.Fatal("No hosts specified to drain")
}
hosts := strings.Split(hostList, ",")
_, result, err := r.EndMaintenance(hosts...)
_, err := r.EndMaintenance(hosts...)
if err != nil {
log.Fatalf("error: %+v\n", err.Error())
}
// Monitor change to DRAINING and DRAINED mode
hostResult, err := monitor.HostMaintenance(
hostResult, err := r.HostMaintenanceMonitor(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
5,
10)
5*time.Second,
10*time.Second)
if err != nil {
for host, ok := range hostResult {
if !ok {
@ -611,14 +587,13 @@ func main() {
log.Fatalf("error: %+v\n", err.Error())
}
fmt.Print(result.String())
case "getPendingReasons":
fmt.Println("Getting pending reasons")
key := job.JobKey()
taskQ := &aurora.TaskQuery{
Role: &job.JobKey().Role,
Environment: &job.JobKey().Environment,
JobName: &job.JobKey().Name,
Role: &key.Role,
Environment: &key.Environment,
JobName: &key.Name,
}
reasons, err := r.GetPendingReason(taskQ)
if err != nil {
@ -630,7 +605,7 @@ func main() {
case "getJobs":
fmt.Println("GetJobs...role: ", role)
_, result, err := r.GetJobs(role)
result, err := r.GetJobs(role)
if err != nil {
log.Fatalf("error: %+v\n", err.Error())
}

View file

@ -23,8 +23,8 @@ import (
"os"
"time"
"github.com/paypal/gorealis"
"github.com/paypal/gorealis/gen-go/apache/aurora"
realis "github.com/paypal/gorealis/v2"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
"github.com/pkg/errors"
)
@ -125,7 +125,7 @@ func init() {
}
}
func CreateRealisClient(config *Config) (realis.Realis, error) {
func CreateRealisClient(config *Config) (*realis.Client, error) {
var transportOption realis.ClientOption
// Configuring transport protocol. If not transport is provided, then using JSON as the
// default transport protocol.
@ -157,7 +157,7 @@ func CreateRealisClient(config *Config) (realis.Realis, error) {
clientOptions = append(clientOptions, realis.Debug())
}
return realis.NewRealisClient(clientOptions...)
return realis.NewClient(clientOptions...)
}
func main() {
@ -165,7 +165,6 @@ func main() {
fmt.Println(clientCreationErr)
os.Exit(1)
} else {
monitor := &realis.Monitor{Client: r}
defer r.Close()
uris := job.URIs
labels := job.Labels
@ -205,20 +204,18 @@ func main() {
}
fmt.Println("Creating Job...")
if resp, jobCreationErr := r.CreateJob(auroraJob); jobCreationErr != nil {
if jobCreationErr := r.CreateJob(auroraJob); jobCreationErr != nil {
fmt.Println("Error creating Aurora job: ", jobCreationErr)
os.Exit(1)
} else {
if resp.ResponseCode == aurora.ResponseCode_OK {
if ok, monitorErr := monitor.Instances(auroraJob.JobKey(), auroraJob.GetInstanceCount(), 5, 50); !ok || monitorErr != nil {
if _, jobErr := r.KillJob(auroraJob.JobKey()); jobErr !=
nil {
fmt.Println(jobErr)
os.Exit(1)
} else {
fmt.Println("ok: ", ok)
fmt.Println("jobErr: ", jobErr)
}
if ok, monitorErr := r.InstancesMonitor(auroraJob.JobKey(), auroraJob.GetInstanceCount(), 5, 50); !ok || monitorErr != nil {
if jobErr := r.KillJob(auroraJob.JobKey()); jobErr !=
nil {
fmt.Println(jobErr)
os.Exit(1)
} else {
fmt.Println("ok: ", ok)
fmt.Println("jobErr: ", jobErr)
}
}
}

View file

@ -1,62 +0,0 @@
{
"environment": "prod",
"health_check_config": {
"initial_interval_secs": 15.0,
"health_checker": {
"http": {
"expected_response_code": 0,
"endpoint": "/health",
"expected_response": "ok"
}
},
"interval_secs": 10.0,
"timeout_secs": 1.0,
"max_consecutive_failures": 0
},
"name": "hello_world_from_gorealis",
"service": false,
"max_task_failures": 1,
"cron_collision_policy": "KILL_EXISTING",
"enable_hooks": false,
"cluster": "devcluster",
"task": {
"processes": [
{
"daemon": false,
"name": "hello",
"ephemeral": false,
"max_failures": 1,
"min_duration": 5,
"cmdline": "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ",
"final": false
}
],
"name": "hello",
"finalization_wait": 30,
"max_failures": 1,
"max_concurrency": 0,
"resources": {
"gpu": 0,
"disk": 134217728,
"ram": 134217728,
"cpu": 1.0
},
"constraints": [
{
"order": [
"hello"
]
}
]
},
"production": false,
"role": "vagrant",
"lifecycle": {
"http": {
"graceful_shutdown_endpoint": "/quitquitquit",
"port": "health",
"shutdown_endpoint": "/abortabortabort"
}
},
"priority": 0
}

View file

@ -0,0 +1,28 @@
{
"task": {
"processes": [
{
"daemon": false,
"name": "hello",
"ephemeral": false,
"max_failures": 1,
"min_duration": 5,
"cmdline": "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ",
"final": false
}
],
"resources": {
"gpu": 0,
"disk": 134217728,
"ram": 134217728,
"cpu": 1.1
},
"constraints": [
{
"order": [
"hello"
]
}
]
}
}

View file

@ -0,0 +1,7 @@
// Autogenerated by Thrift Compiler (1.0.0-dev)
// Autogenerated by Thrift Compiler (0.12.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
package aurora
var GoUnusedProtection__ int

View file

@ -0,0 +1,58 @@
// Autogenerated by Thrift Compiler (0.12.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
package aurora
import (
"bytes"
"context"
"fmt"
"reflect"
"git.apache.org/thrift.git/lib/go/thrift"
)
// (needed to ensure safety because of naive import list construction.)
var _ = thrift.ZERO
var _ = fmt.Printf
var _ = context.Background
var _ = reflect.DeepEqual
var _ = bytes.Equal
const AURORA_EXECUTOR_NAME = "AuroraExecutor"
var ACTIVE_STATES []ScheduleStatus
var SLAVE_ASSIGNED_STATES []ScheduleStatus
var LIVE_STATES []ScheduleStatus
var TERMINAL_STATES []ScheduleStatus
const GOOD_IDENTIFIER_PATTERN = "^[\\w\\-\\.]+$"
const GOOD_IDENTIFIER_PATTERN_JVM = "^[\\w\\-\\.]+$"
const GOOD_IDENTIFIER_PATTERN_PYTHON = "^[\\w\\-\\.]+$"
var ACTIVE_JOB_UPDATE_STATES []JobUpdateStatus
var AWAITNG_PULSE_JOB_UPDATE_STATES []JobUpdateStatus
const BYPASS_LEADER_REDIRECT_HEADER_NAME = "Bypass-Leader-Redirect"
const TASK_FILESYSTEM_MOUNT_POINT = "taskfs"
func init() {
ACTIVE_STATES = []ScheduleStatus{
9, 17, 6, 0, 13, 12, 2, 1, 18, 16}
SLAVE_ASSIGNED_STATES = []ScheduleStatus{
9, 17, 6, 13, 12, 2, 18, 1}
LIVE_STATES = []ScheduleStatus{
6, 13, 12, 17, 18, 2}
TERMINAL_STATES = []ScheduleStatus{
4, 3, 5, 7}
ACTIVE_JOB_UPDATE_STATES = []JobUpdateStatus{
0, 1, 2, 3, 9, 10}
AWAITNG_PULSE_JOB_UPDATE_STATES = []JobUpdateStatus{
9, 10}
}

File diff suppressed because it is too large Load diff

View file

@ -1,19 +1,21 @@
// Autogenerated by Thrift Compiler (0.9.3)
// Autogenerated by Thrift Compiler (0.12.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
package main
import (
"apache/aurora"
"context"
"flag"
"fmt"
"git.apache.org/thrift.git/lib/go/thrift"
"math"
"net"
"net/url"
"os"
"strconv"
"strings"
"git.apache.org/thrift.git/lib/go/thrift"
)
func Usage() {
@ -69,6 +71,22 @@ func Usage() {
os.Exit(0)
}
type httpHeaders map[string]string
func (h httpHeaders) String() string {
var m map[string]string = h
return fmt.Sprintf("%s", m)
}
func (h httpHeaders) Set(value string) error {
parts := strings.Split(value, ": ")
if len(parts) != 2 {
return fmt.Errorf("header should be of format 'Key: Value'")
}
h[parts[0]] = parts[1]
return nil
}
func main() {
flag.Usage = Usage
var host string
@ -77,7 +95,8 @@ func main() {
var urlString string
var framed bool
var useHttp bool
var parsedUrl url.URL
headers := make(httpHeaders)
var parsedUrl *url.URL
var trans thrift.TTransport
_ = strconv.Atoi
_ = math.Abs
@ -88,16 +107,18 @@ func main() {
flag.StringVar(&urlString, "u", "", "Specify the url")
flag.BoolVar(&framed, "framed", false, "Use framed transport")
flag.BoolVar(&useHttp, "http", false, "Use http")
flag.Var(headers, "H", "Headers to set on the http(s) request (e.g. -H \"Key: Value\")")
flag.Parse()
if len(urlString) > 0 {
parsedUrl, err := url.Parse(urlString)
var err error
parsedUrl, err = url.Parse(urlString)
if err != nil {
fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
flag.Usage()
}
host = parsedUrl.Host
useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" || parsedUrl.Scheme == "https"
} else if useHttp {
_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
if err != nil {
@ -110,6 +131,12 @@ func main() {
var err error
if useHttp {
trans, err = thrift.NewTHttpClient(parsedUrl.String())
if len(headers) > 0 {
httptrans := trans.(*thrift.THttpClient)
for key, value := range headers {
httptrans.SetHeader(key, value)
}
}
} else {
portStr := fmt.Sprint(port)
if strings.Contains(host, ":") {
@ -152,7 +179,9 @@ func main() {
Usage()
os.Exit(1)
}
client := aurora.NewAuroraAdminClientFactory(trans, protocolFactory)
iprot := protocolFactory.GetProtocol(trans)
oprot := protocolFactory.GetProtocol(trans)
client := aurora.NewAuroraAdminClient(thrift.NewTStandardClient(iprot, oprot))
if err := trans.Open(); err != nil {
fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
os.Exit(1)
@ -174,7 +203,7 @@ func main() {
Usage()
return
}
factory357 := thrift.NewTSimpleJSONProtocolFactory()
factory357 := thrift.NewTJSONProtocolFactory()
jsProt358 := factory357.GetProtocol(mbTrans355)
argvalue1 := aurora.NewResourceAggregate()
err359 := argvalue1.Read(jsProt358)
@ -183,7 +212,7 @@ func main() {
return
}
value1 := argvalue1
fmt.Print(client.SetQuota(value0, value1))
fmt.Print(client.SetQuota(context.Background(), value0, value1))
fmt.Print("\n")
break
case "forceTaskState":
@ -200,7 +229,7 @@ func main() {
}
argvalue1 := aurora.ScheduleStatus(tmp1)
value1 := argvalue1
fmt.Print(client.ForceTaskState(value0, value1))
fmt.Print(client.ForceTaskState(context.Background(), value0, value1))
fmt.Print("\n")
break
case "performBackup":
@ -208,7 +237,7 @@ func main() {
fmt.Fprintln(os.Stderr, "PerformBackup requires 0 args")
flag.Usage()
}
fmt.Print(client.PerformBackup())
fmt.Print(client.PerformBackup(context.Background()))
fmt.Print("\n")
break
case "listBackups":
@ -216,7 +245,7 @@ func main() {
fmt.Fprintln(os.Stderr, "ListBackups requires 0 args")
flag.Usage()
}
fmt.Print(client.ListBackups())
fmt.Print(client.ListBackups(context.Background()))
fmt.Print("\n")
break
case "stageRecovery":
@ -226,7 +255,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.StageRecovery(value0))
fmt.Print(client.StageRecovery(context.Background(), value0))
fmt.Print("\n")
break
case "queryRecovery":
@ -242,7 +271,7 @@ func main() {
Usage()
return
}
factory365 := thrift.NewTSimpleJSONProtocolFactory()
factory365 := thrift.NewTJSONProtocolFactory()
jsProt366 := factory365.GetProtocol(mbTrans363)
argvalue0 := aurora.NewTaskQuery()
err367 := argvalue0.Read(jsProt366)
@ -251,7 +280,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.QueryRecovery(value0))
fmt.Print(client.QueryRecovery(context.Background(), value0))
fmt.Print("\n")
break
case "deleteRecoveryTasks":
@ -267,7 +296,7 @@ func main() {
Usage()
return
}
factory371 := thrift.NewTSimpleJSONProtocolFactory()
factory371 := thrift.NewTJSONProtocolFactory()
jsProt372 := factory371.GetProtocol(mbTrans369)
argvalue0 := aurora.NewTaskQuery()
err373 := argvalue0.Read(jsProt372)
@ -276,7 +305,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.DeleteRecoveryTasks(value0))
fmt.Print(client.DeleteRecoveryTasks(context.Background(), value0))
fmt.Print("\n")
break
case "commitRecovery":
@ -284,7 +313,7 @@ func main() {
fmt.Fprintln(os.Stderr, "CommitRecovery requires 0 args")
flag.Usage()
}
fmt.Print(client.CommitRecovery())
fmt.Print(client.CommitRecovery(context.Background()))
fmt.Print("\n")
break
case "unloadRecovery":
@ -292,7 +321,7 @@ func main() {
fmt.Fprintln(os.Stderr, "UnloadRecovery requires 0 args")
flag.Usage()
}
fmt.Print(client.UnloadRecovery())
fmt.Print(client.UnloadRecovery(context.Background()))
fmt.Print("\n")
break
case "startMaintenance":
@ -308,7 +337,7 @@ func main() {
Usage()
return
}
factory377 := thrift.NewTSimpleJSONProtocolFactory()
factory377 := thrift.NewTJSONProtocolFactory()
jsProt378 := factory377.GetProtocol(mbTrans375)
argvalue0 := aurora.NewHosts()
err379 := argvalue0.Read(jsProt378)
@ -317,7 +346,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.StartMaintenance(value0))
fmt.Print(client.StartMaintenance(context.Background(), value0))
fmt.Print("\n")
break
case "drainHosts":
@ -333,7 +362,7 @@ func main() {
Usage()
return
}
factory383 := thrift.NewTSimpleJSONProtocolFactory()
factory383 := thrift.NewTJSONProtocolFactory()
jsProt384 := factory383.GetProtocol(mbTrans381)
argvalue0 := aurora.NewHosts()
err385 := argvalue0.Read(jsProt384)
@ -342,7 +371,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.DrainHosts(value0))
fmt.Print(client.DrainHosts(context.Background(), value0))
fmt.Print("\n")
break
case "maintenanceStatus":
@ -358,7 +387,7 @@ func main() {
Usage()
return
}
factory389 := thrift.NewTSimpleJSONProtocolFactory()
factory389 := thrift.NewTJSONProtocolFactory()
jsProt390 := factory389.GetProtocol(mbTrans387)
argvalue0 := aurora.NewHosts()
err391 := argvalue0.Read(jsProt390)
@ -367,7 +396,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.MaintenanceStatus(value0))
fmt.Print(client.MaintenanceStatus(context.Background(), value0))
fmt.Print("\n")
break
case "endMaintenance":
@ -383,7 +412,7 @@ func main() {
Usage()
return
}
factory395 := thrift.NewTSimpleJSONProtocolFactory()
factory395 := thrift.NewTJSONProtocolFactory()
jsProt396 := factory395.GetProtocol(mbTrans393)
argvalue0 := aurora.NewHosts()
err397 := argvalue0.Read(jsProt396)
@ -392,7 +421,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.EndMaintenance(value0))
fmt.Print(client.EndMaintenance(context.Background(), value0))
fmt.Print("\n")
break
case "slaDrainHosts":
@ -408,7 +437,7 @@ func main() {
Usage()
return
}
factory401 := thrift.NewTSimpleJSONProtocolFactory()
factory401 := thrift.NewTJSONProtocolFactory()
jsProt402 := factory401.GetProtocol(mbTrans399)
argvalue0 := aurora.NewHosts()
err403 := argvalue0.Read(jsProt402)
@ -425,7 +454,7 @@ func main() {
Usage()
return
}
factory407 := thrift.NewTSimpleJSONProtocolFactory()
factory407 := thrift.NewTJSONProtocolFactory()
jsProt408 := factory407.GetProtocol(mbTrans405)
argvalue1 := aurora.NewSlaPolicy()
err409 := argvalue1.Read(jsProt408)
@ -440,7 +469,7 @@ func main() {
return
}
value2 := argvalue2
fmt.Print(client.SlaDrainHosts(value0, value1, value2))
fmt.Print(client.SlaDrainHosts(context.Background(), value0, value1, value2))
fmt.Print("\n")
break
case "snapshot":
@ -448,7 +477,7 @@ func main() {
fmt.Fprintln(os.Stderr, "Snapshot requires 0 args")
flag.Usage()
}
fmt.Print(client.Snapshot())
fmt.Print(client.Snapshot(context.Background()))
fmt.Print("\n")
break
case "triggerExplicitTaskReconciliation":
@ -464,7 +493,7 @@ func main() {
Usage()
return
}
factory414 := thrift.NewTSimpleJSONProtocolFactory()
factory414 := thrift.NewTJSONProtocolFactory()
jsProt415 := factory414.GetProtocol(mbTrans412)
argvalue0 := aurora.NewExplicitReconciliationSettings()
err416 := argvalue0.Read(jsProt415)
@ -473,7 +502,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.TriggerExplicitTaskReconciliation(value0))
fmt.Print(client.TriggerExplicitTaskReconciliation(context.Background(), value0))
fmt.Print("\n")
break
case "triggerImplicitTaskReconciliation":
@ -481,7 +510,7 @@ func main() {
fmt.Fprintln(os.Stderr, "TriggerImplicitTaskReconciliation requires 0 args")
flag.Usage()
}
fmt.Print(client.TriggerImplicitTaskReconciliation())
fmt.Print(client.TriggerImplicitTaskReconciliation(context.Background()))
fmt.Print("\n")
break
case "pruneTasks":
@ -497,7 +526,7 @@ func main() {
Usage()
return
}
factory420 := thrift.NewTSimpleJSONProtocolFactory()
factory420 := thrift.NewTJSONProtocolFactory()
jsProt421 := factory420.GetProtocol(mbTrans418)
argvalue0 := aurora.NewTaskQuery()
err422 := argvalue0.Read(jsProt421)
@ -506,7 +535,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.PruneTasks(value0))
fmt.Print(client.PruneTasks(context.Background(), value0))
fmt.Print("\n")
break
case "createJob":
@ -522,7 +551,7 @@ func main() {
Usage()
return
}
factory426 := thrift.NewTSimpleJSONProtocolFactory()
factory426 := thrift.NewTJSONProtocolFactory()
jsProt427 := factory426.GetProtocol(mbTrans424)
argvalue0 := aurora.NewJobConfiguration()
err428 := argvalue0.Read(jsProt427)
@ -531,7 +560,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.CreateJob(value0))
fmt.Print(client.CreateJob(context.Background(), value0))
fmt.Print("\n")
break
case "scheduleCronJob":
@ -547,7 +576,7 @@ func main() {
Usage()
return
}
factory432 := thrift.NewTSimpleJSONProtocolFactory()
factory432 := thrift.NewTJSONProtocolFactory()
jsProt433 := factory432.GetProtocol(mbTrans430)
argvalue0 := aurora.NewJobConfiguration()
err434 := argvalue0.Read(jsProt433)
@ -556,7 +585,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.ScheduleCronJob(value0))
fmt.Print(client.ScheduleCronJob(context.Background(), value0))
fmt.Print("\n")
break
case "descheduleCronJob":
@ -572,7 +601,7 @@ func main() {
Usage()
return
}
factory438 := thrift.NewTSimpleJSONProtocolFactory()
factory438 := thrift.NewTJSONProtocolFactory()
jsProt439 := factory438.GetProtocol(mbTrans436)
argvalue0 := aurora.NewJobKey()
err440 := argvalue0.Read(jsProt439)
@ -581,7 +610,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.DescheduleCronJob(value0))
fmt.Print(client.DescheduleCronJob(context.Background(), value0))
fmt.Print("\n")
break
case "startCronJob":
@ -597,7 +626,7 @@ func main() {
Usage()
return
}
factory444 := thrift.NewTSimpleJSONProtocolFactory()
factory444 := thrift.NewTJSONProtocolFactory()
jsProt445 := factory444.GetProtocol(mbTrans442)
argvalue0 := aurora.NewJobKey()
err446 := argvalue0.Read(jsProt445)
@ -606,7 +635,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.StartCronJob(value0))
fmt.Print(client.StartCronJob(context.Background(), value0))
fmt.Print("\n")
break
case "restartShards":
@ -622,7 +651,7 @@ func main() {
Usage()
return
}
factory450 := thrift.NewTSimpleJSONProtocolFactory()
factory450 := thrift.NewTJSONProtocolFactory()
jsProt451 := factory450.GetProtocol(mbTrans448)
argvalue0 := aurora.NewJobKey()
err452 := argvalue0.Read(jsProt451)
@ -639,7 +668,7 @@ func main() {
Usage()
return
}
factory456 := thrift.NewTSimpleJSONProtocolFactory()
factory456 := thrift.NewTJSONProtocolFactory()
jsProt457 := factory456.GetProtocol(mbTrans454)
containerStruct1 := aurora.NewAuroraAdminRestartShardsArgs()
err458 := containerStruct1.ReadField2(jsProt457)
@ -649,7 +678,7 @@ func main() {
}
argvalue1 := containerStruct1.ShardIds
value1 := argvalue1
fmt.Print(client.RestartShards(value0, value1))
fmt.Print(client.RestartShards(context.Background(), value0, value1))
fmt.Print("\n")
break
case "killTasks":
@ -665,7 +694,7 @@ func main() {
Usage()
return
}
factory462 := thrift.NewTSimpleJSONProtocolFactory()
factory462 := thrift.NewTJSONProtocolFactory()
jsProt463 := factory462.GetProtocol(mbTrans460)
argvalue0 := aurora.NewJobKey()
err464 := argvalue0.Read(jsProt463)
@ -682,7 +711,7 @@ func main() {
Usage()
return
}
factory468 := thrift.NewTSimpleJSONProtocolFactory()
factory468 := thrift.NewTJSONProtocolFactory()
jsProt469 := factory468.GetProtocol(mbTrans466)
containerStruct1 := aurora.NewAuroraAdminKillTasksArgs()
err470 := containerStruct1.ReadField2(jsProt469)
@ -694,7 +723,7 @@ func main() {
value1 := argvalue1
argvalue2 := flag.Arg(3)
value2 := argvalue2
fmt.Print(client.KillTasks(value0, value1, value2))
fmt.Print(client.KillTasks(context.Background(), value0, value1, value2))
fmt.Print("\n")
break
case "addInstances":
@ -710,7 +739,7 @@ func main() {
Usage()
return
}
factory475 := thrift.NewTSimpleJSONProtocolFactory()
factory475 := thrift.NewTJSONProtocolFactory()
jsProt476 := factory475.GetProtocol(mbTrans473)
argvalue0 := aurora.NewInstanceKey()
err477 := argvalue0.Read(jsProt476)
@ -726,7 +755,7 @@ func main() {
}
argvalue1 := int32(tmp1)
value1 := argvalue1
fmt.Print(client.AddInstances(value0, value1))
fmt.Print(client.AddInstances(context.Background(), value0, value1))
fmt.Print("\n")
break
case "replaceCronTemplate":
@ -742,7 +771,7 @@ func main() {
Usage()
return
}
factory482 := thrift.NewTSimpleJSONProtocolFactory()
factory482 := thrift.NewTJSONProtocolFactory()
jsProt483 := factory482.GetProtocol(mbTrans480)
argvalue0 := aurora.NewJobConfiguration()
err484 := argvalue0.Read(jsProt483)
@ -751,7 +780,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.ReplaceCronTemplate(value0))
fmt.Print(client.ReplaceCronTemplate(context.Background(), value0))
fmt.Print("\n")
break
case "startJobUpdate":
@ -767,7 +796,7 @@ func main() {
Usage()
return
}
factory488 := thrift.NewTSimpleJSONProtocolFactory()
factory488 := thrift.NewTJSONProtocolFactory()
jsProt489 := factory488.GetProtocol(mbTrans486)
argvalue0 := aurora.NewJobUpdateRequest()
err490 := argvalue0.Read(jsProt489)
@ -778,7 +807,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.StartJobUpdate(value0, value1))
fmt.Print(client.StartJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "pauseJobUpdate":
@ -794,7 +823,7 @@ func main() {
Usage()
return
}
factory495 := thrift.NewTSimpleJSONProtocolFactory()
factory495 := thrift.NewTJSONProtocolFactory()
jsProt496 := factory495.GetProtocol(mbTrans493)
argvalue0 := aurora.NewJobUpdateKey()
err497 := argvalue0.Read(jsProt496)
@ -805,7 +834,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.PauseJobUpdate(value0, value1))
fmt.Print(client.PauseJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "resumeJobUpdate":
@ -821,7 +850,7 @@ func main() {
Usage()
return
}
factory502 := thrift.NewTSimpleJSONProtocolFactory()
factory502 := thrift.NewTJSONProtocolFactory()
jsProt503 := factory502.GetProtocol(mbTrans500)
argvalue0 := aurora.NewJobUpdateKey()
err504 := argvalue0.Read(jsProt503)
@ -832,7 +861,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.ResumeJobUpdate(value0, value1))
fmt.Print(client.ResumeJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "abortJobUpdate":
@ -848,7 +877,7 @@ func main() {
Usage()
return
}
factory509 := thrift.NewTSimpleJSONProtocolFactory()
factory509 := thrift.NewTJSONProtocolFactory()
jsProt510 := factory509.GetProtocol(mbTrans507)
argvalue0 := aurora.NewJobUpdateKey()
err511 := argvalue0.Read(jsProt510)
@ -859,7 +888,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.AbortJobUpdate(value0, value1))
fmt.Print(client.AbortJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "rollbackJobUpdate":
@ -875,7 +904,7 @@ func main() {
Usage()
return
}
factory516 := thrift.NewTSimpleJSONProtocolFactory()
factory516 := thrift.NewTJSONProtocolFactory()
jsProt517 := factory516.GetProtocol(mbTrans514)
argvalue0 := aurora.NewJobUpdateKey()
err518 := argvalue0.Read(jsProt517)
@ -886,7 +915,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.RollbackJobUpdate(value0, value1))
fmt.Print(client.RollbackJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "pulseJobUpdate":
@ -902,7 +931,7 @@ func main() {
Usage()
return
}
factory523 := thrift.NewTSimpleJSONProtocolFactory()
factory523 := thrift.NewTJSONProtocolFactory()
jsProt524 := factory523.GetProtocol(mbTrans521)
argvalue0 := aurora.NewJobUpdateKey()
err525 := argvalue0.Read(jsProt524)
@ -911,7 +940,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.PulseJobUpdate(value0))
fmt.Print(client.PulseJobUpdate(context.Background(), value0))
fmt.Print("\n")
break
case "getRoleSummary":
@ -919,7 +948,7 @@ func main() {
fmt.Fprintln(os.Stderr, "GetRoleSummary requires 0 args")
flag.Usage()
}
fmt.Print(client.GetRoleSummary())
fmt.Print(client.GetRoleSummary(context.Background()))
fmt.Print("\n")
break
case "getJobSummary":
@ -929,7 +958,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.GetJobSummary(value0))
fmt.Print(client.GetJobSummary(context.Background(), value0))
fmt.Print("\n")
break
case "getTasksStatus":
@ -945,7 +974,7 @@ func main() {
Usage()
return
}
factory530 := thrift.NewTSimpleJSONProtocolFactory()
factory530 := thrift.NewTJSONProtocolFactory()
jsProt531 := factory530.GetProtocol(mbTrans528)
argvalue0 := aurora.NewTaskQuery()
err532 := argvalue0.Read(jsProt531)
@ -954,7 +983,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetTasksStatus(value0))
fmt.Print(client.GetTasksStatus(context.Background(), value0))
fmt.Print("\n")
break
case "getTasksWithoutConfigs":
@ -970,7 +999,7 @@ func main() {
Usage()
return
}
factory536 := thrift.NewTSimpleJSONProtocolFactory()
factory536 := thrift.NewTJSONProtocolFactory()
jsProt537 := factory536.GetProtocol(mbTrans534)
argvalue0 := aurora.NewTaskQuery()
err538 := argvalue0.Read(jsProt537)
@ -979,7 +1008,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetTasksWithoutConfigs(value0))
fmt.Print(client.GetTasksWithoutConfigs(context.Background(), value0))
fmt.Print("\n")
break
case "getPendingReason":
@ -995,7 +1024,7 @@ func main() {
Usage()
return
}
factory542 := thrift.NewTSimpleJSONProtocolFactory()
factory542 := thrift.NewTJSONProtocolFactory()
jsProt543 := factory542.GetProtocol(mbTrans540)
argvalue0 := aurora.NewTaskQuery()
err544 := argvalue0.Read(jsProt543)
@ -1004,7 +1033,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetPendingReason(value0))
fmt.Print(client.GetPendingReason(context.Background(), value0))
fmt.Print("\n")
break
case "getConfigSummary":
@ -1020,7 +1049,7 @@ func main() {
Usage()
return
}
factory548 := thrift.NewTSimpleJSONProtocolFactory()
factory548 := thrift.NewTJSONProtocolFactory()
jsProt549 := factory548.GetProtocol(mbTrans546)
argvalue0 := aurora.NewJobKey()
err550 := argvalue0.Read(jsProt549)
@ -1029,7 +1058,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetConfigSummary(value0))
fmt.Print(client.GetConfigSummary(context.Background(), value0))
fmt.Print("\n")
break
case "getJobs":
@ -1039,7 +1068,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.GetJobs(value0))
fmt.Print(client.GetJobs(context.Background(), value0))
fmt.Print("\n")
break
case "getQuota":
@ -1049,7 +1078,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.GetQuota(value0))
fmt.Print(client.GetQuota(context.Background(), value0))
fmt.Print("\n")
break
case "populateJobConfig":
@ -1065,7 +1094,7 @@ func main() {
Usage()
return
}
factory556 := thrift.NewTSimpleJSONProtocolFactory()
factory556 := thrift.NewTJSONProtocolFactory()
jsProt557 := factory556.GetProtocol(mbTrans554)
argvalue0 := aurora.NewJobConfiguration()
err558 := argvalue0.Read(jsProt557)
@ -1074,7 +1103,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.PopulateJobConfig(value0))
fmt.Print(client.PopulateJobConfig(context.Background(), value0))
fmt.Print("\n")
break
case "getJobUpdateSummaries":
@ -1090,7 +1119,7 @@ func main() {
Usage()
return
}
factory562 := thrift.NewTSimpleJSONProtocolFactory()
factory562 := thrift.NewTJSONProtocolFactory()
jsProt563 := factory562.GetProtocol(mbTrans560)
argvalue0 := aurora.NewJobUpdateQuery()
err564 := argvalue0.Read(jsProt563)
@ -1099,7 +1128,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetJobUpdateSummaries(value0))
fmt.Print(client.GetJobUpdateSummaries(context.Background(), value0))
fmt.Print("\n")
break
case "getJobUpdateDetails":
@ -1115,7 +1144,7 @@ func main() {
Usage()
return
}
factory568 := thrift.NewTSimpleJSONProtocolFactory()
factory568 := thrift.NewTJSONProtocolFactory()
jsProt569 := factory568.GetProtocol(mbTrans566)
argvalue0 := aurora.NewJobUpdateQuery()
err570 := argvalue0.Read(jsProt569)
@ -1124,7 +1153,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetJobUpdateDetails(value0))
fmt.Print(client.GetJobUpdateDetails(context.Background(), value0))
fmt.Print("\n")
break
case "getJobUpdateDiff":
@ -1140,7 +1169,7 @@ func main() {
Usage()
return
}
factory574 := thrift.NewTSimpleJSONProtocolFactory()
factory574 := thrift.NewTJSONProtocolFactory()
jsProt575 := factory574.GetProtocol(mbTrans572)
argvalue0 := aurora.NewJobUpdateRequest()
err576 := argvalue0.Read(jsProt575)
@ -1149,7 +1178,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetJobUpdateDiff(value0))
fmt.Print(client.GetJobUpdateDiff(context.Background(), value0))
fmt.Print("\n")
break
case "getTierConfigs":
@ -1157,7 +1186,7 @@ func main() {
fmt.Fprintln(os.Stderr, "GetTierConfigs requires 0 args")
flag.Usage()
}
fmt.Print(client.GetTierConfigs())
fmt.Print(client.GetTierConfigs(context.Background()))
fmt.Print("\n")
break
case "":

View file

@ -1,19 +1,21 @@
// Autogenerated by Thrift Compiler (0.9.3)
// Autogenerated by Thrift Compiler (0.12.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
package main
import (
"apache/aurora"
"context"
"flag"
"fmt"
"git.apache.org/thrift.git/lib/go/thrift"
"math"
"net"
"net/url"
"os"
"strconv"
"strings"
"git.apache.org/thrift.git/lib/go/thrift"
)
func Usage() {
@ -51,6 +53,22 @@ func Usage() {
os.Exit(0)
}
type httpHeaders map[string]string
func (h httpHeaders) String() string {
var m map[string]string = h
return fmt.Sprintf("%s", m)
}
func (h httpHeaders) Set(value string) error {
parts := strings.Split(value, ": ")
if len(parts) != 2 {
return fmt.Errorf("header should be of format 'Key: Value'")
}
h[parts[0]] = parts[1]
return nil
}
func main() {
flag.Usage = Usage
var host string
@ -59,7 +77,8 @@ func main() {
var urlString string
var framed bool
var useHttp bool
var parsedUrl url.URL
headers := make(httpHeaders)
var parsedUrl *url.URL
var trans thrift.TTransport
_ = strconv.Atoi
_ = math.Abs
@ -70,16 +89,18 @@ func main() {
flag.StringVar(&urlString, "u", "", "Specify the url")
flag.BoolVar(&framed, "framed", false, "Use framed transport")
flag.BoolVar(&useHttp, "http", false, "Use http")
flag.Var(headers, "H", "Headers to set on the http(s) request (e.g. -H \"Key: Value\")")
flag.Parse()
if len(urlString) > 0 {
parsedUrl, err := url.Parse(urlString)
var err error
parsedUrl, err = url.Parse(urlString)
if err != nil {
fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
flag.Usage()
}
host = parsedUrl.Host
useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" || parsedUrl.Scheme == "https"
} else if useHttp {
_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
if err != nil {
@ -92,6 +113,12 @@ func main() {
var err error
if useHttp {
trans, err = thrift.NewTHttpClient(parsedUrl.String())
if len(headers) > 0 {
httptrans := trans.(*thrift.THttpClient)
for key, value := range headers {
httptrans.SetHeader(key, value)
}
}
} else {
portStr := fmt.Sprint(port)
if strings.Contains(host, ":") {
@ -134,7 +161,9 @@ func main() {
Usage()
os.Exit(1)
}
client := aurora.NewAuroraSchedulerManagerClientFactory(trans, protocolFactory)
iprot := protocolFactory.GetProtocol(trans)
oprot := protocolFactory.GetProtocol(trans)
client := aurora.NewAuroraSchedulerManagerClient(thrift.NewTStandardClient(iprot, oprot))
if err := trans.Open(); err != nil {
fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
os.Exit(1)
@ -154,7 +183,7 @@ func main() {
Usage()
return
}
factory165 := thrift.NewTSimpleJSONProtocolFactory()
factory165 := thrift.NewTJSONProtocolFactory()
jsProt166 := factory165.GetProtocol(mbTrans163)
argvalue0 := aurora.NewJobConfiguration()
err167 := argvalue0.Read(jsProt166)
@ -163,7 +192,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.CreateJob(value0))
fmt.Print(client.CreateJob(context.Background(), value0))
fmt.Print("\n")
break
case "scheduleCronJob":
@ -179,7 +208,7 @@ func main() {
Usage()
return
}
factory171 := thrift.NewTSimpleJSONProtocolFactory()
factory171 := thrift.NewTJSONProtocolFactory()
jsProt172 := factory171.GetProtocol(mbTrans169)
argvalue0 := aurora.NewJobConfiguration()
err173 := argvalue0.Read(jsProt172)
@ -188,7 +217,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.ScheduleCronJob(value0))
fmt.Print(client.ScheduleCronJob(context.Background(), value0))
fmt.Print("\n")
break
case "descheduleCronJob":
@ -204,7 +233,7 @@ func main() {
Usage()
return
}
factory177 := thrift.NewTSimpleJSONProtocolFactory()
factory177 := thrift.NewTJSONProtocolFactory()
jsProt178 := factory177.GetProtocol(mbTrans175)
argvalue0 := aurora.NewJobKey()
err179 := argvalue0.Read(jsProt178)
@ -213,7 +242,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.DescheduleCronJob(value0))
fmt.Print(client.DescheduleCronJob(context.Background(), value0))
fmt.Print("\n")
break
case "startCronJob":
@ -229,7 +258,7 @@ func main() {
Usage()
return
}
factory183 := thrift.NewTSimpleJSONProtocolFactory()
factory183 := thrift.NewTJSONProtocolFactory()
jsProt184 := factory183.GetProtocol(mbTrans181)
argvalue0 := aurora.NewJobKey()
err185 := argvalue0.Read(jsProt184)
@ -238,7 +267,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.StartCronJob(value0))
fmt.Print(client.StartCronJob(context.Background(), value0))
fmt.Print("\n")
break
case "restartShards":
@ -254,7 +283,7 @@ func main() {
Usage()
return
}
factory189 := thrift.NewTSimpleJSONProtocolFactory()
factory189 := thrift.NewTJSONProtocolFactory()
jsProt190 := factory189.GetProtocol(mbTrans187)
argvalue0 := aurora.NewJobKey()
err191 := argvalue0.Read(jsProt190)
@ -271,7 +300,7 @@ func main() {
Usage()
return
}
factory195 := thrift.NewTSimpleJSONProtocolFactory()
factory195 := thrift.NewTJSONProtocolFactory()
jsProt196 := factory195.GetProtocol(mbTrans193)
containerStruct1 := aurora.NewAuroraSchedulerManagerRestartShardsArgs()
err197 := containerStruct1.ReadField2(jsProt196)
@ -281,7 +310,7 @@ func main() {
}
argvalue1 := containerStruct1.ShardIds
value1 := argvalue1
fmt.Print(client.RestartShards(value0, value1))
fmt.Print(client.RestartShards(context.Background(), value0, value1))
fmt.Print("\n")
break
case "killTasks":
@ -297,7 +326,7 @@ func main() {
Usage()
return
}
factory201 := thrift.NewTSimpleJSONProtocolFactory()
factory201 := thrift.NewTJSONProtocolFactory()
jsProt202 := factory201.GetProtocol(mbTrans199)
argvalue0 := aurora.NewJobKey()
err203 := argvalue0.Read(jsProt202)
@ -314,7 +343,7 @@ func main() {
Usage()
return
}
factory207 := thrift.NewTSimpleJSONProtocolFactory()
factory207 := thrift.NewTJSONProtocolFactory()
jsProt208 := factory207.GetProtocol(mbTrans205)
containerStruct1 := aurora.NewAuroraSchedulerManagerKillTasksArgs()
err209 := containerStruct1.ReadField2(jsProt208)
@ -326,7 +355,7 @@ func main() {
value1 := argvalue1
argvalue2 := flag.Arg(3)
value2 := argvalue2
fmt.Print(client.KillTasks(value0, value1, value2))
fmt.Print(client.KillTasks(context.Background(), value0, value1, value2))
fmt.Print("\n")
break
case "addInstances":
@ -342,7 +371,7 @@ func main() {
Usage()
return
}
factory214 := thrift.NewTSimpleJSONProtocolFactory()
factory214 := thrift.NewTJSONProtocolFactory()
jsProt215 := factory214.GetProtocol(mbTrans212)
argvalue0 := aurora.NewInstanceKey()
err216 := argvalue0.Read(jsProt215)
@ -358,7 +387,7 @@ func main() {
}
argvalue1 := int32(tmp1)
value1 := argvalue1
fmt.Print(client.AddInstances(value0, value1))
fmt.Print(client.AddInstances(context.Background(), value0, value1))
fmt.Print("\n")
break
case "replaceCronTemplate":
@ -374,7 +403,7 @@ func main() {
Usage()
return
}
factory221 := thrift.NewTSimpleJSONProtocolFactory()
factory221 := thrift.NewTJSONProtocolFactory()
jsProt222 := factory221.GetProtocol(mbTrans219)
argvalue0 := aurora.NewJobConfiguration()
err223 := argvalue0.Read(jsProt222)
@ -383,7 +412,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.ReplaceCronTemplate(value0))
fmt.Print(client.ReplaceCronTemplate(context.Background(), value0))
fmt.Print("\n")
break
case "startJobUpdate":
@ -399,7 +428,7 @@ func main() {
Usage()
return
}
factory227 := thrift.NewTSimpleJSONProtocolFactory()
factory227 := thrift.NewTJSONProtocolFactory()
jsProt228 := factory227.GetProtocol(mbTrans225)
argvalue0 := aurora.NewJobUpdateRequest()
err229 := argvalue0.Read(jsProt228)
@ -410,7 +439,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.StartJobUpdate(value0, value1))
fmt.Print(client.StartJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "pauseJobUpdate":
@ -426,7 +455,7 @@ func main() {
Usage()
return
}
factory234 := thrift.NewTSimpleJSONProtocolFactory()
factory234 := thrift.NewTJSONProtocolFactory()
jsProt235 := factory234.GetProtocol(mbTrans232)
argvalue0 := aurora.NewJobUpdateKey()
err236 := argvalue0.Read(jsProt235)
@ -437,7 +466,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.PauseJobUpdate(value0, value1))
fmt.Print(client.PauseJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "resumeJobUpdate":
@ -453,7 +482,7 @@ func main() {
Usage()
return
}
factory241 := thrift.NewTSimpleJSONProtocolFactory()
factory241 := thrift.NewTJSONProtocolFactory()
jsProt242 := factory241.GetProtocol(mbTrans239)
argvalue0 := aurora.NewJobUpdateKey()
err243 := argvalue0.Read(jsProt242)
@ -464,7 +493,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.ResumeJobUpdate(value0, value1))
fmt.Print(client.ResumeJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "abortJobUpdate":
@ -480,7 +509,7 @@ func main() {
Usage()
return
}
factory248 := thrift.NewTSimpleJSONProtocolFactory()
factory248 := thrift.NewTJSONProtocolFactory()
jsProt249 := factory248.GetProtocol(mbTrans246)
argvalue0 := aurora.NewJobUpdateKey()
err250 := argvalue0.Read(jsProt249)
@ -491,7 +520,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.AbortJobUpdate(value0, value1))
fmt.Print(client.AbortJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "rollbackJobUpdate":
@ -507,7 +536,7 @@ func main() {
Usage()
return
}
factory255 := thrift.NewTSimpleJSONProtocolFactory()
factory255 := thrift.NewTJSONProtocolFactory()
jsProt256 := factory255.GetProtocol(mbTrans253)
argvalue0 := aurora.NewJobUpdateKey()
err257 := argvalue0.Read(jsProt256)
@ -518,7 +547,7 @@ func main() {
value0 := argvalue0
argvalue1 := flag.Arg(2)
value1 := argvalue1
fmt.Print(client.RollbackJobUpdate(value0, value1))
fmt.Print(client.RollbackJobUpdate(context.Background(), value0, value1))
fmt.Print("\n")
break
case "pulseJobUpdate":
@ -534,7 +563,7 @@ func main() {
Usage()
return
}
factory262 := thrift.NewTSimpleJSONProtocolFactory()
factory262 := thrift.NewTJSONProtocolFactory()
jsProt263 := factory262.GetProtocol(mbTrans260)
argvalue0 := aurora.NewJobUpdateKey()
err264 := argvalue0.Read(jsProt263)
@ -543,7 +572,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.PulseJobUpdate(value0))
fmt.Print(client.PulseJobUpdate(context.Background(), value0))
fmt.Print("\n")
break
case "getRoleSummary":
@ -551,7 +580,7 @@ func main() {
fmt.Fprintln(os.Stderr, "GetRoleSummary requires 0 args")
flag.Usage()
}
fmt.Print(client.GetRoleSummary())
fmt.Print(client.GetRoleSummary(context.Background()))
fmt.Print("\n")
break
case "getJobSummary":
@ -561,7 +590,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.GetJobSummary(value0))
fmt.Print(client.GetJobSummary(context.Background(), value0))
fmt.Print("\n")
break
case "getTasksStatus":
@ -577,7 +606,7 @@ func main() {
Usage()
return
}
factory269 := thrift.NewTSimpleJSONProtocolFactory()
factory269 := thrift.NewTJSONProtocolFactory()
jsProt270 := factory269.GetProtocol(mbTrans267)
argvalue0 := aurora.NewTaskQuery()
err271 := argvalue0.Read(jsProt270)
@ -586,7 +615,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetTasksStatus(value0))
fmt.Print(client.GetTasksStatus(context.Background(), value0))
fmt.Print("\n")
break
case "getTasksWithoutConfigs":
@ -602,7 +631,7 @@ func main() {
Usage()
return
}
factory275 := thrift.NewTSimpleJSONProtocolFactory()
factory275 := thrift.NewTJSONProtocolFactory()
jsProt276 := factory275.GetProtocol(mbTrans273)
argvalue0 := aurora.NewTaskQuery()
err277 := argvalue0.Read(jsProt276)
@ -611,7 +640,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetTasksWithoutConfigs(value0))
fmt.Print(client.GetTasksWithoutConfigs(context.Background(), value0))
fmt.Print("\n")
break
case "getPendingReason":
@ -627,7 +656,7 @@ func main() {
Usage()
return
}
factory281 := thrift.NewTSimpleJSONProtocolFactory()
factory281 := thrift.NewTJSONProtocolFactory()
jsProt282 := factory281.GetProtocol(mbTrans279)
argvalue0 := aurora.NewTaskQuery()
err283 := argvalue0.Read(jsProt282)
@ -636,7 +665,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetPendingReason(value0))
fmt.Print(client.GetPendingReason(context.Background(), value0))
fmt.Print("\n")
break
case "getConfigSummary":
@ -652,7 +681,7 @@ func main() {
Usage()
return
}
factory287 := thrift.NewTSimpleJSONProtocolFactory()
factory287 := thrift.NewTJSONProtocolFactory()
jsProt288 := factory287.GetProtocol(mbTrans285)
argvalue0 := aurora.NewJobKey()
err289 := argvalue0.Read(jsProt288)
@ -661,7 +690,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetConfigSummary(value0))
fmt.Print(client.GetConfigSummary(context.Background(), value0))
fmt.Print("\n")
break
case "getJobs":
@ -671,7 +700,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.GetJobs(value0))
fmt.Print(client.GetJobs(context.Background(), value0))
fmt.Print("\n")
break
case "getQuota":
@ -681,7 +710,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.GetQuota(value0))
fmt.Print(client.GetQuota(context.Background(), value0))
fmt.Print("\n")
break
case "populateJobConfig":
@ -697,7 +726,7 @@ func main() {
Usage()
return
}
factory295 := thrift.NewTSimpleJSONProtocolFactory()
factory295 := thrift.NewTJSONProtocolFactory()
jsProt296 := factory295.GetProtocol(mbTrans293)
argvalue0 := aurora.NewJobConfiguration()
err297 := argvalue0.Read(jsProt296)
@ -706,7 +735,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.PopulateJobConfig(value0))
fmt.Print(client.PopulateJobConfig(context.Background(), value0))
fmt.Print("\n")
break
case "getJobUpdateSummaries":
@ -722,7 +751,7 @@ func main() {
Usage()
return
}
factory301 := thrift.NewTSimpleJSONProtocolFactory()
factory301 := thrift.NewTJSONProtocolFactory()
jsProt302 := factory301.GetProtocol(mbTrans299)
argvalue0 := aurora.NewJobUpdateQuery()
err303 := argvalue0.Read(jsProt302)
@ -731,7 +760,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetJobUpdateSummaries(value0))
fmt.Print(client.GetJobUpdateSummaries(context.Background(), value0))
fmt.Print("\n")
break
case "getJobUpdateDetails":
@ -747,7 +776,7 @@ func main() {
Usage()
return
}
factory307 := thrift.NewTSimpleJSONProtocolFactory()
factory307 := thrift.NewTJSONProtocolFactory()
jsProt308 := factory307.GetProtocol(mbTrans305)
argvalue0 := aurora.NewJobUpdateQuery()
err309 := argvalue0.Read(jsProt308)
@ -756,7 +785,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetJobUpdateDetails(value0))
fmt.Print(client.GetJobUpdateDetails(context.Background(), value0))
fmt.Print("\n")
break
case "getJobUpdateDiff":
@ -772,7 +801,7 @@ func main() {
Usage()
return
}
factory313 := thrift.NewTSimpleJSONProtocolFactory()
factory313 := thrift.NewTJSONProtocolFactory()
jsProt314 := factory313.GetProtocol(mbTrans311)
argvalue0 := aurora.NewJobUpdateRequest()
err315 := argvalue0.Read(jsProt314)
@ -781,7 +810,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetJobUpdateDiff(value0))
fmt.Print(client.GetJobUpdateDiff(context.Background(), value0))
fmt.Print("\n")
break
case "getTierConfigs":
@ -789,7 +818,7 @@ func main() {
fmt.Fprintln(os.Stderr, "GetTierConfigs requires 0 args")
flag.Usage()
}
fmt.Print(client.GetTierConfigs())
fmt.Print(client.GetTierConfigs(context.Background()))
fmt.Print("\n")
break
case "":

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,89 +0,0 @@
// Autogenerated by Thrift Compiler (0.9.3)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
package aurora
import (
"bytes"
"fmt"
"git.apache.org/thrift.git/lib/go/thrift"
)
// (needed to ensure safety because of naive import list construction.)
var _ = thrift.ZERO
var _ = fmt.Printf
var _ = bytes.Equal
const AURORA_EXECUTOR_NAME = "AuroraExecutor"
var ACTIVE_STATES map[ScheduleStatus]bool
var SLAVE_ASSIGNED_STATES map[ScheduleStatus]bool
var LIVE_STATES map[ScheduleStatus]bool
var TERMINAL_STATES map[ScheduleStatus]bool
const GOOD_IDENTIFIER_PATTERN = "^[\\w\\-\\.]+$"
const GOOD_IDENTIFIER_PATTERN_JVM = "^[\\w\\-\\.]+$"
const GOOD_IDENTIFIER_PATTERN_PYTHON = "^[\\w\\-\\.]+$"
var ACTIVE_JOB_UPDATE_STATES map[JobUpdateStatus]bool
var AWAITNG_PULSE_JOB_UPDATE_STATES map[JobUpdateStatus]bool
const BYPASS_LEADER_REDIRECT_HEADER_NAME = "Bypass-Leader-Redirect"
const TASK_FILESYSTEM_MOUNT_POINT = "taskfs"
func init() {
ACTIVE_STATES = map[ScheduleStatus]bool{
9: true,
17: true,
6: true,
0: true,
13: true,
12: true,
2: true,
1: true,
18: true,
16: true,
}
SLAVE_ASSIGNED_STATES = map[ScheduleStatus]bool{
9: true,
17: true,
6: true,
13: true,
12: true,
2: true,
18: true,
1: true,
}
LIVE_STATES = map[ScheduleStatus]bool{
6: true,
13: true,
12: true,
17: true,
18: true,
2: true,
}
TERMINAL_STATES = map[ScheduleStatus]bool{
4: true,
3: true,
5: true,
7: true,
}
ACTIVE_JOB_UPDATE_STATES = map[JobUpdateStatus]bool{
0: true,
1: true,
2: true,
3: true,
9: true,
10: true,
}
AWAITNG_PULSE_JOB_UPDATE_STATES = map[JobUpdateStatus]bool{
9: true,
10: true,
}
}

View file

@ -1,19 +1,21 @@
// Autogenerated by Thrift Compiler (0.9.3)
// Autogenerated by Thrift Compiler (0.12.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
package main
import (
"apache/aurora"
"context"
"flag"
"fmt"
"git.apache.org/thrift.git/lib/go/thrift"
"math"
"net"
"net/url"
"os"
"strconv"
"strings"
"git.apache.org/thrift.git/lib/go/thrift"
)
func Usage() {
@ -37,6 +39,22 @@ func Usage() {
os.Exit(0)
}
type httpHeaders map[string]string
func (h httpHeaders) String() string {
var m map[string]string = h
return fmt.Sprintf("%s", m)
}
func (h httpHeaders) Set(value string) error {
parts := strings.Split(value, ": ")
if len(parts) != 2 {
return fmt.Errorf("header should be of format 'Key: Value'")
}
h[parts[0]] = parts[1]
return nil
}
func main() {
flag.Usage = Usage
var host string
@ -45,7 +63,8 @@ func main() {
var urlString string
var framed bool
var useHttp bool
var parsedUrl url.URL
headers := make(httpHeaders)
var parsedUrl *url.URL
var trans thrift.TTransport
_ = strconv.Atoi
_ = math.Abs
@ -56,16 +75,18 @@ func main() {
flag.StringVar(&urlString, "u", "", "Specify the url")
flag.BoolVar(&framed, "framed", false, "Use framed transport")
flag.BoolVar(&useHttp, "http", false, "Use http")
flag.Var(headers, "H", "Headers to set on the http(s) request (e.g. -H \"Key: Value\")")
flag.Parse()
if len(urlString) > 0 {
parsedUrl, err := url.Parse(urlString)
var err error
parsedUrl, err = url.Parse(urlString)
if err != nil {
fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
flag.Usage()
}
host = parsedUrl.Host
useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http" || parsedUrl.Scheme == "https"
} else if useHttp {
_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
if err != nil {
@ -78,6 +99,12 @@ func main() {
var err error
if useHttp {
trans, err = thrift.NewTHttpClient(parsedUrl.String())
if len(headers) > 0 {
httptrans := trans.(*thrift.THttpClient)
for key, value := range headers {
httptrans.SetHeader(key, value)
}
}
} else {
portStr := fmt.Sprint(port)
if strings.Contains(host, ":") {
@ -120,7 +147,9 @@ func main() {
Usage()
os.Exit(1)
}
client := aurora.NewReadOnlySchedulerClientFactory(trans, protocolFactory)
iprot := protocolFactory.GetProtocol(trans)
oprot := protocolFactory.GetProtocol(trans)
client := aurora.NewReadOnlySchedulerClient(thrift.NewTStandardClient(iprot, oprot))
if err := trans.Open(); err != nil {
fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
os.Exit(1)
@ -132,7 +161,7 @@ func main() {
fmt.Fprintln(os.Stderr, "GetRoleSummary requires 0 args")
flag.Usage()
}
fmt.Print(client.GetRoleSummary())
fmt.Print(client.GetRoleSummary(context.Background()))
fmt.Print("\n")
break
case "getJobSummary":
@ -142,7 +171,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.GetJobSummary(value0))
fmt.Print(client.GetJobSummary(context.Background(), value0))
fmt.Print("\n")
break
case "getTasksStatus":
@ -158,7 +187,7 @@ func main() {
Usage()
return
}
factory84 := thrift.NewTSimpleJSONProtocolFactory()
factory84 := thrift.NewTJSONProtocolFactory()
jsProt85 := factory84.GetProtocol(mbTrans82)
argvalue0 := aurora.NewTaskQuery()
err86 := argvalue0.Read(jsProt85)
@ -167,7 +196,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetTasksStatus(value0))
fmt.Print(client.GetTasksStatus(context.Background(), value0))
fmt.Print("\n")
break
case "getTasksWithoutConfigs":
@ -183,7 +212,7 @@ func main() {
Usage()
return
}
factory90 := thrift.NewTSimpleJSONProtocolFactory()
factory90 := thrift.NewTJSONProtocolFactory()
jsProt91 := factory90.GetProtocol(mbTrans88)
argvalue0 := aurora.NewTaskQuery()
err92 := argvalue0.Read(jsProt91)
@ -192,7 +221,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetTasksWithoutConfigs(value0))
fmt.Print(client.GetTasksWithoutConfigs(context.Background(), value0))
fmt.Print("\n")
break
case "getPendingReason":
@ -208,7 +237,7 @@ func main() {
Usage()
return
}
factory96 := thrift.NewTSimpleJSONProtocolFactory()
factory96 := thrift.NewTJSONProtocolFactory()
jsProt97 := factory96.GetProtocol(mbTrans94)
argvalue0 := aurora.NewTaskQuery()
err98 := argvalue0.Read(jsProt97)
@ -217,7 +246,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetPendingReason(value0))
fmt.Print(client.GetPendingReason(context.Background(), value0))
fmt.Print("\n")
break
case "getConfigSummary":
@ -233,7 +262,7 @@ func main() {
Usage()
return
}
factory102 := thrift.NewTSimpleJSONProtocolFactory()
factory102 := thrift.NewTJSONProtocolFactory()
jsProt103 := factory102.GetProtocol(mbTrans100)
argvalue0 := aurora.NewJobKey()
err104 := argvalue0.Read(jsProt103)
@ -242,7 +271,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetConfigSummary(value0))
fmt.Print(client.GetConfigSummary(context.Background(), value0))
fmt.Print("\n")
break
case "getJobs":
@ -252,7 +281,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.GetJobs(value0))
fmt.Print(client.GetJobs(context.Background(), value0))
fmt.Print("\n")
break
case "getQuota":
@ -262,7 +291,7 @@ func main() {
}
argvalue0 := flag.Arg(1)
value0 := argvalue0
fmt.Print(client.GetQuota(value0))
fmt.Print(client.GetQuota(context.Background(), value0))
fmt.Print("\n")
break
case "populateJobConfig":
@ -278,7 +307,7 @@ func main() {
Usage()
return
}
factory110 := thrift.NewTSimpleJSONProtocolFactory()
factory110 := thrift.NewTJSONProtocolFactory()
jsProt111 := factory110.GetProtocol(mbTrans108)
argvalue0 := aurora.NewJobConfiguration()
err112 := argvalue0.Read(jsProt111)
@ -287,7 +316,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.PopulateJobConfig(value0))
fmt.Print(client.PopulateJobConfig(context.Background(), value0))
fmt.Print("\n")
break
case "getJobUpdateSummaries":
@ -303,7 +332,7 @@ func main() {
Usage()
return
}
factory116 := thrift.NewTSimpleJSONProtocolFactory()
factory116 := thrift.NewTJSONProtocolFactory()
jsProt117 := factory116.GetProtocol(mbTrans114)
argvalue0 := aurora.NewJobUpdateQuery()
err118 := argvalue0.Read(jsProt117)
@ -312,7 +341,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetJobUpdateSummaries(value0))
fmt.Print(client.GetJobUpdateSummaries(context.Background(), value0))
fmt.Print("\n")
break
case "getJobUpdateDetails":
@ -328,7 +357,7 @@ func main() {
Usage()
return
}
factory122 := thrift.NewTSimpleJSONProtocolFactory()
factory122 := thrift.NewTJSONProtocolFactory()
jsProt123 := factory122.GetProtocol(mbTrans120)
argvalue0 := aurora.NewJobUpdateQuery()
err124 := argvalue0.Read(jsProt123)
@ -337,7 +366,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetJobUpdateDetails(value0))
fmt.Print(client.GetJobUpdateDetails(context.Background(), value0))
fmt.Print("\n")
break
case "getJobUpdateDiff":
@ -353,7 +382,7 @@ func main() {
Usage()
return
}
factory128 := thrift.NewTSimpleJSONProtocolFactory()
factory128 := thrift.NewTJSONProtocolFactory()
jsProt129 := factory128.GetProtocol(mbTrans126)
argvalue0 := aurora.NewJobUpdateRequest()
err130 := argvalue0.Read(jsProt129)
@ -362,7 +391,7 @@ func main() {
return
}
value0 := argvalue0
fmt.Print(client.GetJobUpdateDiff(value0))
fmt.Print(client.GetJobUpdateDiff(context.Background(), value0))
fmt.Print("\n")
break
case "getTierConfigs":
@ -370,7 +399,7 @@ func main() {
fmt.Fprintln(os.Stderr, "GetTierConfigs requires 0 args")
flag.Usage()
}
fmt.Print(client.GetTierConfigs())
fmt.Print(client.GetTierConfigs(context.Background()))
fmt.Print("\n")
break
case "":

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
#! /bin/bash
THRIFT_VER=0.9.3
THRIFT_VER=0.12.0
if [[ $(thrift -version | grep -e $THRIFT_VER -c) -ne 1 ]]; then
echo "Warning: This wrapper has only been tested with version" $THRIFT_VER;

10
go.mod Normal file
View file

@ -0,0 +1,10 @@
module github.com/paypal/gorealis/v2
require (
git.apache.org/thrift.git v0.12.0
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a
github.com/stretchr/testify v1.2.0
)

12
go.sum Normal file
View file

@ -0,0 +1,12 @@
git.apache.org/thrift.git v0.12.0 h1:692K1/SsOcQvkvMRMdt60FCq2AvKpuQNM6sIeH3mN4s=
git.apache.org/thrift.git v0.12.0/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e h1:+RHxT/gm0O3UF7nLJbdNzAmULvCFt4XfXHWzh3XI/zs=
github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a h1:EYL2xz/Zdo0hyqdZMXR4lmT2O11jDLTPCEqIe/FR6W4=
github.com/samuel/go-zookeeper v0.0.0-20171117190445-471cd4e61d7a/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/stretchr/testify v1.2.0 h1:LThGCOvhuJic9Gyd1VBCkhyUXmO8vKaBFvBsJ2k03rg=
github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=

319
job.go
View file

@ -15,180 +15,73 @@
package realis
import (
"strconv"
"github.com/paypal/gorealis/gen-go/apache/aurora"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
)
type Job interface {
// Set Job Key environment.
Environment(env string) Job
Role(role string) Job
Name(name string) Job
CPU(cpus float64) Job
CronSchedule(cron string) Job
CronCollisionPolicy(policy aurora.CronCollisionPolicy) Job
Disk(disk int64) Job
RAM(ram int64) Job
ExecutorName(name string) Job
ExecutorData(data string) Job
AddPorts(num int) Job
AddLabel(key string, value string) Job
AddNamedPorts(names ...string) Job
AddLimitConstraint(name string, limit int32) Job
AddValueConstraint(name string, negated bool, values ...string) Job
// From Aurora Docs:
// dedicated attribute. Aurora treats this specially, and only allows matching jobs
// to run on these machines, and will only schedule matching jobs on these machines.
// When a job is created, the scheduler requires that the $role component matches
// the role field in the job configuration, and will reject the job creation otherwise.
// A wildcard (*) may be used for the role portion of the dedicated attribute, which
// will allow any owner to elect for a job to run on the host(s)
AddDedicatedConstraint(role, name string) Job
AddURIs(extract bool, cache bool, values ...string) Job
JobKey() *aurora.JobKey
JobConfig() *aurora.JobConfiguration
TaskConfig() *aurora.TaskConfig
IsService(isService bool) Job
InstanceCount(instCount int32) Job
GetInstanceCount() int32
MaxFailure(maxFail int32) Job
Container(container Container) Job
}
// Structure to collect all information pertaining to an Aurora job.
type AuroraJob struct {
jobConfig *aurora.JobConfiguration
resources map[string]*aurora.Resource
portCount int
task *AuroraTask
}
// Create a Job object with everything initialized.
func NewJob() Job {
jobConfig := aurora.NewJobConfiguration()
taskConfig := aurora.NewTaskConfig()
jobKey := aurora.NewJobKey()
// Create a AuroraJob object with everything initialized.
func NewJob() *AuroraJob {
// Job Config
jobConfig.Key = jobKey
jobConfig.TaskConfig = taskConfig
jobKey := &aurora.JobKey{}
// Task Config
taskConfig.Job = jobKey
taskConfig.Container = aurora.NewContainer()
taskConfig.Container.Mesos = aurora.NewMesosContainer()
taskConfig.MesosFetcherUris = make(map[*aurora.MesosFetcherURI]bool)
taskConfig.Metadata = make(map[*aurora.Metadata]bool)
taskConfig.Constraints = make(map[*aurora.Constraint]bool)
// AuroraTask clientConfig
task := NewTask()
task.task.Job = jobKey
// Resources
numCpus := aurora.NewResource()
ramMb := aurora.NewResource()
diskMb := aurora.NewResource()
resources := make(map[string]*aurora.Resource)
resources["cpu"] = numCpus
resources["ram"] = ramMb
resources["disk"] = diskMb
taskConfig.Resources = make(map[*aurora.Resource]bool)
taskConfig.Resources[numCpus] = true
taskConfig.Resources[ramMb] = true
taskConfig.Resources[diskMb] = true
numCpus.NumCpus = new(float64)
ramMb.RamMb = new(int64)
diskMb.DiskMb = new(int64)
// AuroraJob clientConfig
jobConfig := &aurora.JobConfiguration{
Key: jobKey,
TaskConfig: task.TaskConfig(),
}
return &AuroraJob{
jobConfig: jobConfig,
resources: resources,
portCount: 0,
task: task,
}
}
// Set Job Key environment.
func (j *AuroraJob) Environment(env string) Job {
// Set AuroraJob Key environment. Explicit changes to AuroraTask's job key are not needed
// because they share a pointer to the same JobKey.
func (j *AuroraJob) Environment(env string) *AuroraJob {
j.jobConfig.Key.Environment = env
return j
}
// Set Job Key Role.
func (j *AuroraJob) Role(role string) Job {
// Set AuroraJob Key Role.
func (j *AuroraJob) Role(role string) *AuroraJob {
j.jobConfig.Key.Role = role
//Will be deprecated
// Will be deprecated
identity := &aurora.Identity{User: role}
j.jobConfig.Owner = identity
j.jobConfig.TaskConfig.Owner = identity
return j
}
// Set Job Key Name.
func (j *AuroraJob) Name(name string) Job {
// Set AuroraJob Key Name.
func (j *AuroraJob) Name(name string) *AuroraJob {
j.jobConfig.Key.Name = name
return j
}
// Set name of the executor that will the task will be configured to.
func (j *AuroraJob) ExecutorName(name string) Job {
if j.jobConfig.TaskConfig.ExecutorConfig == nil {
j.jobConfig.TaskConfig.ExecutorConfig = aurora.NewExecutorConfig()
}
j.jobConfig.TaskConfig.ExecutorConfig.Name = name
return j
}
// Will be included as part of entire task inside the scheduler that will be serialized.
func (j *AuroraJob) ExecutorData(data string) Job {
if j.jobConfig.TaskConfig.ExecutorConfig == nil {
j.jobConfig.TaskConfig.ExecutorConfig = aurora.NewExecutorConfig()
}
j.jobConfig.TaskConfig.ExecutorConfig.Data = data
return j
}
func (j *AuroraJob) CPU(cpus float64) Job {
*j.resources["cpu"].NumCpus = cpus
return j
}
func (j *AuroraJob) RAM(ram int64) Job {
*j.resources["ram"].RamMb = ram
return j
}
func (j *AuroraJob) Disk(disk int64) Job {
*j.resources["disk"].DiskMb = disk
return j
}
// How many failures to tolerate before giving up.
func (j *AuroraJob) MaxFailure(maxFail int32) Job {
j.jobConfig.TaskConfig.MaxTaskFailures = maxFail
return j
}
// How many instances of the job to run
func (j *AuroraJob) InstanceCount(instCount int32) Job {
func (j *AuroraJob) InstanceCount(instCount int32) *AuroraJob {
j.jobConfig.InstanceCount = instCount
return j
}
func (j *AuroraJob) CronSchedule(cron string) Job {
func (j *AuroraJob) CronSchedule(cron string) *AuroraJob {
j.jobConfig.CronSchedule = &cron
return j
}
func (j *AuroraJob) CronCollisionPolicy(policy aurora.CronCollisionPolicy) Job {
func (j *AuroraJob) CronCollisionPolicy(policy aurora.CronCollisionPolicy) *AuroraJob {
j.jobConfig.CronCollisionPolicy = policy
return j
}
@ -198,15 +91,9 @@ func (j *AuroraJob) GetInstanceCount() int32 {
return j.jobConfig.InstanceCount
}
// Restart the job's tasks if they fail
func (j *AuroraJob) IsService(isService bool) Job {
j.jobConfig.TaskConfig.IsService = isService
return j
}
// Get the current job configurations key to use for some realis calls.
func (j *AuroraJob) JobKey() *aurora.JobKey {
return j.jobConfig.Key
func (j *AuroraJob) JobKey() aurora.JobKey {
return *j.jobConfig.Key
}
// Get the current job configurations key to use for some realis calls.
@ -214,104 +101,104 @@ func (j *AuroraJob) JobConfig() *aurora.JobConfiguration {
return j.jobConfig
}
// Get the current job configurations key to use for some realis calls.
func (j *AuroraJob) AuroraTask() *AuroraTask {
return j.task
}
/*
AuroraTask specific API, see task.go for further documentation.
These functions are provided for the convenience of chaining API calls.
*/
func (j *AuroraJob) ExecutorName(name string) *AuroraJob {
j.task.ExecutorName(name)
return j
}
func (j *AuroraJob) ExecutorData(data string) *AuroraJob {
j.task.ExecutorData(data)
return j
}
func (j *AuroraJob) CPU(cpus float64) *AuroraJob {
j.task.CPU(cpus)
return j
}
func (j *AuroraJob) RAM(ram int64) *AuroraJob {
j.task.RAM(ram)
return j
}
func (j *AuroraJob) Disk(disk int64) *AuroraJob {
j.task.Disk(disk)
return j
}
func (j *AuroraJob) Tier(tier string) *AuroraJob {
j.task.Tier(tier)
return j
}
func (j *AuroraJob) MaxFailure(maxFail int32) *AuroraJob {
j.task.MaxFailure(maxFail)
return j
}
func (j *AuroraJob) IsService(isService bool) *AuroraJob {
j.task.IsService(isService)
return j
}
func (j *AuroraJob) TaskConfig() *aurora.TaskConfig {
return j.jobConfig.TaskConfig
return j.task.TaskConfig()
}
// Add a list of URIs with the same extract and cache configuration. Scheduler must have
// --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection.
func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) Job {
for _, value := range values {
j.jobConfig.TaskConfig.MesosFetcherUris[&aurora.MesosFetcherURI{
Value: value,
Extract: &extract,
Cache: &cache,
}] = true
}
func (j *AuroraJob) AddURIs(extract bool, cache bool, values ...string) *AuroraJob {
j.task.AddURIs(extract, cache, values...)
return j
}
// Adds a Mesos label to the job. Note that Aurora will add the
// prefix "org.apache.aurora.metadata." to the beginning of each key.
func (j *AuroraJob) AddLabel(key string, value string) Job {
j.jobConfig.TaskConfig.Metadata[&aurora.Metadata{Key: key, Value: value}] = true
func (j *AuroraJob) AddLabel(key string, value string) *AuroraJob {
j.task.AddLabel(key, value)
return j
}
// Add a named port to the job configuration These are random ports as it's
// not currently possible to request specific ports using Aurora.
func (j *AuroraJob) AddNamedPorts(names ...string) Job {
j.portCount += len(names)
for _, name := range names {
j.jobConfig.TaskConfig.Resources[&aurora.Resource{NamedPort: &name}] = true
}
func (j *AuroraJob) AddNamedPorts(names ...string) *AuroraJob {
j.task.AddNamedPorts(names...)
return j
}
// Adds a request for a number of ports to the job configuration. The names chosen for these ports
// will be org.apache.aurora.port.X, where X is the current port count for the job configuration
// starting at 0. These are random ports as it's not currently possible to request
// specific ports using Aurora.
func (j *AuroraJob) AddPorts(num int) Job {
start := j.portCount
j.portCount += num
for i := start; i < j.portCount; i++ {
portName := "org.apache.aurora.port." + strconv.Itoa(i)
j.jobConfig.TaskConfig.Resources[&aurora.Resource{NamedPort: &portName}] = true
}
func (j *AuroraJob) AddPorts(num int) *AuroraJob {
j.task.AddPorts(num)
return j
}
func (j *AuroraJob) AddValueConstraint(name string, negated bool, values ...string) *AuroraJob {
j.task.AddValueConstraint(name, negated, values...)
return j
}
// From Aurora Docs:
// Add a Value constraint
// name - Mesos slave attribute that the constraint is matched against.
// If negated = true , treat this as a 'not' - to avoid specific values.
// Values - list of values we look for in attribute name
func (j *AuroraJob) AddValueConstraint(name string, negated bool, values ...string) Job {
constraintValues := make(map[string]bool)
for _, value := range values {
constraintValues[value] = true
}
j.jobConfig.TaskConfig.Constraints[&aurora.Constraint{
Name: name,
Constraint: &aurora.TaskConstraint{
Value: &aurora.ValueConstraint{
Negated: negated,
Values: constraintValues,
},
Limit: nil,
},
}] = true
func (j *AuroraJob) AddLimitConstraint(name string, limit int32) *AuroraJob {
j.task.AddLimitConstraint(name, limit)
return j
}
// From Aurora Docs:
// A constraint that specifies the maximum number of active tasks on a host with
// a matching attribute that may be scheduled simultaneously.
func (j *AuroraJob) AddLimitConstraint(name string, limit int32) Job {
j.jobConfig.TaskConfig.Constraints[&aurora.Constraint{
Name: name,
Constraint: &aurora.TaskConstraint{
Value: nil,
Limit: &aurora.LimitConstraint{Limit: limit},
},
}] = true
func (j *AuroraJob) AddDedicatedConstraint(role, name string) *AuroraJob {
j.task.AddDedicatedConstraint(role, name)
return j
}
func (j *AuroraJob) AddDedicatedConstraint(role, name string) Job {
j.AddValueConstraint("dedicated", false, role+"/"+name)
func (j *AuroraJob) Container(container Container) *AuroraJob {
j.task.Container(container)
return j
}
// Set a container to run for the job configuration to run.
func (j *AuroraJob) Container(container Container) Job {
j.jobConfig.TaskConfig.Container = container.Build()
func (j *AuroraJob) ThermosExecutor(thermos ThermosExecutor) *AuroraJob {
j.task.ThermosExecutor(thermos)
return j
}
func (j *AuroraJob) BuildThermosPayload() error {
return j.task.BuildThermosPayload()
}

241
jobUpdate.go Normal file
View file

@ -0,0 +1,241 @@
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package realis
import (
"time"
"git.apache.org/thrift.git/lib/go/thrift"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
)
// Structure to collect all information required to create job update
type JobUpdate struct {
task *AuroraTask
request *aurora.JobUpdateRequest
}
// Create a default JobUpdate object with an empty task and no fields filled in.
func NewJobUpdate() *JobUpdate {
newTask := NewTask()
req := aurora.JobUpdateRequest{}
req.TaskConfig = newTask.TaskConfig()
req.Settings = newUpdateSettings()
return &JobUpdate{task: newTask, request: &req}
}
func JobUpdateFromAuroraTask(task *AuroraTask) *JobUpdate {
newTask := task.Clone()
req := aurora.JobUpdateRequest{}
req.TaskConfig = newTask.TaskConfig()
req.Settings = newUpdateSettings()
return &JobUpdate{task: newTask, request: &req}
}
func JobUpdateFromConfig(task *aurora.TaskConfig) *JobUpdate {
// Perform a deep copy to avoid unexpected behavior
newTask := TaskFromThrift(task)
req := aurora.JobUpdateRequest{}
req.TaskConfig = newTask.TaskConfig()
req.Settings = newUpdateSettings()
return &JobUpdate{task: newTask, request: &req}
}
// Set instance count the job will have after the update.
func (j *JobUpdate) InstanceCount(inst int32) *JobUpdate {
j.request.InstanceCount = inst
return j
}
// Max number of instances being updated at any given moment.
func (j *JobUpdate) BatchSize(size int32) *JobUpdate {
j.request.Settings.UpdateGroupSize = size
return j
}
// Minimum number of seconds a shard must remain in RUNNING state before considered a success.
func (j *JobUpdate) WatchTime(timeout time.Duration) *JobUpdate {
j.request.Settings.MinWaitInInstanceRunningMs = int32(timeout.Seconds() * 1000)
return j
}
// Wait for all instances in a group to be done before moving on.
func (j *JobUpdate) WaitForBatchCompletion(batchWait bool) *JobUpdate {
j.request.Settings.WaitForBatchCompletion = batchWait
return j
}
// Max number of instance failures to tolerate before marking instance as FAILED.
func (j *JobUpdate) MaxPerInstanceFailures(inst int32) *JobUpdate {
j.request.Settings.MaxPerInstanceFailures = inst
return j
}
// Max number of FAILED instances to tolerate before terminating the update.
func (j *JobUpdate) MaxFailedInstances(inst int32) *JobUpdate {
j.request.Settings.MaxFailedInstances = inst
return j
}
// When False, prevents auto rollback of a failed update.
func (j *JobUpdate) RollbackOnFail(rollback bool) *JobUpdate {
j.request.Settings.RollbackOnFailure = rollback
return j
}
// Sets the interval at which pulses should be received by the job update before timing out.
func (j *JobUpdate) PulseIntervalTimeout(timeout time.Duration) *JobUpdate {
j.request.Settings.BlockIfNoPulsesAfterMs = thrift.Int32Ptr(int32(timeout.Seconds() * 1000))
return j
}
func newUpdateSettings() *aurora.JobUpdateSettings {
us := aurora.JobUpdateSettings{}
// Mirrors defaults set by Pystachio
us.UpdateOnlyTheseInstances = []*aurora.Range{}
us.UpdateGroupSize = 1
us.WaitForBatchCompletion = false
us.MinWaitInInstanceRunningMs = 45000
us.MaxPerInstanceFailures = 0
us.MaxFailedInstances = 0
us.RollbackOnFailure = true
return &us
}
/*
These methods are provided for user convenience in order to chain
calls for configuration.
API below here are wrappers around modifying an AuroraTask instance.
See task.go for further documentation.
*/
func (j *JobUpdate) Environment(env string) *JobUpdate {
j.task.Environment(env)
return j
}
func (j *JobUpdate) Role(role string) *JobUpdate {
j.task.Role(role)
return j
}
func (j *JobUpdate) Name(name string) *JobUpdate {
j.task.Name(name)
return j
}
func (j *JobUpdate) ExecutorName(name string) *JobUpdate {
j.task.ExecutorName(name)
return j
}
func (j *JobUpdate) ExecutorData(data string) *JobUpdate {
j.task.ExecutorData(data)
return j
}
func (j *JobUpdate) CPU(cpus float64) *JobUpdate {
j.task.CPU(cpus)
return j
}
func (j *JobUpdate) RAM(ram int64) *JobUpdate {
j.task.RAM(ram)
return j
}
func (j *JobUpdate) Disk(disk int64) *JobUpdate {
j.task.Disk(disk)
return j
}
func (j *JobUpdate) Tier(tier string) *JobUpdate {
j.task.Tier(tier)
return j
}
func (j *JobUpdate) MaxFailure(maxFail int32) *JobUpdate {
j.task.MaxFailure(maxFail)
return j
}
func (j *JobUpdate) IsService(isService bool) *JobUpdate {
j.task.IsService(isService)
return j
}
func (j *JobUpdate) TaskConfig() *aurora.TaskConfig {
return j.task.TaskConfig()
}
func (j *JobUpdate) AddURIs(extract bool, cache bool, values ...string) *JobUpdate {
j.task.AddURIs(extract, cache, values...)
return j
}
func (j *JobUpdate) AddLabel(key string, value string) *JobUpdate {
j.task.AddLabel(key, value)
return j
}
func (j *JobUpdate) AddNamedPorts(names ...string) *JobUpdate {
j.task.AddNamedPorts(names...)
return j
}
func (j *JobUpdate) AddPorts(num int) *JobUpdate {
j.task.AddPorts(num)
return j
}
func (j *JobUpdate) AddValueConstraint(name string, negated bool, values ...string) *JobUpdate {
j.task.AddValueConstraint(name, negated, values...)
return j
}
func (j *JobUpdate) AddLimitConstraint(name string, limit int32) *JobUpdate {
j.task.AddLimitConstraint(name, limit)
return j
}
func (j *JobUpdate) AddDedicatedConstraint(role, name string) *JobUpdate {
j.task.AddDedicatedConstraint(role, name)
return j
}
func (j *JobUpdate) Container(container Container) *JobUpdate {
j.task.Container(container)
return j
}
func (j *JobUpdate) JobKey() aurora.JobKey {
return j.task.JobKey()
}
func (j *JobUpdate) ThermosExecutor(thermos ThermosExecutor) *JobUpdate {
j.task.ThermosExecutor(thermos)
return j
}
func (j *JobUpdate) BuildThermosPayload() error {
return j.task.BuildThermosPayload()
}

View file

@ -40,20 +40,20 @@ func (l *LevelLogger) EnableDebug(enable bool) {
func (l LevelLogger) DebugPrintf(format string, a ...interface{}) {
if l.debug {
l.Print("[DEBUG] ")
l.Printf(format, a)
l.Printf(format, a...)
}
}
func (l LevelLogger) DebugPrint(a ...interface{}) {
if l.debug {
l.Print("[DEBUG] ")
l.Print(a)
l.Print(a...)
}
}
func (l LevelLogger) DebugPrintln(a ...interface{}) {
if l.debug {
l.Print("[DEBUG] ")
l.Println(a)
l.Println(a...)
}
}

View file

@ -18,88 +18,95 @@ package realis
import (
"time"
"github.com/paypal/gorealis/gen-go/apache/aurora"
"github.com/paypal/gorealis/response"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
"github.com/pkg/errors"
)
const (
UpdateFailed = "update failed"
RolledBack = "update rolled back"
Timeout = "timeout"
Timedout = "timeout"
)
type Monitor struct {
Client Realis
}
// Polls the scheduler every certain amount of time to see if the update has succeeded
func (m *Monitor) JobUpdate(updateKey aurora.JobUpdateKey, interval int, timeout int) (bool, error) {
func (c *Client) JobUpdateMonitor(updateKey aurora.JobUpdateKey, interval, timeout time.Duration) (bool, error) {
if interval < 1*time.Second {
interval = interval * time.Second
}
if timeout < 1*time.Second {
timeout = timeout * time.Second
}
updateQ := aurora.JobUpdateQuery{
Key: &updateKey,
Limit: 1,
}
ticker := time.NewTicker(time.Second * time.Duration(interval))
ticker := time.NewTicker(interval)
defer ticker.Stop()
timer := time.NewTimer(time.Second * time.Duration(timeout))
timer := time.NewTimer(timeout)
defer timer.Stop()
var cliErr error
var respDetail *aurora.Response
for {
select {
case <-ticker.C:
respDetail, cliErr = m.Client.JobUpdateDetails(updateQ)
updateDetail, cliErr := c.JobUpdateDetails(updateQ)
if cliErr != nil {
return false, cliErr
}
updateDetail := response.JobUpdateDetails(respDetail)
if len(updateDetail) == 0 {
m.Client.RealisConfig().logger.Println("No update found")
c.RealisConfig().logger.Println("No update found")
return false, errors.New("No update found for " + updateKey.String())
}
status := updateDetail[0].Update.Summary.State.Status
if _, ok := aurora.ACTIVE_JOB_UPDATE_STATES[status]; !ok {
// Convert Thrift Set to Golang map for quick lookup
if _, ok := ActiveJobUpdateStates[status]; !ok {
// Rolled forward is the only state in which an update has been successfully updated
// if we encounter an inactive state and it is not at rolled forward, update failed
switch status {
case aurora.JobUpdateStatus_ROLLED_FORWARD:
m.Client.RealisConfig().logger.Println("Update succeeded")
c.RealisConfig().logger.Println("Update succeeded")
return true, nil
case aurora.JobUpdateStatus_FAILED:
m.Client.RealisConfig().logger.Println("Update failed")
c.RealisConfig().logger.Println("Update failed")
return false, errors.New(UpdateFailed)
case aurora.JobUpdateStatus_ROLLED_BACK:
m.Client.RealisConfig().logger.Println("rolled back")
c.RealisConfig().logger.Println("rolled back")
return false, errors.New(RolledBack)
default:
return false, nil
}
}
case <-timer.C:
return false, errors.New(Timeout)
return false, errors.New(Timedout)
}
}
}
// Monitor a Job until all instances enter one of the LIVE_STATES
func (m *Monitor) Instances(key *aurora.JobKey, instances int32, interval, timeout int) (bool, error) {
return m.ScheduleStatus(key, instances, aurora.LIVE_STATES, interval, timeout)
// Monitor a AuroraJob until all instances enter one of the LiveStates
func (c *Client) InstancesMonitor(key aurora.JobKey, instances int32, interval, timeout time.Duration) (bool, error) {
return c.ScheduleStatusMonitor(key, instances, aurora.LIVE_STATES, interval, timeout)
}
// Monitor a Job until all instances enter a desired status.
// Monitor a AuroraJob until all instances enter a desired status.
// Defaults sets of desired statuses provided by the thrift API include:
// ACTIVE_STATES, SLAVE_ASSIGNED_STATES, LIVE_STATES, and TERMINAL_STATES
func (m *Monitor) ScheduleStatus(key *aurora.JobKey, instanceCount int32, desiredStatuses map[aurora.ScheduleStatus]bool, interval, timeout int) (bool, error) {
// ActiveStates, SlaveAssignedStates, LiveStates, and TerminalStates
func (c *Client) ScheduleStatusMonitor(key aurora.JobKey, instanceCount int32, desiredStatuses []aurora.ScheduleStatus, interval, timeout time.Duration) (bool, error) {
if interval < 1*time.Second {
interval = interval * time.Second
}
ticker := time.NewTicker(time.Second * time.Duration(interval))
if timeout < 1*time.Second {
timeout = timeout * time.Second
}
ticker := time.NewTicker(interval)
defer ticker.Stop()
timer := time.NewTimer(time.Second * time.Duration(timeout))
timer := time.NewTimer(timeout)
defer timer.Stop()
for {
@ -107,7 +114,7 @@ func (m *Monitor) ScheduleStatus(key *aurora.JobKey, instanceCount int32, desire
case <-ticker.C:
// Query Aurora for the state of the job key ever interval
instCount, cliErr := m.Client.GetInstanceIds(key, desiredStatuses)
instCount, cliErr := c.GetInstanceIds(key, desiredStatuses)
if cliErr != nil {
return false, errors.Wrap(cliErr, "Unable to communicate with Aurora")
}
@ -117,14 +124,21 @@ func (m *Monitor) ScheduleStatus(key *aurora.JobKey, instanceCount int32, desire
case <-timer.C:
// If the timer runs out, return a timeout error to user
return false, errors.New(Timeout)
return false, errors.New(Timedout)
}
}
}
// Monitor host status until all hosts match the status provided. Returns a map where the value is true if the host
// is in one of the desired mode(s) or false if it is not as of the time when the monitor exited.
func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode, interval, timeout int) (map[string]bool, error) {
func (c *Client) HostMaintenanceMonitor(hosts []string, modes []aurora.MaintenanceMode, interval, timeout time.Duration) (map[string]bool, error) {
if interval < 1*time.Second {
interval = interval * time.Second
}
if timeout < 1*time.Second {
timeout = timeout * time.Second
}
// Transform modes to monitor for into a set for easy lookup
desiredMode := make(map[aurora.MaintenanceMode]struct{})
@ -142,16 +156,16 @@ func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode
hostResult := make(map[string]bool)
ticker := time.NewTicker(time.Second * time.Duration(interval))
ticker := time.NewTicker(interval)
defer ticker.Stop()
timer := time.NewTimer(time.Second * time.Duration(timeout))
timer := time.NewTimer(timeout)
defer timer.Stop()
for {
select {
case <-ticker.C:
// Client call has multiple retries internally
_, result, err := m.Client.MaintenanceStatus(hosts...)
result, err := c.MaintenanceStatus(hosts...)
if err != nil {
// Error is either a payload error or a severe connection error
for host := range remainingHosts {
@ -160,7 +174,7 @@ func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode
return hostResult, errors.Wrap(err, "client error in monitor")
}
for status := range result.GetStatuses() {
for _, status := range result.GetStatuses() {
if _, ok := desiredMode[status.GetMode()]; ok {
hostResult[status.GetHost()] = true
@ -177,7 +191,7 @@ func (m *Monitor) HostMaintenance(hosts []string, modes []aurora.MaintenanceMode
hostResult[host] = false
}
return hostResult, errors.New(Timeout)
return hostResult, errors.New(Timedout)
}
}
}

980
realis.go

File diff suppressed because it is too large Load diff

View file

@ -22,24 +22,22 @@ import (
"testing"
"time"
"github.com/paypal/gorealis"
"github.com/paypal/gorealis/gen-go/apache/aurora"
"github.com/paypal/gorealis/response"
realis "github.com/paypal/gorealis/v2"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
var r realis.Realis
var monitor *realis.Monitor
var thermosPayload []byte
var r *realis.Client
var thermosExec realis.ThermosExecutor
func TestMain(m *testing.M) {
var err error
// New configuration to connect to docker container
r, err = realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
r, err = realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
realis.BasicAuth("aurora", "secret"),
realis.TimeoutMS(20000))
realis.Timeout(20*time.Second))
if err != nil {
fmt.Println("Please run docker-compose up -d before running test suite")
@ -48,14 +46,8 @@ func TestMain(m *testing.M) {
defer r.Close()
// Create monitor
monitor = &realis.Monitor{Client: r}
thermosPayload, err = ioutil.ReadFile("examples/thermos_payload.json")
if err != nil {
fmt.Println("Error reading thermos payload file: ", err)
os.Exit(1)
}
thermosExec.AddProcess(realis.NewThermosProcess("boostrap", "echo bootsrapping")).
AddProcess(realis.NewThermosProcess("hello_gorealis", "while true; do echo hello world from gorealis; sleep 10; done"))
os.Exit(m.Run())
}
@ -68,8 +60,8 @@ func TestNonExistentEndpoint(t *testing.T) {
Jitter: 0.1}
// Attempt to connect to a bad endpoint
r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081/doesntexist/"),
realis.TimeoutMS(200),
r, err := realis.NewClient(realis.SchedulerUrl("http://doesntexist.com:8081/api"),
realis.Timeout(200*time.Millisecond),
realis.BackOff(backoff),
)
defer r.Close()
@ -90,13 +82,37 @@ func TestNonExistentEndpoint(t *testing.T) {
}
func TestBadCredentials(t *testing.T) {
r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
realis.BasicAuth("incorrect", "password"),
realis.Debug())
defer r.Close()
assert.NoError(t, err)
job := realis.NewJob().
Environment("prod").
Role("vagrant").
Name("create_thermos_job_test").
ThermosExecutor(thermosExec).
CPU(.5).
RAM(64).
Disk(100).
IsService(true).
InstanceCount(2).
AddPorts(1)
assert.Error(t, r.CreateJob(job))
}
func TestThriftBinary(t *testing.T) {
r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
realis.BasicAuth("aurora", "secret"),
realis.TimeoutMS(20000),
realis.Timeout(20*time.Second),
realis.ThriftBinary())
assert.NoError(t, err)
defer r.Close()
role := "all"
taskQ := &aurora.TaskQuery{
@ -108,14 +124,12 @@ func TestThriftBinary(t *testing.T) {
assert.NoError(t, err)
r.Close()
}
func TestThriftJSON(t *testing.T) {
r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
realis.BasicAuth("aurora", "secret"),
realis.TimeoutMS(20000),
realis.Timeout(20*time.Second),
realis.ThriftJSON())
assert.NoError(t, err)
@ -135,7 +149,7 @@ func TestThriftJSON(t *testing.T) {
}
func TestNoopLogger(t *testing.T) {
r, err := realis.NewRealisClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
r, err := realis.NewClient(realis.SchedulerUrl("http://192.168.33.7:8081"),
realis.BasicAuth("aurora", "secret"),
realis.SetLogger(realis.NoopLogger{}))
@ -160,6 +174,34 @@ func TestLeaderFromZK(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "http://192.168.33.7:8081", url)
}
func TestInvalidAuroraURL(t *testing.T) {
for _, url := range []string{
"http://doesntexist.com:8081/apitest",
"test://doesntexist.com:8081",
"https://doesntexist.com:8081/testing/api",
} {
r, err := realis.NewClient(realis.SchedulerUrl(url))
assert.Error(t, err)
assert.Nil(t, r)
}
}
func TestValidAuroraURL(t *testing.T) {
for _, url := range []string{
"http://domain.com:8081/api",
"https://domain.com:8081/api",
"domain.com:8081",
"domain.com",
"192.168.33.7",
"192.168.33.7:8081",
"192.168.33.7:8081/api",
} {
r, err := realis.NewClient(realis.SchedulerUrl(url))
assert.NoError(t, err)
assert.NotNil(t, r)
}
}
func TestRealisClient_ReestablishConn(t *testing.T) {
@ -184,8 +226,7 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) {
Environment("prod").
Role(role).
Name("create_thermos_job_test").
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
ExecutorData(string(thermosPayload)).
ThermosExecutor(thermosExec).
CPU(.5).
RAM(64).
Disk(100).
@ -193,23 +234,21 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) {
InstanceCount(2).
AddPorts(1)
resp, err := r.CreateJob(job)
err := r.CreateJob(job)
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
// Test Instances Monitor
success, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 1, 50)
success, err := r.InstancesMonitor(job.JobKey(), job.GetInstanceCount(), 1*time.Second, 50*time.Second)
assert.True(t, success)
assert.NoError(t, err)
//Fetch all Jobs
_, result, err := r.GetJobs(role)
// Fetch all Jobs
result, err := r.GetJobs(role)
fmt.Printf("GetJobs length: %+v \n", len(result.Configs))
assert.Len(t, result.Configs, 1)
assert.NoError(t, err)
// Test asking the scheduler to perform a Snpshot
// Test asking the scheduler to perform a Snapshot
t.Run("TestRealisClient_Snapshot", func(t *testing.T) {
err := r.Snapshot()
assert.NoError(t, err)
@ -223,12 +262,10 @@ func TestRealisClient_CreateJob_Thermos(t *testing.T) {
// Tasks must exist for it to, be killed
t.Run("TestRealisClient_KillJob_Thermos", func(t *testing.T) {
resp, err := r.KillJob(job.JobKey())
err := r.KillJob(job.JobKey())
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
success, err := monitor.Instances(job.JobKey(), 0, 1, 50)
success, err := r.InstancesMonitor(job.JobKey(), 0, 1*time.Second, 60*time.Second)
assert.True(t, success)
assert.NoError(t, err)
})
@ -249,9 +286,8 @@ func TestRealisClient_CreateJob_ExecutorDoesNotExist(t *testing.T) {
Disk(10).
InstanceCount(1)
resp, err := r.CreateJob(job)
err := r.CreateJob(job)
assert.Error(t, err)
assert.Equal(t, aurora.ResponseCode_INVALID_REQUEST, resp.GetResponseCode())
}
// Test configuring an executor that doesn't exist for CreateJob API
@ -266,16 +302,14 @@ func TestRealisClient_GetPendingReason(t *testing.T) {
Environment(env).
Role(role).
Name(name).
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
ExecutorData(string(thermosPayload)).
ThermosExecutor(thermosExec).
CPU(1000).
RAM(64).
Disk(100).
InstanceCount(1)
resp, err := r.CreateJob(job)
err := r.CreateJob(job)
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
taskQ := &aurora.TaskQuery{
Role: &role,
@ -287,7 +321,7 @@ func TestRealisClient_GetPendingReason(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, reasons, 1)
resp, err = r.KillJob(job.JobKey())
err = r.KillJob(job.JobKey())
assert.NoError(t, err)
}
@ -295,119 +329,111 @@ func TestRealisClient_CreateService_WithPulse_Thermos(t *testing.T) {
fmt.Println("Creating service")
role := "vagrant"
job := realis.NewJob().
job := realis.NewJobUpdate().
Environment("prod").
Role(role).
Name("create_thermos_job_test").
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
ExecutorData(string(thermosPayload)).
Name("create_thermos_job_pulse_test").
CPU(.5).
RAM(64).
Disk(100).
ThermosExecutor(thermosExec).
IsService(true).
InstanceCount(1).
InstanceCount(2).
AddPorts(1).
AddLabel("currentTime", time.Now().String())
AddLabel("currentTime", time.Now().String()).
PulseIntervalTimeout(30 * time.Millisecond).
BatchSize(1).WaitForBatchCompletion(true)
pulse := int32(30)
timeout := 300
settings := realis.NewUpdateSettings()
settings.BlockIfNoPulsesAfterMs = &pulse
settings.UpdateGroupSize = 1
settings.WaitForBatchCompletion = true
job.InstanceCount(2)
resp, result, err := r.CreateService(job, settings)
result, err := r.CreateService(job)
fmt.Println(result.String())
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
updateQ := aurora.JobUpdateQuery{
Key: result.GetKey(),
Limit: 1,
}
start := time.Now()
for i := 0; i*int(pulse) <= timeout; i++ {
var updateDetails []*aurora.JobUpdateDetails
fmt.Println("sending PulseJobUpdate....")
resp, err = r.PulseJobUpdate(result.GetKey())
assert.NotNil(t, resp)
assert.Nil(t, err)
ticker := time.NewTicker(time.Second * 3)
timer := time.NewTimer(time.Minute * 6)
defer ticker.Stop()
defer timer.Stop()
respDetail, err := r.JobUpdateDetails(updateQ)
assert.Nil(t, err)
pulseLoop:
for {
select {
case <-ticker.C:
pulseStatus, err := r.PulseJobUpdate(result.GetKey())
updateDetail := response.JobUpdateDetails(respDetail)
if len(updateDetail) == 0 {
fmt.Println("No update found")
assert.NotEqual(t, len(updateDetail), 0)
}
status := updateDetail[0].Update.Summary.State.Status
if _, ok := aurora.ACTIVE_JOB_UPDATE_STATES[status]; !ok {
// Rolled forward is the only state in which an update has been successfully updated
// if we encounter an inactive state and it is not at rolled forward, update failed
if status == aurora.JobUpdateStatus_ROLLED_FORWARD {
fmt.Println("Update succeded")
break
} else {
fmt.Println("Update failed")
break
assert.Nil(t, err)
if pulseStatus != aurora.JobUpdatePulseStatus_OK && pulseStatus != aurora.JobUpdatePulseStatus_FINISHED {
assert.FailNow(t, "pulse update status received doesn't exist")
}
updateDetails, err = r.JobUpdateDetails(updateQ)
assert.Nil(t, err)
assert.Equal(t, len(updateDetails), 1, "no update matching query found")
status := updateDetails[0].Update.Summary.State.Status
if _, ok := realis.ActiveJobUpdateStates[status]; !ok {
// Rolled forward is the only state in which an update has been successfully updated
// if we encounter an inactive state and it is not at rolled forward, update failed
if status == aurora.JobUpdateStatus_ROLLED_FORWARD {
fmt.Println("Update succeeded")
break pulseLoop
} else {
fmt.Println("Update failed")
break pulseLoop
}
}
case <-timer.C:
err := r.AbortJobUpdate(*updateDetails[0].GetUpdate().GetSummary().GetKey(), "")
assert.NoError(t, err)
err = r.KillJob(job.JobKey())
assert.NoError(t, err)
assert.FailNow(t, "timed out during pulse update test")
}
fmt.Println("Polling, update still active...")
time.Sleep(time.Duration(pulse) * time.Second)
}
end := time.Now()
fmt.Printf("Update call took %d ns\n", (end.UnixNano() - start.UnixNano()))
t.Run("TestRealisClient_KillJob_Thermos", func(t *testing.T) {
start := time.Now()
resp, err := r.KillJob(job.JobKey())
end := time.Now()
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
fmt.Printf("Kill call took %d ns\n", (end.UnixNano() - start.UnixNano()))
})
err = r.KillJob(job.JobKey())
assert.NoError(t, err)
}
// Test configuring an executor that doesn't exist for CreateJob API
func TestRealisClient_CreateService(t *testing.T) {
// Create a single job
job := realis.NewJob().
job := realis.NewJobUpdate().
Environment("prod").
Role("vagrant").
Name("create_service_test").
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
ExecutorData(string(thermosPayload)).
ThermosExecutor(thermosExec).
CPU(.25).
RAM(4).
Disk(10).
InstanceCount(3).
IsService(true)
WatchTime(20 * time.Second).
IsService(true).
BatchSize(2)
settings := realis.NewUpdateSettings()
settings.UpdateGroupSize = 2
job.InstanceCount(3)
resp, result, err := r.CreateService(job, settings)
result, err := r.CreateService(job)
assert.NoError(t, err)
assert.NotNil(t, result)
assert.Equal(t, aurora.ResponseCode_OK, resp.GetResponseCode())
var ok bool
var mErr error
if ok, mErr = monitor.JobUpdate(*result.GetKey(), 5, 180); !ok || mErr != nil {
if ok, mErr = r.JobUpdateMonitor(*result.GetKey(), 5*time.Second, 4*time.Minute); !ok || mErr != nil {
// Update may already be in a terminal state so don't check for error
_, err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.")
err := r.AbortJobUpdate(*result.GetKey(), "Monitor timed out.")
_, err = r.KillJob(job.JobKey())
err = r.KillJob(job.JobKey())
assert.NoError(t, err)
}
@ -416,7 +442,7 @@ func TestRealisClient_CreateService(t *testing.T) {
assert.NoError(t, mErr)
// Kill task test task after confirming it came up fine
_, err = r.KillJob(job.JobKey())
err = r.KillJob(job.JobKey())
assert.NoError(t, err)
}
@ -425,7 +451,7 @@ func TestRealisClient_CreateService(t *testing.T) {
func TestRealisClient_CreateService_ExecutorDoesNotExist(t *testing.T) {
// Create a single job
job := realis.NewJob().
jobUpdate := realis.NewJobUpdate().
Environment("prod").
Role("vagrant").
Name("executordoesntexist").
@ -434,15 +460,12 @@ func TestRealisClient_CreateService_ExecutorDoesNotExist(t *testing.T) {
CPU(.25).
RAM(4).
Disk(10).
InstanceCount(1)
InstanceCount(3)
settings := realis.NewUpdateSettings()
job.InstanceCount(3)
resp, result, err := r.CreateService(job, settings)
result, err := r.CreateService(jobUpdate)
assert.Error(t, err)
assert.Nil(t, result)
assert.Equal(t, aurora.ResponseCode_INVALID_REQUEST, resp.GetResponseCode())
}
func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) {
@ -465,87 +488,66 @@ func TestRealisClient_ScheduleCronJob_Thermos(t *testing.T) {
CronSchedule("* * * * *").
IsService(false)
resp, err := r.ScheduleCronJob(job)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
err = r.ScheduleCronJob(job)
assert.NoError(t, err)
t.Run("TestRealisClient_StartCronJob_Thermos", func(t *testing.T) {
start := time.Now()
resp, err := r.StartCronJob(job.JobKey())
end := time.Now()
err := r.StartCronJob(job.JobKey())
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
fmt.Printf("Schedule cron call took %d ns\n", (end.UnixNano() - start.UnixNano()))
})
t.Run("TestRealisClient_DeschedulerCronJob_Thermos", func(t *testing.T) {
start := time.Now()
resp, err := r.DescheduleCronJob(job.JobKey())
end := time.Now()
err := r.DescheduleCronJob(job.JobKey())
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
fmt.Printf("Deschedule cron call took %d ns\n", (end.UnixNano() - start.UnixNano()))
})
}
func TestRealisClient_StartMaintenance(t *testing.T) {
hosts := []string{"localhost"}
_, _, err := r.StartMaintenance(hosts...)
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
}
_, err := r.StartMaintenance(hosts...)
assert.NoError(t, err)
// Monitor change to DRAINING and DRAINED mode
hostResults, err := monitor.HostMaintenance(
hostResults, err := r.HostMaintenanceMonitor(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_SCHEDULED},
1,
50)
1*time.Second,
50*time.Second)
assert.Equal(t, map[string]bool{"localhost": true}, hostResults)
assert.NoError(t, err)
_, _, err = r.EndMaintenance(hosts...)
_, err = r.EndMaintenance(hosts...)
assert.NoError(t, err)
// Monitor change to DRAINING and DRAINED mode
_, err = monitor.HostMaintenance(
_, err = r.HostMaintenanceMonitor(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
5,
10)
5*time.Second,
10*time.Second)
assert.NoError(t, err)
}
func TestRealisClient_DrainHosts(t *testing.T) {
hosts := []string{"localhost"}
_, _, err := r.DrainHosts(hosts...)
if err != nil {
fmt.Printf("error: %+v\n", err.Error())
os.Exit(1)
}
_, err := r.DrainHosts(hosts...)
assert.NoError(t, err)
// Monitor change to DRAINING and DRAINED mode
hostResults, err := monitor.HostMaintenance(
hostResults, err := r.HostMaintenanceMonitor(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
1,
50)
1*time.Second,
50*time.Second)
assert.Equal(t, map[string]bool{"localhost": true}, hostResults)
assert.NoError(t, err)
t.Run("TestRealisClient_MonitorNontransitioned", func(t *testing.T) {
// Monitor change to DRAINING and DRAINED mode
hostResults, err := monitor.HostMaintenance(
hostResults, err := r.HostMaintenanceMonitor(
append(hosts, "IMAGINARY_HOST"),
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
1,
1)
1*time.Second,
1*time.Second)
// Assert monitor returned an error that was not nil, and also a list of the non-transitioned hosts
assert.Error(t, err)
@ -553,15 +555,15 @@ func TestRealisClient_DrainHosts(t *testing.T) {
})
t.Run("TestRealisClient_EndMaintenance", func(t *testing.T) {
_, _, err := r.EndMaintenance(hosts...)
_, err := r.EndMaintenance(hosts...)
assert.NoError(t, err)
// Monitor change to DRAINING and DRAINED mode
_, err = monitor.HostMaintenance(
_, err = r.HostMaintenanceMonitor(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
5,
10)
5*time.Second,
10*time.Second)
assert.NoError(t, err)
})
@ -578,23 +580,23 @@ func TestRealisClient_SLADrainHosts(t *testing.T) {
}
// Monitor change to DRAINING and DRAINED mode
hostResults, err := monitor.HostMaintenance(
hostResults, err := r.HostMaintenanceMonitor(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
1,
50)
1*time.Second,
50*time.Second)
assert.Equal(t, map[string]bool{"localhost": true}, hostResults)
assert.NoError(t, err)
_, _, err = r.EndMaintenance(hosts...)
_, err = r.EndMaintenance(hosts...)
assert.NoError(t, err)
// Monitor change to DRAINING and DRAINED mode
_, err = monitor.HostMaintenance(
_, err = r.HostMaintenanceMonitor(
hosts,
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
5,
10)
5*time.Second,
10*time.Second)
assert.NoError(t, err)
}
@ -606,18 +608,15 @@ func TestRealisClient_SessionThreadSafety(t *testing.T) {
Environment("prod").
Role("vagrant").
Name("create_thermos_job_test_multi").
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
ExecutorData(string(thermosPayload)).
ThermosExecutor(thermosExec).
CPU(.25).
RAM(4).
Disk(10).
InstanceCount(1000) // Impossible amount to go live in any sane machine
resp, err := r.CreateJob(job)
err := r.CreateJob(job)
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
wg := sync.WaitGroup{}
for i := 0; i < 20; i++ {
@ -628,15 +627,13 @@ func TestRealisClient_SessionThreadSafety(t *testing.T) {
defer wg.Done()
// Test Schedule status monitor for terminal state and timing out after 30 seconds
success, err := monitor.ScheduleStatus(job.JobKey(), job.GetInstanceCount(), aurora.LIVE_STATES, 1, 30)
success, err := r.ScheduleStatusMonitor(job.JobKey(), job.GetInstanceCount(), aurora.LIVE_STATES, 1, 30)
assert.False(t, success)
assert.Error(t, err)
resp, err := r.KillJob(job.JobKey())
err = r.KillJob(job.JobKey())
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
}()
}
@ -648,19 +645,15 @@ func TestRealisClient_SetQuota(t *testing.T) {
var cpu = 3.5
var ram int64 = 20480
var disk int64 = 10240
resp, err := r.SetQuota("vagrant", &cpu, &ram, &disk)
err := r.SetQuota("vagrant", &cpu, &ram, &disk)
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
t.Run("TestRealisClient_GetQuota", func(t *testing.T) {
// Test GetQuota based on previously set values
var result *aurora.GetQuotaResult_
resp, err = r.GetQuota("vagrant")
if resp.GetResult_() != nil {
result = resp.GetResult_().GetQuotaResult_
}
quotaResult, err := r.GetQuota("vagrant")
assert.NoError(t, err)
assert.Equal(t, aurora.ResponseCode_OK, resp.ResponseCode)
for res := range result.Quota.GetResources() {
for _, res := range quotaResult.GetQuota().GetResources() {
switch true {
case res.DiskMb != nil:
assert.Equal(t, disk, *res.DiskMb)

View file

@ -17,9 +17,8 @@ package response
import (
"bytes"
"errors"
"github.com/paypal/gorealis/gen-go/apache/aurora"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
)
// Get key from a response created by a StartJobUpdate call
@ -39,18 +38,6 @@ func JobUpdateSummaries(resp *aurora.Response) []*aurora.JobUpdateSummary {
return resp.GetResult_().GetGetJobUpdateSummariesResult_().GetUpdateSummaries()
}
// Deprecated: Replaced by checks done inside of thriftCallHelper
func ResponseCodeCheck(resp *aurora.Response) (*aurora.Response, error) {
if resp == nil {
return resp, errors.New("Response is nil")
}
if resp.GetResponseCode() != aurora.ResponseCode_OK {
return resp, errors.New(CombineMessage(resp))
}
return resp, nil
}
// Based on aurora client: src/main/python/apache/aurora/client/base.py
func CombineMessage(resp *aurora.Response) string {
var buffer bytes.Buffer

View file

@ -17,12 +17,15 @@ package realis
import (
"io"
"math/rand"
"net/http"
"net/url"
"strconv"
"strings"
"time"
"git.apache.org/thrift.git/lib/go/thrift"
"github.com/paypal/gorealis/gen-go/apache/aurora"
"github.com/paypal/gorealis/response"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
"github.com/paypal/gorealis/v2/response"
"github.com/pkg/errors"
)
@ -116,12 +119,12 @@ func ExponentialBackoff(backoff Backoff, logger Logger, condition ConditionFunc)
type auroraThriftCall func() (resp *aurora.Response, err error)
// Duplicates the functionality of ExponentialBackoff but is specifically targeted towards ThriftCalls.
func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*aurora.Response, error) {
func (c *Client) thriftCallWithRetries(thriftCall auroraThriftCall) (*aurora.Response, error) {
var resp *aurora.Response
var clientErr error
var curStep int
backoff := r.config.backoff
backoff := c.config.backoff
duration := backoff.Duration
for curStep = 0; curStep < backoff.Steps; curStep++ {
@ -133,7 +136,7 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro
adjusted = Jitter(duration, backoff.Jitter)
}
r.logger.Printf("A retriable error occurred during thrift call, backing off for %v before retry %v\n", adjusted, curStep)
c.logger.Printf("A retriable error occurred during thrift call, backing off for %v before retry %v\n", adjusted, curStep)
time.Sleep(adjusted)
duration = time.Duration(float64(duration) * backoff.Factor)
@ -143,12 +146,12 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro
// Placing this in an anonymous function in order to create a new, short-lived stack allowing unlock
// to be run in case of a panic inside of thriftCall.
func() {
r.lock.Lock()
defer r.lock.Unlock()
c.lock.Lock()
defer c.lock.Unlock()
resp, clientErr = thriftCall()
r.logger.DebugPrintf("Aurora Thrift Call ended resp: %v clientErr: %v\n", resp, clientErr)
c.logger.DebugPrintf("Aurora Thrift Call ended resp: %v clientErr: %v\n", resp, clientErr)
}()
// Check if our thrift call is returning an error. This is a retriable event as we don't know
@ -156,12 +159,18 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro
if clientErr != nil {
// Print out the error to the user
r.logger.Printf("Client Error: %v\n", clientErr)
c.logger.Printf("Client Error: %v\n", clientErr)
// Determine if error is a temporary URL error by going up the stack
e, ok := clientErr.(thrift.TTransportException)
if ok {
r.logger.DebugPrint("Encountered a transport exception")
c.logger.DebugPrint("Encountered a transport exception")
// TODO(rdelvalle): Figure out a better way to obtain the error code as this is a very brittle solution
// 401 Unauthorized means the wrong username and password were provided
if strings.Contains(e.Error(), strconv.Itoa(http.StatusUnauthorized)) {
return nil, errors.Wrap(clientErr, "wrong username or password provided")
}
e, ok := e.Err().(*url.Error)
if ok {
@ -176,7 +185,7 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro
// In the future, reestablish connection should be able to check if it is actually possible
// to make a thrift call to Aurora. For now, a reconnect should always lead to a retry.
r.ReestablishConn()
c.ReestablishConn()
} else {
@ -195,31 +204,31 @@ func (r *realisClient) thriftCallWithRetries(thriftCall auroraThriftCall) (*auro
// If the response code is transient, continue retrying
case aurora.ResponseCode_ERROR_TRANSIENT:
r.logger.Println("Aurora replied with Transient error code, retrying")
c.logger.Println("Aurora replied with Transient error code, retrying")
continue
// Failure scenarios, these indicate a bad payload or a bad config. Stop retrying.
// Failure scenarios, these indicate a bad payload or a bad clientConfig. Stop retrying.
case aurora.ResponseCode_INVALID_REQUEST,
aurora.ResponseCode_ERROR,
aurora.ResponseCode_AUTH_FAILED,
aurora.ResponseCode_JOB_UPDATING_ERROR:
r.logger.Printf("Terminal Response Code %v from Aurora, won't retry\n", resp.GetResponseCode().String())
c.logger.Printf("Terminal Response Code %v from Aurora, won't retry\n", resp.GetResponseCode().String())
return resp, errors.New(response.CombineMessage(resp))
// The only case that should fall down to here is a WARNING response code.
// It is currently not used as a response in the scheduler so it is unknown how to handle it.
default:
r.logger.DebugPrintf("unhandled response code %v received from Aurora\n", responseCode)
c.logger.DebugPrintf("unhandled response code %v received from Aurora\n", responseCode)
return nil, errors.Errorf("unhandled response code from Aurora %v\n", responseCode.String())
}
}
}
r.logger.DebugPrintf("it took %v retries to complete this operation\n", curStep)
c.logger.DebugPrintf("it took %v retries to complete this operation\n", curStep)
if curStep > 1 {
r.config.logger.Printf("retried this thrift call %d time(s)", curStep)
c.config.logger.Printf("retried this thrift call %d time(s)", curStep)
}
// Provide more information to the user wherever possible.

View file

@ -1,4 +1,4 @@
#!/bin/bash
# Since we run our docker compose setup in bridge mode to be able to run on MacOS, we have to launch a Docker container within the bridge network in order to avoid any routing issues.
docker run -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.10.3-stretch go test -v github.com/paypal/gorealis
docker run -t -v $(pwd):/go/src/github.com/paypal/gorealis --network gorealis_aurora_cluster golang:1.11.3-stretch go test -v github.com/paypal/gorealis

423
task.go Normal file
View file

@ -0,0 +1,423 @@
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package realis
import (
"encoding/json"
"strconv"
"git.apache.org/thrift.git/lib/go/thrift"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
)
type ResourceType int
const (
CPU ResourceType = iota
RAM
DISK
GPU
)
const (
dedicated = "dedicated"
portPrefix = "org.apache.aurora.port."
)
type AuroraTask struct {
task *aurora.TaskConfig
resources map[ResourceType]*aurora.Resource
portCount int
thermos *ThermosExecutor
}
func NewTask() *AuroraTask {
numCpus := &aurora.Resource{}
ramMb := &aurora.Resource{}
diskMb := &aurora.Resource{}
numGpus := &aurora.Resource{}
numCpus.NumCpus = new(float64)
ramMb.RamMb = new(int64)
diskMb.DiskMb = new(int64)
resources := make(map[ResourceType]*aurora.Resource)
resources[CPU] = numCpus
resources[RAM] = ramMb
resources[DISK] = diskMb
resources[GPU] = numGpus
return &AuroraTask{task: &aurora.TaskConfig{
Job: &aurora.JobKey{},
MesosFetcherUris: make([]*aurora.MesosFetcherURI, 0),
Metadata: make([]*aurora.Metadata, 0),
Constraints: make([]*aurora.Constraint, 0),
// Container is a Union so one container field must be set. Set Mesos by default.
Container: NewMesosContainer().Build(),
Resources: []*aurora.Resource{numCpus, ramMb, diskMb},
},
resources: resources,
portCount: 0}
}
// Helper method to convert aurora.TaskConfig to gorealis AuroraTask type
func TaskFromThrift(config *aurora.TaskConfig) *AuroraTask {
newTask := NewTask()
// Pass values using receivers as much as possible
newTask.
Environment(config.Job.Environment).
Role(config.Job.Role).
Name(config.Job.Name).
MaxFailure(config.MaxTaskFailures).
IsService(config.IsService)
if config.Tier != nil {
newTask.Tier(*config.Tier)
}
if config.ExecutorConfig != nil {
newTask.
ExecutorName(config.ExecutorConfig.Name).
ExecutorData(config.ExecutorConfig.Data)
}
// Make a deep copy of the task's container
if config.Container != nil {
if config.Container.Mesos != nil {
mesosContainer := NewMesosContainer()
if config.Container.Mesos.Image != nil {
if config.Container.Mesos.Image.Appc != nil {
mesosContainer.AppcImage(config.Container.Mesos.Image.Appc.Name, config.Container.Mesos.Image.Appc.ImageId)
} else if config.Container.Mesos.Image.Docker != nil {
mesosContainer.DockerImage(config.Container.Mesos.Image.Docker.Name, config.Container.Mesos.Image.Docker.Tag)
}
}
for _, vol := range config.Container.Mesos.Volumes {
mesosContainer.AddVolume(vol.ContainerPath, vol.HostPath, vol.Mode)
}
newTask.Container(mesosContainer)
} else if config.Container.Docker != nil {
dockerContainer := NewDockerContainer()
dockerContainer.Image(config.Container.Docker.Image)
for _, param := range config.Container.Docker.Parameters {
dockerContainer.AddParameter(param.Name, param.Value)
}
newTask.Container(dockerContainer)
}
}
// Copy all ports
for _, resource := range config.Resources {
// Copy only ports. Set CPU, RAM, DISK, and GPU
if resource != nil {
if resource.NamedPort != nil {
newTask.task.Resources = append(newTask.task.Resources, &aurora.Resource{NamedPort: thrift.StringPtr(*resource.NamedPort)})
newTask.portCount++
}
if resource.RamMb != nil {
newTask.RAM(*resource.RamMb)
}
if resource.NumCpus != nil {
newTask.CPU(*resource.NumCpus)
}
if resource.DiskMb != nil {
newTask.Disk(*resource.DiskMb)
}
if resource.NumGpus != nil {
newTask.GPU(*resource.NumGpus)
}
}
}
// Copy constraints
for _, constraint := range config.Constraints {
if constraint != nil && constraint.Constraint != nil {
newConstraint := aurora.Constraint{Name: constraint.Name}
taskConstraint := constraint.Constraint
if taskConstraint.Limit != nil {
newConstraint.Constraint = &aurora.TaskConstraint{Limit: &aurora.LimitConstraint{Limit: taskConstraint.Limit.Limit}}
newTask.task.Constraints = append(newTask.task.Constraints, &newConstraint)
} else if taskConstraint.Value != nil {
values := make([]string, 0)
for _, val := range taskConstraint.Value.Values {
values = append(values, val)
}
newConstraint.Constraint = &aurora.TaskConstraint{
Value: &aurora.ValueConstraint{Negated: taskConstraint.Value.Negated, Values: values}}
newTask.task.Constraints = append(newTask.task.Constraints, &newConstraint)
}
}
}
// Copy labels
for _, label := range config.Metadata {
newTask.task.Metadata = append(newTask.task.Metadata, &aurora.Metadata{Key: label.Key, Value: label.Value})
}
// Copy Mesos fetcher URIs
for _, uri := range config.MesosFetcherUris {
newTask.task.MesosFetcherUris = append(
newTask.task.MesosFetcherUris,
&aurora.MesosFetcherURI{Value: uri.Value, Extract: thrift.BoolPtr(*uri.Extract), Cache: thrift.BoolPtr(*uri.Cache)})
}
return newTask
}
// Set AuroraTask Key environment.
func (t *AuroraTask) Environment(env string) *AuroraTask {
t.task.Job.Environment = env
return t
}
// Set AuroraTask Key Role.
func (t *AuroraTask) Role(role string) *AuroraTask {
t.task.Job.Role = role
return t
}
// Set AuroraTask Key Name.
func (t *AuroraTask) Name(name string) *AuroraTask {
t.task.Job.Name = name
return t
}
// Set name of the executor that will the task will be configured to.
func (t *AuroraTask) ExecutorName(name string) *AuroraTask {
if t.task.ExecutorConfig == nil {
t.task.ExecutorConfig = aurora.NewExecutorConfig()
}
t.task.ExecutorConfig.Name = name
return t
}
// Will be included as part of entire task inside the scheduler that will be serialized.
func (t *AuroraTask) ExecutorData(data string) *AuroraTask {
if t.task.ExecutorConfig == nil {
t.task.ExecutorConfig = aurora.NewExecutorConfig()
}
t.task.ExecutorConfig.Data = data
return t
}
func (t *AuroraTask) CPU(cpus float64) *AuroraTask {
*t.resources[CPU].NumCpus = cpus
return t
}
func (t *AuroraTask) RAM(ram int64) *AuroraTask {
*t.resources[RAM].RamMb = ram
return t
}
func (t *AuroraTask) Disk(disk int64) *AuroraTask {
*t.resources[DISK].DiskMb = disk
return t
}
func (t *AuroraTask) GPU(gpu int64) *AuroraTask {
*t.resources[GPU].NumGpus = gpu
return t
}
func (t *AuroraTask) Tier(tier string) *AuroraTask {
t.task.Tier = &tier
return t
}
// How many failures to tolerate before giving up.
func (t *AuroraTask) MaxFailure(maxFail int32) *AuroraTask {
t.task.MaxTaskFailures = maxFail
return t
}
// Restart the job's tasks if they fail
func (t *AuroraTask) IsService(isService bool) *AuroraTask {
t.task.IsService = isService
return t
}
// Add a list of URIs with the same extract and cache configuration. Scheduler must have
// --enable_mesos_fetcher flag enabled. Currently there is no duplicate detection.
func (t *AuroraTask) AddURIs(extract bool, cache bool, values ...string) *AuroraTask {
for _, value := range values {
t.task.MesosFetcherUris = append(
t.task.MesosFetcherUris,
&aurora.MesosFetcherURI{Value: value, Extract: &extract, Cache: &cache})
}
return t
}
// Adds a Mesos label to the job. Note that Aurora will add the
// prefix "org.apache.aurora.metadata." to the beginning of each key.
func (t *AuroraTask) AddLabel(key string, value string) *AuroraTask {
t.task.Metadata = append(t.task.Metadata, &aurora.Metadata{Key: key, Value: value})
return t
}
// Add a named port to the job configuration These are random ports as it's
// not currently possible to request specific ports using Aurora.
func (t *AuroraTask) AddNamedPorts(names ...string) *AuroraTask {
t.portCount += len(names)
for _, name := range names {
t.task.Resources = append(t.task.Resources, &aurora.Resource{NamedPort: &name})
}
return t
}
// Adds a request for a number of ports to the job configuration. The names chosen for these ports
// will be org.apache.aurora.port.X, where X is the current port count for the job configuration
// starting at 0. These are random ports as it's not currently possible to request
// specific ports using Aurora.
func (t *AuroraTask) AddPorts(num int) *AuroraTask {
start := t.portCount
t.portCount += num
for i := start; i < t.portCount; i++ {
portName := portPrefix + strconv.Itoa(i)
t.task.Resources = append(t.task.Resources, &aurora.Resource{NamedPort: &portName})
}
return t
}
// From Aurora Docs:
// Add a Value constraint
// name - Mesos slave attribute that the constraint is matched against.
// If negated = true , treat this as a 'not' - to avoid specific values.
// Values - list of values we look for in attribute name
func (t *AuroraTask) AddValueConstraint(name string, negated bool, values ...string) *AuroraTask {
t.task.Constraints = append(t.task.Constraints,
&aurora.Constraint{
Name: name,
Constraint: &aurora.TaskConstraint{
Value: &aurora.ValueConstraint{
Negated: negated,
Values: values,
},
Limit: nil,
},
})
return t
}
// From Aurora Docs:
// A constraint that specifies the maximum number of active tasks on a host with
// a matching attribute that may be scheduled simultaneously.
func (t *AuroraTask) AddLimitConstraint(name string, limit int32) *AuroraTask {
t.task.Constraints = append(t.task.Constraints,
&aurora.Constraint{
Name: name,
Constraint: &aurora.TaskConstraint{
Value: nil,
Limit: &aurora.LimitConstraint{Limit: limit},
},
})
return t
}
// From Aurora Docs:
// dedicated attribute. Aurora treats this specially, and only allows matching jobs
// to run on these machines, and will only schedule matching jobs on these machines.
// When a job is created, the scheduler requires that the $role component matches
// the role field in the job configuration, and will reject the job creation otherwise.
// A wildcard (*) may be used for the role portion of the dedicated attribute, which
// will allow any owner to elect for a job to run on the host(s)
func (t *AuroraTask) AddDedicatedConstraint(role, name string) *AuroraTask {
t.AddValueConstraint(dedicated, false, role+"/"+name)
return t
}
// Set a container to run for the job configuration to run.
func (t *AuroraTask) Container(container Container) *AuroraTask {
t.task.Container = container.Build()
return t
}
func (t *AuroraTask) TaskConfig() *aurora.TaskConfig {
return t.task
}
func (t *AuroraTask) JobKey() aurora.JobKey {
return *t.task.Job
}
func (t *AuroraTask) Clone() *AuroraTask {
newTask := TaskFromThrift(t.task)
if t.thermos != nil {
newTask.ThermosExecutor(*t.thermos.Clone())
}
return newTask
}
func (t *AuroraTask) ThermosExecutor(thermos ThermosExecutor) *AuroraTask {
t.thermos = &thermos
return t
}
func (t *AuroraTask) BuildThermosPayload() error {
if t.thermos != nil {
// Set the correct resources
if t.resources[CPU].NumCpus != nil {
t.thermos.cpu(*t.resources[CPU].NumCpus)
}
if t.resources[RAM].RamMb != nil {
t.thermos.ram(*t.resources[RAM].RamMb)
}
if t.resources[DISK].DiskMb != nil {
t.thermos.disk(*t.resources[DISK].DiskMb)
}
if t.resources[GPU].NumGpus != nil {
t.thermos.gpu(*t.resources[GPU].NumGpus)
}
payload, err := json.Marshal(t.thermos)
if err != nil {
return err
}
t.ExecutorName(aurora.AURORA_EXECUTOR_NAME)
t.ExecutorData(string(payload))
}
return nil
}

57
task_test.go Normal file
View file

@ -0,0 +1,57 @@
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package realis_test
import (
"testing"
realis "github.com/paypal/gorealis/v2"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
"github.com/stretchr/testify/assert"
)
func TestAuroraTask_Clone(t *testing.T) {
task0 := realis.NewTask().
Environment("development").
Role("ubuntu").
Name("this_is_a_test").
ExecutorName(aurora.AURORA_EXECUTOR_NAME).
ExecutorData("{fake:payload}").
CPU(10).
RAM(643).
Disk(1000).
IsService(true).
AddPorts(10).
Tier("preferred").
MaxFailure(23).
AddURIs(true, true, "testURI").
AddLabel("Test", "Value").
AddNamedPorts("test").
AddValueConstraint("test", false, "testing").
AddLimitConstraint("test_limit", 1).
AddDedicatedConstraint("ubuntu", "name").
Container(realis.NewDockerContainer().AddParameter("hello", "world").Image("testImg"))
task1 := task0.Clone()
assert.EqualValues(t, task0, task1, "Clone does not return the correct deep copy of AuroraTask")
task0.Container(realis.NewMesosContainer().
AppcImage("test", "testing").
AddVolume("test", "test", aurora.Mode_RW))
task2 := task0.Clone()
assert.EqualValues(t, task0, task2, "Clone does not return the correct deep copy of AuroraTask")
}

195
thermos.go Normal file
View file

@ -0,0 +1,195 @@
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package realis
import "encoding/json"
type ThermosExecutor struct {
Task ThermosTask `json:"task""`
order *ThermosConstraint `json:"-"`
}
type ThermosTask struct {
Processes map[string]*ThermosProcess `json:"processes"`
Constraints []*ThermosConstraint `json:"constraints"`
Resources thermosResources `json:"resources"`
}
type ThermosConstraint struct {
Order []string `json:"order,omitempty"`
}
// This struct should always be controlled by the Aurora job struct.
// Therefore it is private.
type thermosResources struct {
CPU *float64 `json:"cpu,omitempty"`
Disk *int64 `json:"disk,omitempty"`
RAM *int64 `json:"ram,omitempty"`
GPU *int64 `json:"gpu,omitempty"`
}
type ThermosProcess struct {
Name string `json:"name"`
Cmdline string `json:"cmdline"`
Daemon bool `json:"daemon"`
Ephemeral bool `json:"ephemeral"`
MaxFailures int `json:"max_failures"`
MinDuration int `json:"min_duration"`
Final bool `json:"final"`
}
func NewThermosProcess(name, command string) ThermosProcess {
return ThermosProcess{
Name: name,
Cmdline: command,
MaxFailures: 1,
Daemon: false,
Ephemeral: false,
MinDuration: 5,
Final: false}
}
// Processes must have unique names. Adding a process whose name already exists will
// result in overwriting the previous version of the process.
func (t *ThermosExecutor) AddProcess(process ThermosProcess) *ThermosExecutor {
if len(t.Task.Processes) == 0 {
t.Task.Processes = make(map[string]*ThermosProcess, 0)
}
t.Task.Processes[process.Name] = &process
// Add Process to order
t.addToOrder(process.Name)
return t
}
// Only constraint that should be added for now is the order of execution, therefore this
// receiver is private.
func (t *ThermosExecutor) addConstraint(constraint *ThermosConstraint) *ThermosExecutor {
if len(t.Task.Constraints) == 0 {
t.Task.Constraints = make([]*ThermosConstraint, 0)
}
t.Task.Constraints = append(t.Task.Constraints, constraint)
return t
}
// Order in which the Processes should be executed. Index 0 will be executed first, index N will be executed last.
func (t *ThermosExecutor) ProcessOrder(order ...string) *ThermosExecutor {
if t.order == nil {
t.order = &ThermosConstraint{}
t.addConstraint(t.order)
}
t.order.Order = order
return t
}
// Add Process to execution order. By default this is a FIFO setup. Custom order can be given by overriding
// with ProcessOrder
func (t *ThermosExecutor) addToOrder(name string) {
if t.order == nil {
t.order = &ThermosConstraint{Order: make([]string, 0)}
t.addConstraint(t.order)
}
t.order.Order = append(t.order.Order, name)
}
// Ram is determined by the job object.
func (t *ThermosExecutor) ram(ram int64) {
// Convert from bytes to MiB
ram *= 1024 ^ 2
t.Task.Resources.RAM = &ram
}
// Disk is determined by the job object.
func (t *ThermosExecutor) disk(disk int64) {
// Convert from bytes to MiB
disk *= 1024 ^ 2
t.Task.Resources.Disk = &disk
}
// CPU is determined by the job object.
func (t *ThermosExecutor) cpu(cpu float64) {
t.Task.Resources.CPU = &cpu
}
// GPU is determined by the job object.
func (t *ThermosExecutor) gpu(gpu int64) {
t.Task.Resources.GPU = &gpu
}
// Deep copy of Thermos executor
func (t *ThermosExecutor) Clone() *ThermosExecutor {
tNew := ThermosExecutor{}
if t.order != nil {
tNew.order = &ThermosConstraint{Order: t.order.Order}
tNew.addConstraint(tNew.order)
}
tNew.Task.Processes = make(map[string]*ThermosProcess)
for name, process := range t.Task.Processes {
newProcess := *process
tNew.Task.Processes[name] = &newProcess
}
tNew.Task.Resources = t.Task.Resources
return &tNew
}
type thermosTaskJSON struct {
Processes []*ThermosProcess `json:"processes"`
Constraints []*ThermosConstraint `json:"constraints"`
Resources thermosResources `json:"resources"`
}
// Custom Marshaling for Thermos Task to match what Thermos expects
func (t *ThermosTask) MarshalJSON() ([]byte, error) {
// Convert map to array to match what Thermos expects
processes := make([]*ThermosProcess, 0)
for _, process := range t.Processes {
processes = append(processes, process)
}
return json.Marshal(&thermosTaskJSON{
Processes: processes,
Constraints: t.Constraints,
Resources: t.Resources,
})
}
// Custom Unmarshaling to match what Thermos would contain
func (t *ThermosTask) UnmarshalJSON(data []byte) error {
// Thermos format
aux := &thermosTaskJSON{}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
processes := make(map[string]*ThermosProcess)
for _, process := range aux.Processes {
processes[process.Name] = process
}
return nil
}

71
thermos_test.go Normal file
View file

@ -0,0 +1,71 @@
package realis
import (
"encoding/json"
"testing"
"git.apache.org/thrift.git/lib/go/thrift"
"github.com/stretchr/testify/assert"
)
func TestThermosTask(t *testing.T) {
// Test that we can successfully deserialize a minimum subset of an Aurora generated thermos payload
thermosJSON := []byte(
`{
"task": {
"processes": [
{
"daemon": false,
"name": "hello",
"ephemeral": false,
"max_failures": 1,
"min_duration": 5,
"cmdline": "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ",
"final": false
}
],
"resources": {
"gpu": 0,
"disk": 134217728,
"ram": 134217728,
"cpu": 1.1
},
"constraints": [
{
"order": [
"hello"
]
}
]
}
}`)
thermos := ThermosExecutor{}
err := json.Unmarshal(thermosJSON, &thermos)
assert.NoError(t, err)
process := &ThermosProcess{
Daemon: false,
Name: "hello",
Ephemeral: false,
MaxFailures: 1,
MinDuration: 5,
Cmdline: "\n while true; do\n echo hello world from gorealis\n sleep 10\n done\n ",
Final: false,
}
constraint := &ThermosConstraint{Order: []string{process.Name}}
thermosExpected := ThermosExecutor{
Task: ThermosTask{
Processes: map[string]*ThermosProcess{process.Name: process},
Constraints: []*ThermosConstraint{constraint},
Resources: thermosResources{CPU: thrift.Float64Ptr(1.1),
Disk: thrift.Int64Ptr(134217728),
RAM: thrift.Int64Ptr(134217728),
GPU: thrift.Int64Ptr(0)}}}
assert.ObjectsAreEqualValues(thermosExpected, thermos)
}

View file

@ -1,154 +0,0 @@
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package realis
import (
"github.com/paypal/gorealis/gen-go/apache/aurora"
)
// Structure to collect all information required to create job update
type UpdateJob struct {
Job // SetInstanceCount for job is hidden, access via full qualifier
req *aurora.JobUpdateRequest
}
// Create a default UpdateJob object.
func NewDefaultUpdateJob(config *aurora.TaskConfig) *UpdateJob {
req := aurora.NewJobUpdateRequest()
req.TaskConfig = config
req.Settings = NewUpdateSettings()
job := NewJob().(*AuroraJob)
job.jobConfig.TaskConfig = config
// Rebuild resource map from TaskConfig
for ptr := range config.Resources {
if ptr.NumCpus != nil {
job.resources["cpu"].NumCpus = ptr.NumCpus
continue // Guard against Union violations that Go won't enforce
}
if ptr.RamMb != nil {
job.resources["ram"].RamMb = ptr.RamMb
continue
}
if ptr.DiskMb != nil {
job.resources["disk"].DiskMb = ptr.DiskMb
continue
}
}
// Mirrors defaults set by Pystachio
req.Settings.UpdateOnlyTheseInstances = make(map[*aurora.Range]bool)
req.Settings.UpdateGroupSize = 1
req.Settings.WaitForBatchCompletion = false
req.Settings.MinWaitInInstanceRunningMs = 45000
req.Settings.MaxPerInstanceFailures = 0
req.Settings.MaxFailedInstances = 0
req.Settings.RollbackOnFailure = true
//TODO(rdelvalle): Deep copy job struct to avoid unexpected behavior
return &UpdateJob{Job: job, req: req}
}
func NewUpdateJob(config *aurora.TaskConfig, settings *aurora.JobUpdateSettings) *UpdateJob {
req := aurora.NewJobUpdateRequest()
req.TaskConfig = config
req.Settings = settings
job := NewJob().(*AuroraJob)
job.jobConfig.TaskConfig = config
// Rebuild resource map from TaskConfig
for ptr := range config.Resources {
if ptr.NumCpus != nil {
job.resources["cpu"].NumCpus = ptr.NumCpus
continue // Guard against Union violations that Go won't enforce
}
if ptr.RamMb != nil {
job.resources["ram"].RamMb = ptr.RamMb
continue
}
if ptr.DiskMb != nil {
job.resources["disk"].DiskMb = ptr.DiskMb
continue
}
}
//TODO(rdelvalle): Deep copy job struct to avoid unexpected behavior
return &UpdateJob{Job: job, req: req}
}
// Set instance count the job will have after the update.
func (u *UpdateJob) InstanceCount(inst int32) *UpdateJob {
u.req.InstanceCount = inst
return u
}
// Max number of instances being updated at any given moment.
func (u *UpdateJob) BatchSize(size int32) *UpdateJob {
u.req.Settings.UpdateGroupSize = size
return u
}
// Minimum number of seconds a shard must remain in RUNNING state before considered a success.
func (u *UpdateJob) WatchTime(ms int32) *UpdateJob {
u.req.Settings.MinWaitInInstanceRunningMs = ms
return u
}
// Wait for all instances in a group to be done before moving on.
func (u *UpdateJob) WaitForBatchCompletion(batchWait bool) *UpdateJob {
u.req.Settings.WaitForBatchCompletion = batchWait
return u
}
// Max number of instance failures to tolerate before marking instance as FAILED.
func (u *UpdateJob) MaxPerInstanceFailures(inst int32) *UpdateJob {
u.req.Settings.MaxPerInstanceFailures = inst
return u
}
// Max number of FAILED instances to tolerate before terminating the update.
func (u *UpdateJob) MaxFailedInstances(inst int32) *UpdateJob {
u.req.Settings.MaxFailedInstances = inst
return u
}
// When False, prevents auto rollback of a failed update.
func (u *UpdateJob) RollbackOnFail(rollback bool) *UpdateJob {
u.req.Settings.RollbackOnFailure = rollback
return u
}
func NewUpdateSettings() *aurora.JobUpdateSettings {
us := new(aurora.JobUpdateSettings)
// Mirrors defaults set by Pystachio
us.UpdateOnlyTheseInstances = make(map[*aurora.Range]bool)
us.UpdateGroupSize = 1
us.WaitForBatchCompletion = false
us.MinWaitInInstanceRunningMs = 45000
us.MaxPerInstanceFailures = 0
us.MaxFailedInstances = 0
us.RollbackOnFailure = true
return us
}

75
util.go Normal file
View file

@ -0,0 +1,75 @@
package realis
import (
"net/url"
"strings"
"github.com/paypal/gorealis/v2/gen-go/apache/aurora"
"github.com/pkg/errors"
)
var ActiveStates = make(map[aurora.ScheduleStatus]bool)
var SlaveAssignedStates = make(map[aurora.ScheduleStatus]bool)
var LiveStates = make(map[aurora.ScheduleStatus]bool)
var TerminalStates = make(map[aurora.ScheduleStatus]bool)
var ActiveJobUpdateStates = make(map[aurora.JobUpdateStatus]bool)
var AwaitingPulseJobUpdateStates = make(map[aurora.JobUpdateStatus]bool)
func init() {
for _, status := range aurora.ACTIVE_STATES {
ActiveStates[status] = true
}
for _, status := range aurora.SLAVE_ASSIGNED_STATES {
SlaveAssignedStates[status] = true
}
for _, status := range aurora.LIVE_STATES {
LiveStates[status] = true
}
for _, status := range aurora.TERMINAL_STATES {
TerminalStates[status] = true
}
for _, status := range aurora.ACTIVE_JOB_UPDATE_STATES {
ActiveJobUpdateStates[status] = true
}
for _, status := range aurora.AWAITNG_PULSE_JOB_UPDATE_STATES {
AwaitingPulseJobUpdateStates[status] = true
}
}
func validateAndPopulateAuroraURL(urlStr string) (string, error) {
// If no protocol defined, assume http
if !strings.Contains(urlStr, "://") {
urlStr = "http://" + urlStr
}
u, err := url.Parse(urlStr)
if err != nil {
return "", errors.Wrap(err, "error parsing url")
}
// If no path provided assume /api
if u.Path == "" {
u.Path = "/api"
}
// If no port provided, assume default 8081
if u.Port() == "" {
u.Host = u.Host + ":8081"
}
if !(u.Scheme == "http" || u.Scheme == "https") {
return "", errors.Errorf("only protocols http and https are supported %v\n", u.Scheme)
}
if u.Path != "/api" {
return "", errors.Errorf("expected /api path %v\n", u.Path)
}
return u.String(), nil
}

9
vendor/git.apache.org/thrift.git/.eslintignore generated vendored Normal file
View file

@ -0,0 +1,9 @@
# TODO: Use eslint on js lib and generated code
# Ignore lib/js for now, which uses jshint currently
lib/js/*
# Ignore all generated code for now
**/gen-*
# Don't lint nested node_modules
**/node_modules

24
vendor/git.apache.org/thrift.git/.eslintrc.json generated vendored Normal file
View file

@ -0,0 +1,24 @@
{
"env": {
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaVersion": 2017
},
"rules": {
"no-console": "off",
"no-var": "error",
"prefer-const": "error",
"no-constant-condition": [
"error",
{
"checkLoops": false
}
]
}
}

59
vendor/git.apache.org/thrift.git/.github/stale.yml generated vendored Normal file
View file

@ -0,0 +1,59 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 60
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- Do Not Merge
- blocked
- pinned
- security
- "[Status] Maybe Later"
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Label to use when marking as stale
staleLabel: wontfix
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed in 7 days if no further activity occurs.
Thank you for your contributions.
# Comment to post when removing the stale label.
unmarkComment: >
This issue is no longer stale.
Thank you for your contributions.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
This issue has been automatically closed due to inactivity.
Thank you for your contributions.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
# Limit to only `issues` or `pulls`
# only: issues
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
# pulls:
# daysUntilStale: 30
# markComment: >
# This pull request has been automatically marked as stale because it has not had
# recent activity. It will be closed if no further activity occurs. Thank you
# for your contributions.
# issues:
# exemptLabels:
# - confirmed

View file

@ -21,28 +21,41 @@
*.swp
*.hi
*~
tags
.*project
.classpath
.dub
.settings
.checkstyle
junit*.properties
.idea
*.iml
*.ipr
*.iws
gen-*
Makefile
Makefile.in
aclocal.m4
acinclude.m4
apache-thrift-test-library
autom4te.cache
cmake-*
dub.selections.json
libapache-thrift.a
node_modules
compile
test-driver
erl_crash.dump
project.lock.json
.sonar
.DS_Store
.svn
.vagrant
.vscode
.vs
/contrib/.vagrant/
/aclocal/libtool.m4
/aclocal/lt*.m4
/autoscan.log
@ -77,6 +90,7 @@ erl_crash.dump
/configure
/configure.lineno
/configure.scan
/contrib/.vagrant/
/contrib/fb303/config.cache
/contrib/fb303/config.log
/contrib/fb303/config.status
@ -91,6 +105,13 @@ erl_crash.dump
/contrib/fb303/py/fb303/ttypes.py
/depcomp
/install-sh
/lib/cl/backport-update.zip
/lib/cl/lib
/lib/cl/run-tests
/lib/cl/quicklisp.lisp
/lib/cl/externals/
/lib/cl/run-tests
/lib/cl/quicklisp/
/lib/cpp/Debug/
/lib/cpp/Debug-mt/
/lib/cpp/Release/
@ -101,6 +122,7 @@ erl_crash.dump
/lib/cpp/src/thrift/stamp-h2
/lib/cpp/test/Benchmark
/lib/cpp/test/AllProtocolsTest
/lib/cpp/test/AnnotationTest
/lib/cpp/test/DebugProtoTest
/lib/cpp/test/DenseProtoTest
/lib/cpp/test/EnumTest
@ -108,12 +130,14 @@ erl_crash.dump
/lib/cpp/test/OptionalRequiredTest
/lib/cpp/test/SecurityTest
/lib/cpp/test/SpecializationTest
/lib/cpp/test/ReflectionTest
/lib/cpp/test/RecursiveTest
/lib/cpp/test/ReflectionTest
/lib/cpp/test/RenderedDoubleConstantsTest
/lib/cpp/test/TFDTransportTest
/lib/cpp/test/TFileTransportTest
/lib/cpp/test/TInterruptTest
/lib/cpp/test/TNonblockingServerTest
/lib/cpp/test/TNonblockingSSLServerTest
/lib/cpp/test/TPipedTransportTest
/lib/cpp/test/TServerIntegrationTest
/lib/cpp/test/TSocketInterruptTest
@ -149,6 +173,7 @@ erl_crash.dump
/lib/c_glib/test/testframedtransport
/lib/c_glib/test/testmemorybuffer
/lib/c_glib/test/testoptionalrequired
/lib/c_glib/test/testtransportsslsocket
/lib/c_glib/test/testsimpleserver
/lib/c_glib/test/teststruct
/lib/c_glib/test/testthrifttest
@ -175,46 +200,35 @@ erl_crash.dump
/lib/dart/**/packages
/lib/dart/**/.pub/
/lib/dart/**/pubspec.lock
/lib/delphi/src/*.dcu
/lib/delphi/test/*.identcache
/lib/delphi/test/*.local
/lib/delphi/test/*.dcu
/lib/delphi/test/*.2007
/lib/delphi/test/*.dproj
/lib/delphi/test/*.dproj
/lib/delphi/test/codegen/*.bat
/lib/delphi/test/skip/*.local
/lib/delphi/test/skip/*.identcache
/lib/delphi/test/skip/*.identcache
/lib/delphi/test/skip/*.dproj
/lib/delphi/test/skip/*.dproj
/lib/delphi/test/skip/*.2007
/lib/delphi/test/serializer/*.identcache
/lib/delphi/test/serializer/*.dproj
/lib/delphi/test/serializer/*.local
/lib/delphi/test/serializer/*.2007
/lib/delphi/test/serializer/*.dcu
/lib/delphi/test/multiplexed/*.dproj
/lib/delphi/test/multiplexed/*.2007
/lib/delphi/test/multiplexed/*.local
/lib/delphi/test/multiplexed/*.identcache
/lib/delphi/test/multiplexed/*.dcu
/lib/delphi/test/typeregistry/*.2007
/lib/delphi/test/typeregistry/*.dproj
/lib/delphi/test/typeregistry/*.identcache
/lib/delphi/test/typeregistry/*.local
/lib/delphi/test/typeregistry/*.dcu
/lib/erl/.generated
/lib/delphi/test/skip/*.request
/lib/delphi/test/skip/*.response
/lib/delphi/**/*.identcache
/lib/delphi/**/*.local
/lib/delphi/**/*.dcu
/lib/delphi/**/*.2007
/lib/delphi/**/*.dproj
/lib/delphi/**/codegen/*.bat
/lib/erl/.eunit
/lib/erl/ebin
/lib/erl/.generated
/lib/erl/.rebar/
/lib/erl/deps/
/lib/erl/ebin
/lib/erl/src/thrift.app.src
/lib/erl/test/*.hrl
/lib/erl/test/*.beam
/lib/erl/test/*.hrl
/lib/erl/test/Thrift_omit_without.thrift
/lib/haxe/test/bin
/lib/haxe/test/data.tmp
/lib/hs/dist
/lib/java/.gradle
/lib/java/android/.gradle
/lib/java/build
/lib/java/target
/lib/js/dist
/lib/js/doc
/lib/js/test/build
/lib/netcore/**/bin
/lib/netcore/**/obj
/lib/nodejs/coverage
/lib/nodejs/node_modules/
/lib/perl/MANIFEST
@ -238,6 +252,7 @@ erl_crash.dump
/lib/php/src/ext/thrift_protocol/build/
/lib/php/src/ext/thrift_protocol/config.*
/lib/php/src/ext/thrift_protocol/configure
/lib/php/src/ext/thrift_protocol/configure.ac
/lib/php/src/ext/thrift_protocol/configure.in
/lib/php/src/ext/thrift_protocol/install-sh
/lib/php/src/ext/thrift_protocol/libtool
@ -254,21 +269,41 @@ erl_crash.dump
/lib/php/test/packages/
/lib/py/dist/
/lib/erl/logs/
/lib/go/pkg
/lib/go/src
/lib/go/test/gopath/
/lib/go/test/ThriftTest.thrift
/lib/rs/target/
/lib/rs/Cargo.lock
/lib/rs/test/Cargo.lock
/lib/rs/test/target/
/lib/rs/test/bin/
/lib/rs/test/src/base_one.rs
/lib/rs/test/src/base_two.rs
/lib/rs/test/src/midlayer.rs
/lib/rs/test/src/recursive.rs
/lib/rs/test/src/ultimate.rs
/lib/rs/*.iml
/lib/rs/**/*.iml
/libtool
/ltmain.sh
/missing
/node_modules/
/vendor/
/composer.lock
/stamp-h1
/test/features/results.json
/test/results.json
/test/c_glib/test_client
/test/c_glib/test_server
/test/cl/TestServer
/test/cl/TestClient
/test/cpp/StressTest
/test/cpp/StressTestNonBlocking
/test/cpp/TestClient
/test/cpp/TestServer
/test/csharp/obj
/test/csharp/bin
/test/dart/**/.packages
/test/dart/**/packages
/test/dart/**/.pub/
@ -276,20 +311,45 @@ erl_crash.dump
/test/log/
/test/test.log
/test/erl/.generated
/test/erl/.rebar
/test/erl/ebin
/test/go/bin/
/test/go/ThriftTest.thrift
/test/go/gopath
/test/go/pkg/
/test/go/src/code.google.com/
/test/go/src/common/mock_handler.go
/test/go/src/github.com/golang/
/test/go/src/golang.org/
/test/go/src/gen/
/test/go/src/thrift
/test/haxe/bin
/test/hs/TestClient
/test/hs/TestServer
/test/php/php_ext_dir/
/test/py.twisted/_trial_temp/
/test/rb/Gemfile.lock
/test/netcore/**/bin
/test/netcore/**/obj
/test/netcore/Thrift
/test/php/php_ext_dir/
/test/rs/Cargo.lock
/test/rs/src/thrift_test.rs
/test/rs/bin/
/test/rs/target/
/test/rs/*.iml
/test/rs/**/*.iml
/lib/cl/backport-update.zip
/lib/cl/lib
/tutorial/cl/quicklisp.lisp
/tutorial/cl/externals/
/tutorial/cl/quicklisp/
/tutorial/cl/TutorialClient
/tutorial/cl/TutorialServer
/tutorial/cl/backport-update.zip
/tutorial/cl/lib/
/tutorial/cl/shared-implementation.fasl
/tutorial/cl/tutorial-implementation.fasl
/tutorial/cpp/TutorialClient
/tutorial/cpp/TutorialServer
/tutorial/c_glib/tutorial_client
@ -305,22 +365,31 @@ erl_crash.dump
/tutorial/dart/**/packages
/tutorial/dart/**/.pub/
/tutorial/dart/**/pubspec.lock
/tutorial/delphi/*.dsk
/tutorial/delphi/*.local
/tutorial/delphi/*.tvsconfig
/tutorial/delphi/DelphiClient/dcu
/tutorial/delphi/DelphiServer/dcu
/tutorial/delphi/DelphiClient/*.local
/tutorial/delphi/DelphiClient/*.identcache
/tutorial/delphi/DelphiServer/*.identcache
/tutorial/delphi/DelphiServer/*.local
/tutorial/delphi/**/*.dsk
/tutorial/delphi/**/*.local
/tutorial/delphi/**/*.tvsconfig
/tutorial/delphi/**/dcu
/tutorial/delphi/**/*.local
/tutorial/delphi/**/*.identcache
/tutorial/go/gopath
/tutorial/go/go-tutorial
/tutorial/go/calculator-remote
/tutorial/go/src/shared
/tutorial/go/src/tutorial
/tutorial/go/src/git.apache.org
/tutorial/go/src/golang.org
/tutorial/haxe/bin
/tutorial/hs/dist/
/tutorial/java/build/
/tutorial/js/build/
/tutorial/netcore/**/bin
/tutorial/netcore/**/obj
/tutorial/netcore/Thrift
/tutorial/rs/*.iml
/tutorial/rs/src/shared.rs
/tutorial/rs/src/tutorial.rs
/tutorial/rs/bin
/tutorial/rs/target
/tutorial/rs/Cargo.lock
/ylwrap

64
vendor/git.apache.org/thrift.git/.rustfmt.toml generated vendored Normal file
View file

@ -0,0 +1,64 @@
max_width = 100
hard_tabs = false
tab_spaces = 4
newline_style = "Auto"
use_small_heuristics = "Default"
indent_style = "Block"
wrap_comments = false
format_doc_comments = false
comment_width = 80
normalize_comments = false
normalize_doc_attributes = false
license_template_path = ""
format_strings = false
format_macro_matchers = false
format_macro_bodies = true
empty_item_single_line = true
struct_lit_single_line = true
fn_single_line = false
where_single_line = false
imports_indent = "Block"
imports_layout = "Mixed"
merge_imports = false
reorder_imports = true
reorder_modules = true
reorder_impl_items = false
type_punctuation_density = "Wide"
space_before_colon = false
space_after_colon = true
spaces_around_ranges = false
binop_separator = "Front"
remove_nested_parens = true
combine_control_expr = true
overflow_delimited_expr = false
struct_field_align_threshold = 0
enum_discrim_align_threshold = 0
match_arm_blocks = true
force_multiline_blocks = false
fn_args_density = "Tall"
brace_style = "SameLineWhere"
control_brace_style = "AlwaysSameLine"
trailing_semicolon = true
trailing_comma = "Vertical"
match_block_trailing_comma = false
blank_lines_upper_bound = 1
blank_lines_lower_bound = 0
edition = "2015"
merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
condense_wildcard_suffixes = false
color = "Auto"
required_version = "1.0.0"
unstable_features = false
disable_all_formatting = false
skip_children = false
hide_parse_errors = false
error_on_line_overflow = false
error_on_unformatted = false
report_todo = "Never"
report_fixme = "Never"
ignore = []
emit_mode = "Files"
make_backup = false

View file

@ -19,181 +19,163 @@
# build Apache Thrift on Travis CI - https://travis-ci.org/
#
# Docker Integration
# see: build/docker/README.md
#
sudo: required
dist: trusty
language: cpp
services:
- docker
install:
- (travis_wait ./build/docker/check_unmodified.sh $DISTRO && touch .unmodified) || true
- if [ ! -f .unmodified ]; then travis_retry travis_wait docker build -q -t thrift-build:$DISTRO build/docker/$DISTRO; fi
- if [[ `uname` == "Linux" ]]; then build/docker/refresh.sh; fi
script:
- docker run --net=host -e BUILD_LIBS="$BUILD_LIBS" $BUILD_ENV -v $(pwd):/thrift/src -it thrift-build:$DISTRO build/docker/scripts/$SCRIPT $BUILD_ARG
stages:
- docker # docker images
- thrift # thrift build jobs
env:
global:
- TEST_NAME=""
- SCRIPT="cmake.sh"
- BUILD_ARG=""
- BUILD_ENV="-e CC=clang -e CXX=clang++"
- DISTRO=ubuntu
- BUILD_ENV="-e CC=gcc -e CXX=g++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
- DISTRO=ubuntu-bionic
- BUILD_LIBS="CPP C_GLIB HASKELL JAVA PYTHON TESTING TUTORIALS" # only meaningful for CMake builds
- TRAVIS_BUILD_STAGE=test
# DOCKER_REPO (this works for all builds as a source for docker images - you can override for fork builds in your Travis settings)
- DOCKER_REPO="thrift/thrift-build"
# DOCKER_USER (provide in your Travis settings if you want to build and update docker images once, instead of on every job)
# DOCKER_PASS (same)
matrix:
- TEST_NAME="Cross Language Tests (Binary and Header Protocols)"
SCRIPT="cross-test.sh"
BUILD_ARG="-'(binary|header)'"
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
- TEST_NAME="Cross Language Tests (Debian) (Binary and Header Protocols)"
SCRIPT="cross-test.sh"
BUILD_ARG="-'(binary|header)'"
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
DISTRO=debian
- TEST_NAME="Cross Language Tests (Compact and JSON Protocols)"
SCRIPT="cross-test.sh"
BUILD_ARG="-'(compact|json)'"
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
- TEST_NAME="Cross Language Tests (Debian) (Compact and JSON Protocols)"
SCRIPT="cross-test.sh"
BUILD_ARG="-'(compact|json)'"
BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
DISTRO=debian
# TODO: Remove them once migrated to CMake
# Autotools builds
- TEST_NAME="C C++ C# D Erlang Haxe Go (automake)"
SCRIPT="autotools.sh"
BUILD_ARG="--without-dart --without-haskell --without-java --without-lua --without-nodejs --without-perl --without-php --without-php_extension --without-python --without-ruby"
- TEST_NAME="C C++ - GCC (automake)"
SCRIPT="autotools.sh"
BUILD_ARG="--without-csharp --without-java --without-erlang --without-nodejs --without-lua --without-python --without-perl --without-php --without-php_extension --without-dart --without-ruby --without-haskell --without-go --without-haxe --without-d"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="Java Lua PHP Ruby Dart (automake)"
SCRIPT="autotools.sh"
BUILD_ARG="--without-cpp --without-haskell --without-c_glib --without-csharp --without-d --without-erlang --without-go --without-haxe --without-nodejs --without-python --without-perl"
# These are flaky (due to cabal and npm network/server failures) and also have lengthy output
- TEST_NAME="Haskell Node.js Python Perl (automake)"
SCRIPT="autotools.sh"
BUILD_ARG="--without-cpp --without-c_glib --without-csharp --without-d --without-dart --without-erlang --without-go --without-haxe --without-java --without-lua --without-php --without-php_extension --without-ruby"
# CMake build
- TEST_NAME="All"
- TEST_NAME="All (Debian)"
DISTRO=debian
- TEST_NAME="C C++ - GCC"
BUILD_LIBS="CPP C_GLIB TESTING TUTORIALS"
BUILD_ARG="-DWITH_PYTHON=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="C++ (Boost Thread)"
BUILD_LIBS="CPP TESTING TUTORIALS"
BUILD_ARG="-DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
- TEST_NAME="C++ (Boost Thread - GCC)"
BUILD_LIBS="CPP TESTING TUTORIALS"
BUILD_ARG="-DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="C++ (Std Thread)"
BUILD_LIBS="CPP TESTING TUTORIALS"
BUILD_ARG="-DWITH_STDTHREADS=ON -DCMAKE_CXX_FLAGS='-std=c++11' -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
- TEST_NAME="C++ (Std Thread - GCC)"
BUILD_LIBS="CPP TESTING TUTORIALS"
BUILD_ARG="-DWITH_STDTHREADS=ON -DCMAKE_CXX_FLAGS='-std=c++11' -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="Compiler (mingw)"
BUILD_LIBS=""
BUILD_ARG="-DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake -DBUILD_COMPILER=ON -DBUILD_LIBRARIES=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF"
BUILD_ENV=""
- TEST_NAME="All - GCC (CentOS)"
BUILD_ENV="-e CC=gcc -e CXX=g++"
DISTRO=centos
- TEST_NAME="C C++ - Clang (CentOS)"
BUILD_LIBS="CPP C_GLIB TESTING TUTORIALS"
BUILD_ARG="-DWITH_PYTHON=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
DISTRO=centos
- TEST_NAME="Python 2.6 (CentOS 6)"
BUILD_LIBS="PYTHON TESTING TUTORIALS"
BUILD_ARG="-DWITH_PYTHON=ON -DWITH_CPP=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
BUILD_ENV="-e CC=gcc -e CXX=g++"
DISTRO=centos6
# Distribution
- TEST_NAME="make dist"
SCRIPT="make-dist.sh"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="Debian Packages"
SCRIPT="dpkg.sh"
BUILD_ENV="-e CC=gcc -e CXX=g++"
- TEST_NAME="make dist (Debian)"
SCRIPT="make-dist.sh"
BUILD_ENV="-e CC=gcc -e CXX=g++"
DISTRO=debian
- TEST_NAME="Debian Packages (Debian)"
SCRIPT="dpkg.sh"
BUILD_ENV="-e CC=gcc -e CXX=g++"
DISTRO=debian
matrix:
jobs:
include:
# ========================= stage: docker =========================
- stage: docker
script: true
env:
- JOB="Docker Build ubuntu-xenial 16.04 LTS"
- DISTRO=ubuntu-xenial
- TRAVIS_BUILD_STAGE=docker
- script: true
env:
- JOB="Docker Build ubuntu-bionic 18.04 LTS"
- DISTRO=ubuntu-bionic
- TRAVIS_BUILD_STAGE=docker
# ========================= stage: thrift =======================
# ------------------------- phase: cross ------------------------
# apache/thrift official PR builds can exceed 50 minutes per job so combine all cross tests
- stage: thrift
script: build/docker/run.sh
if: repo = apache/thrift
env:
- JOB="Cross Language Tests"
- SCRIPT="cross-test.sh"
# fork based PR builds cannot exceed 50 minutes per job
- stage: thrift
script: build/docker/run.sh
if: repo != apache/thrift
env:
- JOB="Cross Language Tests (Binary Protocol)"
- SCRIPT="cross-test.sh"
- BUILD_ARG="-'(binary)'"
- stage: thrift
script: build/docker/run.sh
if: repo != apache/thrift
env:
- JOB="Cross Language Tests (Header, JSON Protocols)"
- SCRIPT="cross-test.sh"
- BUILD_ARG="-'(header|json)'"
- stage: thrift
script: build/docker/run.sh
if: repo != apache/thrift
env:
- JOB="Cross Language Tests (Compact and Multiplexed Protocols)"
- SCRIPT="cross-test.sh"
- BUILD_ARG="-'(compact|multiplexed)'"
# ------------------------- phase: sca --------------------------
# QA jobs for code analytics and metrics
#
# C/C++ static code analysis with cppcheck
# add --error-exitcode=1 to --enable=all as soon as everything is fixed
#
# Python code style check with flake8
#
# search for TODO etc within source tree
# some statistics about the code base
# some info about the build machine
- env: TEST_NAME="cppcheck, flake8, TODO FIXME HACK, LoC and system info"
install:
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install -ym cppcheck sloccount python-flake8
script:
# Compiler cppcheck (All)
- cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src
# C++ cppcheck (All)
- cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
# C Glib cppcheck (All)
- cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
# Silent error checks
- cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 compiler/cpp/src
- cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
- cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
# Python code style
- flake8 --ignore=E501 lib/py
- flake8 tutorial/py
- flake8 --ignore=E501 test/py
- flake8 test/py.twisted
- flake8 test/py.tornado
- flake8 --ignore=E501 test/test.py
- flake8 --ignore=E501 test/crossrunner
- flake8 test/features
# TODO etc
- grep -r TODO *
- grep -r FIXME *
- grep -r HACK *
# LoC
- sloccount .
# System Info
- dpkg -l
- uname -a
- stage: thrift
script: build/docker/run.sh
env:
- JOB="Static Code Analysis"
- SCRIPT="sca.sh"
# C and C++ undefined behavior.
# A binary crashes if undefined behavior occurs and produces a stack trace.
# python is disabled, see: THRIFT-4360
- script: build/docker/run.sh
env:
- JOB="UBSan"
- SCRIPT="ubsan.sh"
- BUILD_ARG="--without-python --without-py3"
# ------------------------- phase: autotools --------------------
# TODO: Remove them once migrated to CMake
- script: build/docker/run.sh
env:
- JOB="Autotools (Ubuntu Bionic)"
- SCRIPT="autotools.sh"
- script: build/docker/run.sh
env:
- JOB="Autotools (Ubuntu Xenial)"
- DISTRO=ubuntu-xenial
- SCRIPT="autotools.sh"
# ------------------------- phase: cmake ------------------------
- script: build/docker/run.sh
env:
- JOB="CMake"
# C++ specific options: compiler plug-in, threading model
- script: build/docker/run.sh
env:
- JOB="C++98 (Boost Thread)"
- SCRIPT="cmake.sh"
- BUILD_LIBS="CPP TESTING TUTORIALS"
- BUILD_ARG="-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_CXX_EXTENSIONS=OFF --DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
- BUILD_ENV="-e CC=clang -e CXX=clang++"
- script: build/docker/run.sh
env:
- JOB="C++ (Std Thread) and Plugin"
- SCRIPT="cmake.sh"
- BUILD_LIBS="CPP TESTING TUTORIALS"
- BUILD_ARG="-DWITH_PLUGIN=ON -DWITH_STDTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
- BUILD_ENV="-e CC=clang -e CXX=clang++"
# ------------------------- phase: dist -------------------------
- script: build/docker/run.sh
env:
- JOB="make dist"
- SCRIPT="make-dist.sh"
- script: build/docker/run.sh
env:
- JOB="Debian Packages"
- SCRIPT="dpkg.sh"
# ------------------------- phase: coverity ---------------------
# We build the coverity scan build once monthly using a travis cron job
- if: (env(COVERITY_SCAN_NOTIFICATION_EMAIL) IS present) AND (branch IN (master)) AND (type IN (cron))
script: build/docker/run.sh
env:
- JOB="Coverity Scan"
- SCRIPT="covscan.sh"
### ------------------------- phase: osx --------------------------
# disabled due to the time delays it imposes on build jobs
# - os: osx
# osx_image: xcode9
# script: build/docker/scripts/autotools.sh

View file

@ -1,5 +1,552 @@
Apache Thrift Changelog
================================================================================
Thrift 0.12.0
--------------------------------------------------------------------------------
## New Languages
* Common LISP (cl)
* Swift
* Typescript (nodets)
## Deprecated Languages
* Cocoa
## Breaking Changes (since 0.11.0)
* [THRIFT-4529] - Rust enum variants are now camel-cased instead of uppercased to conform to Rust naming conventions
* [THRIFT-4448] - Support for golang 1.6 and earlier has been dropped.
* [THRIFT-4474] - PHP now uses the PSR-4 loader by default instead of class maps.
* [THRIFT-4532] - method signatures changed in the compiler's t_oop_generator.
* [THRIFT-4648] - The C (GLib) compiler's handling of namespaces has been improved.
## Known Issues (Blocker or Critical)
* [THRIFT-4037] - build: use a single build system for thrift
* [THRIFT-4119] - build: bootstrap.sh is missing from source tarball
* [THRIFT-3289] - csharp: socket exhaustion in csharp implementation
* [THRIFT-3029] - cocoa: Getters for fields defined with uppercase names do not work
* [THRIFT-3325] - cocoa: Extended services aren't subclasses in generated Cocoa
* [THRIFT-4116] - cocoa: Thrift de-capitalizes the name of IsSet property in Cocoa
* [THRIFT-3877] - cpp: the http implementation is not standard; interop with other languages is spotty at best
* [THRIFT-4180] - cpp: Impossible to build Thrift C++ library for Android (NDK)
* [THRIFT-4384] - cpp: Using multiple async services simultaneously is not thread-safe
* [THRIFT-3108] - haskell: Defaulted struct parameters on a service generates invalid Haskell
* [THRIFT-3990] - nodejs: Exception swallowed by deserialization function
* [THRIFT-4214] - nodejs: map<i64,value> key treated as hex value in JavaScript
* [THRIFT-4602] - nodejs: ERROR in ./node_modules/thrift/lib/nodejs/lib/thrift/connection.js Module not found: Error: Can't resolve 'child_process'
* [THRIFT-4639] - nodejs: Sequence numbering for multiplexed protocol broken
* [THRIFT-1310] - php: sequence and reconnection management issues
* [THRIFT-1538] - php: Error during deserialization int64 on 32-bit architecture
* [THRIFT-1580] - php: thrift type i64 java to php serialize/deserealize not working
* [THRIFT-1950] - php: PHP gets stuck in infinite loop
* [THRIFT-2954] - python: sending int or float in a double field breaks the connection
* [THRIFT-4080] - python: unix sockets can get stuck forever
* [THRIFT-4281] - python: generated code is out of order and causes load issues
* [THRIFT-4677] - py3: UnicodeDecideError in Python3
## Build Process
* [THRIFT-4308] - D language docker images need demios for libevent and openssl fixed to re-enable make cross on dlang
* [THRIFT-4579] - Use Ubuntu Bionic (18.04 LTS) for CI builds instead of Artful (17.10)
* [THRIFT-4508] - Define CI operating system coverage rules for the project and (hopefully) simplify CI a little more
* [THRIFT-4397] - ubuntu install instructions broken on 16.04
* [THRIFT-4545] - Appveyor builds are failing due to a haskell / cabal update in chocolatey
* [THRIFT-4452] - optimize Dockerfile (only onetime apt-get update)
* [THRIFT-4440] - rm `build/docker/ubuntu-trusty/Dockerfile.orig`
* [THRIFT-4352] - Ubuntu Artful doesn't appear to be compatible with Thrift and Haxe 3.4.2
* [THRIFT-4666] - DLang Client Pool Test fails sporadically
* [THRIFT-4676] - CL tutorial build fails sporadically
* [THRIFT-4456] - Make haxelib download quiet so it doesn't blow up the build log
* [THRIFT-4605] - bootstrap.sh fails if automake=1.16.1
## c_glib
* [THRIFT-4648] - The C (GLib) compiler's handling of namespaces has been improved.
* [THRIFT-4622] - glibC compilation issue
* [THRIFT-4671] - c glib is unable to handle client close unexpectedly
## cl (new language support in 0.12.0)
* [THRIFT-82] - Common Lisp support
## csharp
* [THRIFT-4558] - reserved Csharp keywords are not escaped in some cases
* [THRIFT-4637] - C# async mode generates incorrect code with inherited services
* [THRIFT-4672] - IAsyncResult style methods not being supported by certain transports leads to issues in mixed ISync/IAsync use cases
* [THRIFT-4539] - Allow TBufferedTransport to be used as base class
* [THRIFT-4535] - XML docs; code cleanup (tabs->spaces; String->string)
* [THRIFT-4492] - protected ExceptionType type member of TApplicationException cannot be accessed
* [THRIFT-4446] - JSONProtocol Base64 Encoding Trims Padding
* [THRIFT-4455] - Missing dispose calls in ThreadedServer & ThreadpoolServer
* [THRIFT-4609] - keep InnerException wherever appropriate
* [THRIFT-4673] - IAsyncResult not supported by layered transports (buffered/framed)
## cpp
* [THRIFT-4476] - Typecasting problem on list items
* [THRIFT-4465] - TNonblockingServer throwing THRIFT LOGGER: TConnection::workSocket(): THRIFT_EAGAIN (unavailable resources)
* [THRIFT-4680] - TBufferTransports.h does not compile under Visual Studio 2017
* [THRIFT-4618] - TNonblockingServer crash because of limitation of select()
* [THRIFT-4620] - TZlibTransport.cpp doesn't ensure that there is enough space for the zlib flush marker in the buffer.
* [THRIFT-4571] - ZeroMQ contrib library needs a refresh
* [THRIFT-4559] - TSSLServerSocket incorrectly prints errors
* [THRIFT-4578] - Move `TAsyncProtocolProcessor` into main thrift library
* [THRIFT-4418] - evhttp_connection_new is deprecated; use evhttp_connection_base_new
## compiler
* [THRIFT-4644] - Compiler cannot be compiled on macOS(maybe also on other platforms with clang)
* [THRIFT-4531] - Thrift generates wrong Python code for immutable structures with optional members
* [THRIFT-4513] - thrift generated code is not stable for constants
* [THRIFT-4532] - Avoid updating Thrift compiler generated code if the output has not changed
* [THRIFT-4400] - Visual Studio Compiler project should link runtime statically in release builds
* [THRIFT-4399] - plugin.thrift t_const_value is not used as a union in C++ code -- fix this
* [THRIFT-4496] - Dealing with language keywords in Thrift (e.g. service method names)
* [THRIFT-4393] - repeated runs of compiler produce different binary output at plugin interface
## dlang
* [THRIFT-4478] - Thrift will not build with dlang 2.078 or later
* [THRIFT-4503] - dlang servers logError on normal client disconnection
* [THRIFT-4308] - D language docker images need demios for libevent and openssl fixed to re-enable make cross on dlang
## dart
* [THRIFT-4646] - Effective Dart and Exceptions
* [THRIFT-4439] - Shouldn't download dart.deb directly.
## delphi
* [THRIFT-4562] - Calling wrong exception CTOR leads to "call failed: unknown result" instead of the real exception being thrown
* [THRIFT-4554] - uncompileable code with member names that are also types under specific conditions
* [THRIFT-4422] - Add Async implementation via IFuture
* [THRIFT-4485] - Possible invalid ptr AV with overlapped read/write on pipes
* [THRIFT-4549] - Thrift exceptions should derive from TException
* [THRIFT-4540] - buffered transport broken when trying to re-open a formerly closed transport
* [THRIFT-4473] - Move Thrift.Console.pas out of the Library
* [THRIFT-4490] - Allow a default service as fallback for multiplex processors connected by old clients
* [THRIFT-4454] - Large writes/reads may cause range check errors in debug mode
* [THRIFT-4461] - Compiler directive should match Delphi XE4
* [THRIFT-4462] - First line in Console duplicated
* [THRIFT-4642] - FPU ctrl word settings may cause an unexpected "denormalized" error
## erlang
* [THRIFT-4497] - Erlang records should use map() for map type
* [THRIFT-4495] - Erlang records should allow 'undefined' for non-required fields
* [THRIFT-4580] - Fix erlang tutorial unpack on Windows
* [THRIFT-4582] - Ubuntu Xenial erlang 18.3 "make check" fails
## golang
* [THRIFT-4448] - Support for golang 1.6 and earlier has been dropped.
* [THRIFT-4253] - Go generator assigns strings to field in const instead of pointers.
* [THRIFT-4573] - Unions Field Count Does Not Consider Binary
* [THRIFT-4447] - Golang: Panic on p.c.Call when using deprecated initializers
* [THRIFT-4650] - Required field incorrectly marked as set when fieldType does not match
* [THRIFT-4486] - Golang: -remote.go client cleanup
* [THRIFT-4537] - TSimpleServer can exit Accept loop with lock still acquired
* [THRIFT-4516] - Add support for go 1.10
* [THRIFT-4421] - golang tests rely on gomock, which has change behaviour, causing tests to fail
* [THRIFT-4626] - Communication crash when using binary/compact protocol and zlib transport
* [THRIFT-4659] - golang race detected when closing listener socket
## haskell
* [THRIFT-4634] - Haskell builds with older cabal cannot reconcile complex version requirements
## java
* [THRIFT-4259] - Thrift does not compile due to Ant Maven task errors
* [THRIFT-1418] - Compiling Thrift from source: Class org.apache.tools.ant.taskdefs.ConditionTask doesn't support the nested "typefound" element
* [THRIFT-4530] - proposal: add nullability annotations to generated Java code
* [THRIFT-4614] - Generate missing @Nullable annotations for Java iterator getters
* [THRIFT-4555] - Getter of binary field in Java creates unnecessary copy
* [THRIFT-3983] - libthrift is deployed on central with pom packaging instead of jar
* [THRIFT-4294] - Java Configure Fails for Ant >= 1.10
* [THRIFT-4178] - Java libraries missing from package when using cmake
* [THRIFT-4120] - pom files are not generated or provided in the build
* [THRIFT-1507] - Maven can't download resource from central when behind a proxy and won't use local repository
* [THRIFT-4556] - Optional rethrow of unhandled exceptions in java processor
* [THRIFT-4337] - Able to set keyStore and trustStore as InputStream in the TSSLTransportFactory.TSSLTransportParameters
* [THRIFT-4566] - Pass message of unhandled exception to optional rethrow.
* [THRIFT-4506] - Remove assertion in Java SASL code that would be ignored in release builds
* [THRIFT-4470] - Include popular IDE file templates to gitignore
* [THRIFT-4429] - Make TThreadPoolServer.executorService_ available in inherited classes and refactor methods to be able customization
* [THRIFT-3769] - Fix logic of THRIFT-2268
* [THRIFT-4494] - Increase Java Socket Buffer Size
* [THRIFT-4499] - Remove Magic Number In TFIleTransport
## js
* [THRIFT-4406] - JavaScript: Use modern Promise implementations
* [THRIFT-4625] - let / const variable decorators for es6 compiler
* [THRIFT-4653] - ES6 Classes
* [THRIFT-4592] - JS: readI32 performance on large arrays is very poor in Chrome
* [THRIFT-4509] - js and nodejs libraries need to be refreshed with current libraries
* [THRIFT-4403] - thrift.js: Incorrect usage of 'this' in TWebSocketTransport.__onOpen
* [THRIFT-4436] - Deserialization of nested list discards content
* [THRIFT-4437] - JS WebSocket client callbacks invoked twice on parallel requests
* [THRIFT-4679] - Duplicate declaration of InputBufferUnderrunError in lib/nodejs/lib/thrift/json_protocol.js
* [THRIFT-4551] - Add prettier for consistent JS code formatting
## lua
* [THRIFT-4591] - lua client uses two write() calls per framed message send
* [THRIFT-3863] - Can't "make install" Lua Library
## netcore
* [THRIFT-4524] - .NET Core Server doesn't close properly when cancelled
* [THRIFT-4434] - Update .NET Core components, add tests for .Net Core library and .Net Core compiler, fix bugs and build process
* [THRIFT-4446] - JSONProtocol Base64 Encoding Trims Padding
## node.js
* [THRIFT-4225] - Error handling malformed arguments leaks memory, corrupts transport buffers causing next RPC to fail
* [THRIFT-3950] - Memory leak while calling oneway method
* [THRIFT-3143] - add typescript directory support
* [THRIFT-4564] - TBufferedTransport can leave corrupt data in the buffer
* [THRIFT-4647] - Node.js Fileserver webroot path
* [THRIFT-4489] - Unix domain socket support for NodeJS client
* [THRIFT-4443] - node.js json_protocol throws error in skip function
* [THRIFT-4604] - NodeJS: Expose Int64 from browser.js for consumption by browser
* [THRIFT-4480] - NodeJS warning on binary_protocol writeMessageEnd when seqid = 0
## perl
* [THRIFT-4382] - Replace the use of Perl Indirect Object Syntax calls to new()
* [THRIFT-4471] - Thrift CPAN release is missing Makefile.PL and the clients are unable to build the module
* [THRIFT-4416] - Perl CPAN Packaging Improvements
## php
* [THRIFT-4474] - PHP generator use PSR-4 default
* [THRIFT-4463] - PHP generated code match PSR-2
* [THRIFT-4373] - Extending Thrift class results in "Attempt serialize from non-Thrift object"
* [THRIFT-4354] - TSocket block on read
* [THRIFT-4423] - migrate php library to psr-4
* [THRIFT-4656] - infinite loop in latest PHP library
* [THRIFT-4477] - TBufferedTransport must have underlying transport
* [THRIFT-4475] - lib/php/test should be checked for PSR-2
* [THRIFT-4498] - add phpcs back
* [THRIFT-4460] - php library use PSR-2
* [THRIFT-4641] - TCurlClient doesn't check for HTTP status code
* [THRIFT-4645] - TCurlClient: show actual error message when throwing TTransportException
* [THRIFT-4674] - Add stream context support into PHP/THttpClient
* [THRIFT-4459] - reduce php library directory depth
## python
* [THRIFT-4670] - Twisted, slots, and void method fails with "object has no attribute 'success'"
* [THRIFT-4464] - Potentially server-crashing typo in Python TNonblockingServer
* [THRIFT-4548] - Supporting TBinaryProtocolAccelerated protocol when using TMultiplexedProcessor in Python
* [THRIFT-4577] - Outdated cipher string in python unit test
* [THRIFT-4505] - python build on Vagrant Windows boxes fails
* [THRIFT-4621] - THeader for Python
* [THRIFT-4668] - make socket backlog configurable for python
* [THRIFT-4561] - Python: cleanup socket timeout settings
## ruby
* [THRIFT-4289] - Thrift RSpec test suite fails with Ruby 2.4.x due to Fixnum deprecation
* [THRIFT-4342] - Support ruby rspec 3
* [THRIFT-4525] - Add ssl socket option to ruby cross tests
* [THRIFT-4450] - Add seek support to TCompactInputProtocol in Rust
* [THRIFT-4631] - Codegen Creates Invalid Ruby for Recursive Structs
* [THRIFT-4472] - Fix the genspec for ruby so it does not complain about an invalid license
## rust
* [THRIFT-4662] - Rust const string calls function at compile time
* [THRIFT-4661] - Rust enum name wrong case in generated structs
* [THRIFT-4617] - Avoid generating conflicting struct names in Rust code
* [THRIFT-4529] - Rust generation should include #![allow(non_snake_case)] or force conform to Rust style guidelines
* [THRIFT-4390] - Rust binary protocol and buffered transport cannot handle writes above 4096 bytes
* [THRIFT-4419] - Rust framed transport cannot handle writes above 4096 bytes
* [THRIFT-4658] - Rust's TBinaryInputProtocol fails when strict is false
* [THRIFT-4187] - Dart -> Rust Framed cross tests fail
* [THRIFT-4664] - Rust cannot create ReadHalf/WriteHalf to implement custom tranports
## swift (new language support in 0.12.0)
* [THRIFT-3773] - Swift Library
## test suite
* [THRIFT-4515] - Gracefully shutdown cross-test servers to fully test teardown
* [THRIFT-4085] - Add .NET Core to the make cross standard test suite
* [THRIFT-4358] - Add unix domain sockets in ruby to cross test - code exists
## typescript (new language support in 0.12.0)
* [THRIFT-3143] - add typescript directory support
================================================================================
Thrift 0.11.0
--------------------------------------------------------------------------------
## Sub-task
* [THRIFT-2733] - Erlang coding standards
* [THRIFT-2740] - Perl coding standards
* [THRIFT-3610] - Streamline exception handling in Python server handler
* [THRIFT-3686] - Java processor should report internal error on uncaught exception
* [THRIFT-4049] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
* [THRIFT-4053] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
* [THRIFT-4136] - Align is_binary() method with is_string() to simplify those checks
* [THRIFT-4137] - Fix remaining undefined behavior invalid vptr casts in Thrift Compiler
* [THRIFT-4138] - Fix remaining undefined behavior invalid vptr casts in C++ library
* [THRIFT-4296] - Fix Ubuntu Xenial build environment for the python language
* [THRIFT-4298] - Fix Ubuntu Xenial build environment for the go 1.6 language
* [THRIFT-4299] - Fix Ubuntu Xenial build environment for the D language
* [THRIFT-4300] - Fix make cross in Ubuntu Xenial docker environment, once all language support issues are fixed
* [THRIFT-4302] - Fix Ubuntu Xenial make cross testing for lua and php7
* [THRIFT-4398] - Update EXTRA_DIST for "make dist"
## Bug
* [THRIFT-381] - Fail fast if configure detects C++ problems
* [THRIFT-1677] - MinGW support broken
* [THRIFT-1805] - Thrift should not swallow ALL exceptions
* [THRIFT-2026] - Fix TCompactProtocol 64 bit builds
* [THRIFT-2642] - Recursive structs don't work in python
* [THRIFT-2889] - stable release 0.9.2, erlang tutorial broken
* [THRIFT-2913] - Ruby Server Thrift::ThreadPoolServer should serve inside a thread
* [THRIFT-2998] - Node.js: Missing header from http request
* [THRIFT-3000] - .NET implementation has trouble with mixed IP modes
* [THRIFT-3281] - Travis CI build passed but the log says BUILD FAILED
* [THRIFT-3358] - Makefile:1362: *** missing separator. Stop.
* [THRIFT-3600] - Make TTwisted server send exception on unexpected handler error
* [THRIFT-3602] - Make Tornado server send exception on unexpected handler error
* [THRIFT-3657] - D TFileWriterTransport close should use non-priority send
* [THRIFT-3700] - Go Map has wrong default value when optional
* [THRIFT-3703] - Unions Field Count Does Not Consider Map/Set/List Fields
* [THRIFT-3730] - server log error twice
* [THRIFT-3778] - go client can not pass method parameter to server of other language if no field_id is given
* [THRIFT-3784] - thrift-maven-plugin generates invalid include directories for IDL in dependency JARs
* [THRIFT-3801] - Node Thrift client throws exception with multiplexer and responses that are bigger than a single buffer
* [THRIFT-3821] - TMemoryBuffer buffer may overflow when resizing
* [THRIFT-3832] - Thrift version 0.9.3 example on Windows, Visual Studio, linking errors during compiling
* [THRIFT-3847] - thrift/config.h includes a #define for VERSION which will likely conflict with existing user environment or code
* [THRIFT-3873] - Fix various build warnings when using Visual Studio
* [THRIFT-3891] - TNonblockingServer configured with more than one IO threads does not always return from serve() upon stop()
* [THRIFT-3892] - Thrift uses TLS SNI extension provided by OpenSSL library. Older version of OpenSSL(< 0.9.8f) may create problem because they do not support 'SSL_set_tlsext_host_name()'.
* [THRIFT-3895] - Build fails using Java 1.8 with Ant < 1.9
* [THRIFT-3896] - map<string,string> data with number string key cannot access that deserialized by php extension
* [THRIFT-3938] - Python TNonblockingServer does not work with SSL
* [THRIFT-3944] - TSSLSocket has dead code in checkHandshake
* [THRIFT-3946] - Java 1.5 compatibility broken for binary fields (java5 option)
* [THRIFT-3960] - Inherited services in Lua generator are not named correctly
* [THRIFT-3962] - Ant build.xml broken on Windows for Java library
* [THRIFT-3963] - Thrift.cabal filename does not match module name
* [THRIFT-3967] - gobject/gparam.h:166:33: warning: enumerator value for G_PARAM_DEPRECATED is not an integer constant expression
* [THRIFT-3968] - Deserializing empty string/binary fields
* [THRIFT-3974] - Using clang-3.8 and ThreadSanitizer on the concurrency_test claims bad PThread behavior
* [THRIFT-3984] - PHP7 extension causes segfault
* [THRIFT-4008] - broken ci due to upstream dependency versioning break
* [THRIFT-4009] - Use @implementer instead of implements in TTwisted.py
* [THRIFT-4010] - Q.fcall messing up with *this* pointer inside called function
* [THRIFT-4011] - Sets of Thrift structs generate Go code that can't be serialized to JSON
* [THRIFT-4012] - Python Twisted implementation uses implements, not compatible with Py3
* [THRIFT-4014] - align C# meta data in AssemblyInfo.cs
* [THRIFT-4015] - Fix wrongly spelled "Thirft"s
* [THRIFT-4016] - testInsanity() impl does not conform to test spec in ThriftTest.thrift
* [THRIFT-4023] - Skip unexpected field types on read/write
* [THRIFT-4024] - Skip() should throw on unknown data types
* [THRIFT-4026] - TSSLSocket doesn't work with Python < 2.7.9
* [THRIFT-4029] - Accelerated protocols do not build from thrift-py 0.10.0 on PyPI
* [THRIFT-4031] - Go plugin generates invalid code for lists of typedef'ed built-in types
* [THRIFT-4033] - Default build WITH_PLUGIN=ON for all builds results in packaging errors
* [THRIFT-4034] - CMake doesn't work to build compiler on MacOS
* [THRIFT-4036] - Add .NET Core environment/build support to the docker image
* [THRIFT-4038] - socket check: checking an unsigned number against >= 0 never fails
* [THRIFT-4042] - ExtractionError when using accelerated thrift in a multiprocess test
* [THRIFT-4043] - thrift perl debian package is placing files in the wrong place
* [THRIFT-4044] - Build job 17 failing on every pull request; hspec core (haskell) 2.4 issue
* [THRIFT-4046] - MinGW with gcc 6.2 does not compile on Windows
* [THRIFT-4060] - Thrift printTo ostream overload mechanism breaks down when types are nested
* [THRIFT-4062] - Remove debug print from TServiceClient
* [THRIFT-4065] - Document Perl ForkingServer signal restriction imposed by THRIFT-3848 and remove unnecessary code
* [THRIFT-4068] - A code comment in Java ServerSocket is wrong around accept()
* [THRIFT-4073] - enum files are still being generated with unused imports
* [THRIFT-4076] - Appveyor builds failing because ant 1.9.8 was removed from apache servers
* [THRIFT-4077] - AI_ADDRCONFIG redefined after recent change to PlatformSocket header
* [THRIFT-4079] - Generated perl code that returns structures from included thrift files is missing a necessary use clause
* [THRIFT-4087] - Spurious exception destroying TThreadedServer because of incorrect join() call
* [THRIFT-4102] - TBufferedTransport performance issue since 0.10.0
* [THRIFT-4106] - concurrency_test fails randomly
* [THRIFT-4108] - c_glib thrift ssl has multiple bugs and deprecated functions
* [THRIFT-4109] - Configure Script uses string comparison for versions
* [THRIFT-4129] - C++ TNonblockingServer fd leak when failing to dispatch new connections
* [THRIFT-4131] - Javascript with WebSocket handles oneway methods wrong
* [THRIFT-4134] - Fix remaining undefined behavior invalid vptr casts
* [THRIFT-4140] - Use of non-thread-safe function gmtime()
* [THRIFT-4141] - Installation of haxe in docker files refers to a redirect link and fails
* [THRIFT-4147] - Rust: protocol should accept transports with non-static lifetime
* [THRIFT-4148] - [maven-thrift-plugin] compile error while import a thrift in dependency jar file.
* [THRIFT-4149] - System.out pollutes log files
* [THRIFT-4154] - PHP close() of a TSocket needs to close any type of socket
* [THRIFT-4158] - minor issue in README-MSYS2.md
* [THRIFT-4159] - Building tests fails on MSYS2 (MinGW64) due to a (small?) linker error
* [THRIFT-4160] - TNonblocking server fix use of closed/freed connections
* [THRIFT-4161] - TNonBlocking server using uninitialized event in error paths
* [THRIFT-4162] - TNonBlocking handling of TSockets in error state is incorrect after fd is closed
* [THRIFT-4164] - Core in TSSLSocket cleanupOpenSSL when destroying a mutex used by openssl
* [THRIFT-4165] - C++ build has many warnings under c++03 due to recent changes, cmake needs better platform-independent language level control
* [THRIFT-4166] - Recent fix to remove boost::lexical_cast usage broke VS2010
* [THRIFT-4167] - Missing compile flag
* [THRIFT-4170] - Support lua 5.1 or earlier properly for object length determination
* [THRIFT-4172] - node.js tutorial client does not import assert, connection issues are not handled properly
* [THRIFT-4177] - Java compiler produces deep copy constructor that could make shallow copy instead
* [THRIFT-4184] - Building on Appveyor: invalid escape sequence \L
* [THRIFT-4185] - fb303 counter encoding fix
* [THRIFT-4189] - Framed/buffered transport Dispose() does not dispose the nested transport
* [THRIFT-4193] - Lower the default maxReadBufferBytes for non-blocking servers
* [THRIFT-4195] - Compilation to GO produces broken code
* [THRIFT-4196] - Cannot generate recursive Rust types
* [THRIFT-4204] - typo in compact spec
* [THRIFT-4206] - Strings in container fields are not decoded properly with py:dynamic and py:utf8strings
* [THRIFT-4208] - C# NamedPipesServer not really working in some scenarios
* [THRIFT-4211] - Fix GError glib management under Thrift
* [THRIFT-4212] - c_glib flush tries to close SSL even if socket is invalid
* [THRIFT-4213] - Travis build fails at curl -sSL https://www.npmjs.com/install.sh | sh
* [THRIFT-4215] - Golang TTransportFactory Pattern Squelches Errors
* [THRIFT-4216] - Golang Http Clients Do Not Respect User Options
* [THRIFT-4218] - Set TCP_NODELAY for PHP client socket
* [THRIFT-4219] - Golang HTTP clients created with Nil buffer
* [THRIFT-4231] - TJSONProtocol throws unexpected non-Thrift-exception on null strings
* [THRIFT-4232] - ./configure does bad ant version check
* [THRIFT-4234] - Travis build fails cross language tests with "Unsupported security protocol type"
* [THRIFT-4237] - Go TServerSocket Race Conditions
* [THRIFT-4240] - Go TSimpleServer does not close properly
* [THRIFT-4243] - Go TSimpleServer race on wait in Stop() method
* [THRIFT-4245] - Golang TFramedTransport's writeBuffer increases if writes to transport failed
* [THRIFT-4246] - Sequence number mismatch on multiplexed clients
* [THRIFT-4247] - Compile fails with openssl 1.1
* [THRIFT-4248] - Compile fails - strncpy, memcmp, memset not declared in src/thrift/transport/TSSLSocket.cpp
* [THRIFT-4251] - Java Epoll Selector Bug
* [THRIFT-4257] - Typescript async callbacks do not provide the correct types
* [THRIFT-4258] - Boost/std thread wrapping faultiness
* [THRIFT-4260] - Go context generation issue. Context is parameter in Interface not in implementation
* [THRIFT-4261] - Go context generation issue: breaking change in generated code regarding thrift.TProcessorFunction interface
* [THRIFT-4262] - Invalid binding to InterlockedCompareExchange64() with 64-bit targets
* [THRIFT-4263] - Fix use after free bug for thrown exceptions
* [THRIFT-4266] - Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)
* [THRIFT-4268] - Erlang library emits debugging output in transport layer
* [THRIFT-4273] - erlang:now/0: Deprecated BIF.
* [THRIFT-4274] - Python feature tests for SSL/TLS failing
* [THRIFT-4279] - Wrong path in include directive in generated Thrift sources
* [THRIFT-4283] - TNamedPipeServer race condition in interrupt
* [THRIFT-4284] - File contains a NBSP: lib/nodejs/lib/thrift/web_server.js
* [THRIFT-4290] - C# nullable option generates invalid code for non-required enum field with default value
* [THRIFT-4292] - TimerManager::remove() is not implemented
* [THRIFT-4307] - Make ssl-open timeout effective in golang client
* [THRIFT-4312] - Erlang client cannot connect to Python server: exception error: econnrefused
* [THRIFT-4313] - Program code of the Erlang tutorial files contain syntax errors
* [THRIFT-4316] - TByteBuffer.java will read too much data if a previous read returns fewer bytes than requested
* [THRIFT-4319] - command line switch for "evhttp" incorrectly resolved to anon pipes
* [THRIFT-4323] - range check errors or NPE in edge cases
* [THRIFT-4324] - field names can conflict with local vars in generated code
* [THRIFT-4328] - Travis CI builds are timing out (job 1) and haxe builds are failing since 9/11
* [THRIFT-4329] - c_glib Doesn't have a multiplexed processor
* [THRIFT-4331] - C++: TSSLSockets bug in handling huge messages, bug in handling polling
* [THRIFT-4332] - Binary protocol has memory leaks
* [THRIFT-4334] - Perl indentation incorrect when defaulting field attribute to a struct
* [THRIFT-4339] - Thrift Framed Transport in Erlang crashes server when client disconnects
* [THRIFT-4340] - Erlang fix a crash on client close
* [THRIFT-4355] - Javascript indentation incorrect when defaulting field attribute to a struct
* [THRIFT-4356] - thrift_protocol call Transport cause Segmentation fault
* [THRIFT-4359] - Haxe compiler looks like it is producing incorrect code for map or set key that is binary type
* [THRIFT-4362] - Missing size-check can lead to huge memory allocation
* [THRIFT-4364] - Website contributing guide erroneously recommends submitting patches in JIRA
* [THRIFT-4365] - Perl generated code uses indirect object syntax, which occasionally causes compilation errors.
* [THRIFT-4367] - python TProcessor.process is missing "self"
* [THRIFT-4370] - Ubuntu Artful cppcheck and flake8 are more stringent and causing SCA build job failures
* [THRIFT-4372] - Pipe write operations across a network are limited to 65,535 bytes per write.
* [THRIFT-4374] - cannot load thrift_protocol due to undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE
* [THRIFT-4376] - Coverity high impact issue resolution
* [THRIFT-4377] - haxe. socket handles leak in TSimpleServer
* [THRIFT-4381] - Wrong isset bitfield value after transmission
* [THRIFT-4385] - Go remote client -u flag is broken
* [THRIFT-4392] - compiler/..../plugin.thrift structs mis-ordered blows up ocaml generator
* [THRIFT-4395] - Unable to build in the ubuntu-xenial docker image: clap 2.28 requires Rust 1.20
* [THRIFT-4396] - inconsistent (or plain wrong) version numbers in master/trunk
## Documentation
* [THRIFT-4157] - outdated readme about Haxe installation on Linux
## Improvement
* [THRIFT-105] - make a thrift_spec for a structures with negative tags
* [THRIFT-281] - Cocoa library code needs comments, badly
* [THRIFT-775] - performance improvements for Perl
* [THRIFT-2221] - Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
* [THRIFT-2364] - OCaml: Use Oasis exclusively for build process
* [THRIFT-2504] - TMultiplexedProcessor should allow registering default processor called if no service name is present
* [THRIFT-3207] - Enable build with OpenSSL 1.1.0 series
* [THRIFT-3272] - Perl SSL Authentication Support
* [THRIFT-3357] - Generate EnumSet/EnumMap where elements/keys are enums
* [THRIFT-3369] - Implement SSL/TLS support on C with c_glib
* [THRIFT-3467] - Go Maps for Thrift Sets Should Have Values of Type struct{}
* [THRIFT-3580] - THeader for Haskell
* [THRIFT-3627] - Missing basic code style consistency of JavaScript.
* [THRIFT-3706] - There's no support for Multiplexed protocol on c_glib library
* [THRIFT-3766] - Add getUnderlyingTransport() to TZlibTransport
* [THRIFT-3776] - Go code from multiple thrift files with the same namespace
* [THRIFT-3823] - Escape documentation while generating non escaped documetation
* [THRIFT-3854] - allow users to clear read buffers
* [THRIFT-3859] - Unix Domain Socket Support in Objective-C
* [THRIFT-3921] - C++ code should print enums as strings
* [THRIFT-3926] - There should be an error emitted when http status code is not 200
* [THRIFT-4007] - Micro-optimization of TTransport.py
* [THRIFT-4040] - Add real cause of TNonblockingServerSocket error to exception
* [THRIFT-4064] - Update node library dependencies
* [THRIFT-4069] - All perl packages should have proper namespace, version syntax, and use proper thrift exceptions
* [THRIFT-4071] - Consolidate the Travis CI jobs where possible to put less stress on the Apache Foundation's allocation of CI build slaves
* [THRIFT-4072] - Add the possibility to send custom headers in TCurlClient
* [THRIFT-4075] - Better MinGW support for headers-only boost (without thread library)
* [THRIFT-4081] - Provide a MinGW 64-bit Appveyor CI build for better pull request validation
* [THRIFT-4084] - Improve SSL security in thrift by adding a make cross client that checks to make sure SSLv3 protocol cannot be negotiated
* [THRIFT-4095] - Add multiplexed protocol to Travis CI for make cross
* [THRIFT-4099] - Auto-derive Hash for generated Rust structs
* [THRIFT-4110] - The debian build files do not produce a "-dbg" package for debug symbols of libthrift0
* [THRIFT-4114] - Space after '///' in doc comments
* [THRIFT-4126] - Validate objects in php extension
* [THRIFT-4130] - Ensure Apache Http connection is released back to pool after use
* [THRIFT-4151] - Thrift Mutex Contention Profiling (pthreads) should be disabled by default
* [THRIFT-4176] - Implement a threaded and threadpool server type for Rust
* [THRIFT-4183] - Named pipe client blocks forever on Open() when there is no server at the other end
* [THRIFT-4190] - improve C# TThreadPoolServer defaults
* [THRIFT-4197] - Implement transparent gzip compression for HTTP transport
* [THRIFT-4198] - Ruby should log Thrift internal errors to global logger
* [THRIFT-4203] - thrift server stop gracefully
* [THRIFT-4205] - c_glib is not linking against glib + gobject
* [THRIFT-4209] - warning CS0414 in T[TLS]ServerSocket.cs
* [THRIFT-4210] - include Thrift.45.csproj into CI runs
* [THRIFT-4217] - HttpClient should support gzip and deflate
* [THRIFT-4222] - Support Unix Domain Sockets in Golang TServerSocket
* [THRIFT-4233] - Make THsHaServer.invoker available (get method only) in inherited classes
* [THRIFT-4236] - Support context in go generated code.
* [THRIFT-4238] - JSON generator: make annotation-aware
* [THRIFT-4269] - Don't append '.' to Erlang namespace if it ends in '_'.
* [THRIFT-4270] - Generate Erlang mapping functions for const maps and lists
* [THRIFT-4275] - Add support for zope.interface only, apart from twisted support.
* [THRIFT-4285] - Pull generated send/recv into library to allow behaviour to be customised
* [THRIFT-4287] - Add c++ compiler "no_skeleton" flag option
* [THRIFT-4288] - Implement logging levels properly for node.js
* [THRIFT-4295] - Refresh the Docker image file suite for Ubuntu, Debian, and CentOS
* [THRIFT-4305] - Emit ddoc for generated items
* [THRIFT-4306] - Thrift imports not replicated to D service output
* [THRIFT-4315] - Add default message for TApplicationException
* [THRIFT-4318] - Delphi performance improvements
* [THRIFT-4325] - Simplify automake cross compilation by relying on one global THRIFT compiler path
* [THRIFT-4327] - Improve TimerManager API to allow removing specific task
* [THRIFT-4330] - Allow unused crates in Rust files
* [THRIFT-4333] - Erlang tutorial examples are using a different port (9999)
* [THRIFT-4343] - Change CI builds to use node.js 8.x LTS once available
* [THRIFT-4345] - Create a docker build environment that uses the minimum supported language levels
* [THRIFT-4346] - Allow Zlib transport factory to wrap other transports
* [THRIFT-4348] - Perl HTTP Client custom HTTP headers
* [THRIFT-4350] - Update netcore build for dotnet 2.0 sdk and make cross validation
* [THRIFT-4351] - Use Travis CI Build Stages to optimize the CI build
* [THRIFT-4353] - cannot read via thrift_protocol at server side
* [THRIFT-4378] - add set stopTimeoutUnit method to TThreadPoolServer
## New Feature
* [THRIFT-750] - C++ Compiler Virtual Function Option
* [THRIFT-2945] - Implement support for Rust language
* [THRIFT-3857] - thrift js:node complier support an object as parameter not an instance of struct
* [THRIFT-3933] - Port official C# .NET library for Thrift to C# .NET Core libary
* [THRIFT-4039] - Update of Apache Thrift .Net Core lib
* [THRIFT-4113] - Provide a buffer transport for reading/writing in memory byte stream
## Question
* [THRIFT-2956] - autoconf - possibly undefined macro - AC_PROG_BISON
* [THRIFT-4223] - Add support to the isServing() method for the C++ library
## Task
* [THRIFT-3622] - Fix deprecated uses of std::auto_ptr
* [THRIFT-4028] - Please remove System.out.format from the source code
* [THRIFT-4186] - Build and test rust client in Travis
## Test
* [THRIFT-4264] - PHP - Support both shared & static linking of sockets library
## Wish
* [THRIFT-4344] - Define and maintain the minimum language level for all languages in one place
Thrift 0.10.0
--------------------------------------------------------------------------------
## Bug

View file

@ -17,7 +17,14 @@
# under the License.
#
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.1)
# CMake 3.1 supports C++ standards selection with CMAKE_CXX_STANDARD
# If you need CMake 3.1+ for Ubuntu 14.04, try
# https://launchpad.net/~george-edison55/+archive/ubuntu/cmake-3.x
# If you need CMake 3.1+ for debian "jessie", get it from jessie-backports
# Otherwise
# http://cmake.org
project("Apache Thrift")

View file

@ -1,49 +1,116 @@
## How to contribute
1. Help to review and verify existing patches
1. Make sure your issue is not all ready in the [Jira issue tracker](http://issues.apache.org/jira/browse/THRIFT)
1. If not, create a ticket describing the change you're proposing in the [Jira issue tracker](http://issues.apache.org/jira/browse/THRIFT)
1. Contribute your patch using one of the two methods below
# How to Contribute #
### Contributing via a patch
1. Check out the latest version of the source code
* git clone https://git-wip-us.apache.org/repos/asf/thrift.git thrift
1. Modify the source to include the improvement/bugfix
* Remember to provide *tests* for all submited changes
* When bugfixing: add test that will isolate bug *before* applying change that fixes it
* Verify that you follow [Thrift Coding Standards](/docs/coding_standards) (you can run 'make style', which ensures proper format for some languages)
1. Create a patch from project root directory (e.g. you@dev:~/thrift $ ):
* git diff > ../thrift-XXX-my-new-feature.patch
1. Attach the newly generated patch to the issue
1. Wait for other contributors or committers to review your new addition
1. Wait for a committer to commit your patch
### Contributing via GitHub pull requests
1. Create a fork for http://github.com/apache/thrift
1. Create a branch for your changes(best practice is issue as branch name, e.g. THRIFT-9999)
1. Modify the source to include the improvement/bugfix
* Remember to provide *tests* for all submited changes
* When bugfixing: add test that will isolate bug *before* applying change that fixes it
* Verify that you follow [Thrift Coding Standards](/docs/coding_standards) (you can run 'make style', which ensures proper format for some languages)
* Verify that your change works on other platforms by adding a GitHub service hook to [Travis CI](http://docs.travis-ci.com/user/getting-started/#Step-one%3A-Sign-in) and [AppVeyor](http://www.appveyor.com/docs)
1. Commit and push changes to your branch (please use issue name and description as commit title, e.g. THRIFT-9999 make it perfect)
1. Issue a pull request with the jira ticket number you are working on in it's name
1. Wait for other contributors or committers to review your new addition
1. Wait for a committer to commit your patch
### More info
Plenty of information on why and how to contribute is available on the Apache Software Foundation (ASF) web site. In particular, we recommend the following:
Thank you for your interest in contributing to the Apache Thrift project! Information on why and how to contribute is available on the Apache Software Foundation (ASF) web site. In particular, we recommend the following to become acquainted with Apache Contributions:
* [Contributors Tech Guide](http://www.apache.org/dev/contributors)
* [Get involved!](http://www.apache.org/foundation/getinvolved.html)
* [Legal aspects on Submission of Contributions (Patches)](http://www.apache.org/licenses/LICENSE-2.0.html#contributions)
## GitHub pull requests ##
This is the preferred method of submitting changes. When you submit a pull request through github,
it activates the continuous integration (CI) build systems at Appveyor and Travis to build your changesxi
on a variety of Linux and Windows configurations and run all the test suites. Follow these requirements
for a successful pull request:
1. All code changes require an [Apache Jira THRIFT Issue](http://issues.apache.org/jira/browse/THRIFT) ticket.
1. All pull requests should contain a single commit per issue, or we will ask you to squash it.
1. The pull request title must begin with the Jira THRIFT ticket identifier, for example:
THRIFT-9999: an example pull request title
1. Commit messages must follow this pattern for code changes (deviations will not be merged):
THRIFT-9999: [summary of fix, one line if possible]
Client: [language(s) affected, comma separated, use lib/ directory names please]
Instructions:
1. Create a fork in your GitHub account of http://github.com/apache/thrift
1. Clone the fork to your development system.
1. Create a branch for your changes (best practice is issue as branch name, e.g. THRIFT-9999).
1. Modify the source to include the improvement/bugfix, and:
* Remember to provide *tests* for all submitted changes!
* Use test-driven development (TDD): add a test that will isolate the bug *before* applying the change that fixes it.
* Verify that you follow [Thrift Coding Standards](/docs/coding_standards) (you can run 'make style', which ensures proper format for some languages).
* [*optional*] Verify that your change works on other platforms by adding a GitHub service hook to [Travis CI](http://docs.travis-ci.com/user/getting-started/#Step-one%3A-Sign-in) and [AppVeyor](http://www.appveyor.com/docs). You can use this technique to run the Thrift CI jobs in your account to check your changes before they are made public. Every GitHub pull request into Thrift will run the full CI build and test suite on your changes.
1. Squash your changes to a single commit. This maintains clean change history.
1. Commit and push changes to your branch (please use issue name and description as commit title, e.g. "THRIFT-9999: make it perfect"), with the affected languages on the next line of the description.
1. Use GitHub to create a pull request going from your branch to apache:master. Ensure that the Jira ticket number is at the beginning of the title of your pull request, same as the commit title.
1. Wait for other contributors or committers to review your new addition, and for a CI build to complete.
1. Wait for a committer to commit your patch. You can nudge the committers if necessary by sending a message to the [Apache Thrift mailing list](https://thrift.apache.org/mailing).
## If you want to build the project locally ##
For Windows systems, see our detailed instructions on the [CMake README](/build/cmake/README.md).
For Windows Native C++ builds, see our detailed instructions on the [WinCPP README](/build/wincpp/README.md).
For unix systems, see our detailed instructions on the [Docker README](/build/docker/README.md).
## If you want to review open issues... ##
1. Review the [GitHub Pull Request Backlog](https://github.com/apache/thrift/pulls). Code reviews are open to all.
2. Review the [Jira issue tracker](http://issues.apache.org/jira/browse/THRIFT). You can search for tickets relating to languages you are interested in or currently using with thrift, for example a Jira search (Issues -> Search For Issues) query of ``project = THRIFT AND component in ("Erlang - Library") and status not in (resolved, closed)`` will locate all the open Erlang Library issues.
## If you discovered a defect... ##
1. Check to see if the issue is already in the [Jira issue tracker](http://issues.apache.org/jira/browse/THRIFT).
1. If not, create a ticket describing the change you're proposing in the Jira issue tracker.
1. Contribute your code changes using the GitHub pull request method:
## Contributing via Patch ##
Some changes do not require a build, for example in documentation. For changes that are not code or build related, you can submit a patch on Jira for review. To create a patch from changes in your local directory:
git diff > ../THRIFT-NNNN.patch
then wait for contributors or committers to review your changes, and then for a committer to apply your patch.
## GitHub recipes for Pull Requests ##
Sometimes commmitters may ask you to take actions in your pull requests. Here are some recipes that will help you accomplish those requests. These examples assume you are working on Jira issue THRIFT-9999. You should also be familiar with the [upstream](https://help.github.com/articles/syncing-a-fork/) repository concept.
### Squash your changes ###
If you have not submitted a pull request yet, or if you have not yet rebased your existing pull request, you can squash all your commits down to a single commit. This makes life easier for the committers. If your pull request on GitHub has more than one commit, you should do this.
1. Use the command ``git log`` to identify how many commits you made since you began.
2. Use the command ``git rebase -i HEAD~N`` where N is the number of commits.
3. Leave "pull" in the first line.
4. Change all other lines from "pull" to "fixup".
5. All your changes are now in a single commit.
If you already have a pull request outstanding, you will need to do a "force push" to overwrite it since you changed your commit history:
git push -u origin THRIFT-9999 --force
A more detailed walkthrough of a squash can be found at [Git Ready](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html).
### Rebase your pull request ###
If your pull request has a conflict with master, it needs to be rebased:
git checkout THRIFT-9999
git rebase upstream master
(resolve any conflicts, make sure it builds)
git push -u origin THRIFT-9999 --force
### Fix a bad merge ###
If your pull request contains commits that are not yours, then you should use the following technique to fix the bad merge in your branch:
git checkout master
git pull upstream master
git checkout -b THRIFT-9999-take-2
git cherry-pick ...
(pick only your commits from your original pull request in ascending chronological order)
squash your changes to a single commit if there is more than one (see above)
git push -u origin THRIFT-9999-take-2:THRIFT-9999
This procedure will apply only your commits in order to the current master, then you will squash them to a single commit, and then you force push your local THRIFT-9999-take-2 into remote THRIFT-9999 which represents your pull request, replacing all the commits with the new one.

View file

@ -1,61 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# Goal: provide a thrift-compiler Docker image
#
# Usage:
# docker run -v "${PWD}:/data" thrift/thrift-compiler -gen cpp -o /data/ /data/test/ThriftTest.thrift
#
# further details on docker for thrift is here build/docker/
#
# TODO: push to apache/thrift-compiler instead of thrift/thrift-compiler
FROM debian:jessie
MAINTAINER Apache Thrift <dev@thrift.apache.org>
ENV DEBIAN_FRONTEND noninteractive
ADD . /thrift
RUN buildDeps=" \
flex \
bison \
g++ \
make \
cmake \
curl \
"; \
apt-get update && apt-get install -y --no-install-recommends $buildDeps \
&& mkdir /tmp/cmake-build && cd /tmp/cmake-build \
&& cmake \
-DBUILD_COMPILER=ON \
-DBUILD_LIBRARIES=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_EXAMPLES=OFF \
/thrift \
&& cmake --build . --config Release \
&& make install \
&& curl -k -sSL "https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz" -o /tmp/go.tar.gz \
&& tar xzf /tmp/go.tar.gz -C /tmp \
&& cp /tmp/go/bin/gofmt /usr/bin/gofmt \
&& apt-get purge -y --auto-remove $buildDeps \
&& apt-get clean \
&& rm -rf /tmp/* \
&& rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["thrift"]

355
vendor/git.apache.org/thrift.git/LANGUAGES.md generated vendored Normal file
View file

@ -0,0 +1,355 @@
# Apache Thrift Language Support #
Last Modified: 2018-12-17
Guidance For: 0.12.0 or later
Thrift supports many programming languages and has an impressive test suite that exercises most of the languages, protocols, and transports that represents a matrix of thousands of possible combinations. Each language typically has a minimum required version as well as support libraries - some mandatory and some optional. All of this information is provided below to help you assess whether you can use Apache Thrift with your project. Obviously this is a complex matrix to maintain and may not be correct in all cases - if you spot an error please inform the developers using the mailing list.
Apache Thrift has a choice of two build systems. The `autoconf` build system is the most complete build and is used to build all supported languages. The `cmake` build system has been designated by the project to replace `autoconf` however this transition will take quite some time to complete.
The Language/Library Levels indicate the minimum and maximum versions that are used in the [continuous integration environments](build/docker/README.md) (Appveyor, Travis) for Apache Thrift. Other language levels may be supported for each language, however tested less thoroughly; check the README file inside each lib directory for additional details. Note that while a language may contain support for protocols, transports, and servers, the extent to which each is tested as part of the overall build process varies. The definitive integration test for the project is called the "cross" test which executes a test matrix with clients and servers communicating across languages.
<table style="font-size: 60%; padding: 1px;">
<thead>
<tr>
<th rowspan=2>Language</th>
<th rowspan=2 align=center>Since</th>
<th colspan=2 align=center>Build Systems</th>
<th colspan=2 align=center>Lang/Lib Levels (Tested)</th>
<th colspan=6 align=center>Low-Level Transports</th>
<th colspan=3 align=center>Transport Wrappers</th>
<th colspan=4 align=center>Protocols</th>
<th colspan=5 align=center>Servers</th>
<th rowspan=2>Open Issues</th>
</tr>
<tr>
<!-- Build Systems ---------><th>autoconf</th><th>cmake</th>
<!-- Lang/Lib Levels -------><th>Min</th><th>Max</th>
<!-- Low-Level Transports --><th><a href="https://en.wikipedia.org/wiki/Unix_domain_socket">Domain</a></th><th>&nbsp;File&nbsp;</th><th>Memory</th><th>&nbsp;Pipe&nbsp;</th><th>Socket</th><th>&nbsp;TLS&nbsp;</th>
<!-- Transport Wrappers ----><th>Framed</th><th>&nbsp;http&nbsp;</th><th>&nbsp;zlib&nbsp;</th>
<!-- Protocols -------------><th><a href="doc/specs/thrift-binary-protocol.md">Binary</a></th><th><a href="doc/specs/thrift-compact-protocol.md">Compact</a></th><th>&nbsp;JSON&nbsp;</th><th>Multiplex</th>
<!-- Servers ---------------><th>Forking</th><th>Nonblocking</th><th>Simple</th><th>Threaded</th><th>ThreadPool</th>
</tr>
</thead>
<tbody>
<tr align=center>
<td align=left><a href="lib/as3/README.md">ActionScript</a></td>
<!-- Since -----------------><td>0.3.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>ActionScript 3</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313722">ActionScript</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/c_glib/README.md">C (glib)</a></td>
<!-- Since -----------------><td>0.6.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Language Levels -------><td>2.48.2</td><td>2.54.0</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313854">C (glib)</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/cpp/README.md">C++</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Language Levels -------><td colspan=2>C++98</td>
<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312313">C++</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/csharp/README.md">C#</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>.NET&nbsp;3.5 / mono&nbsp;3.2.8.0</td><td>.NET&nbsp;4.6.1 / mono&nbsp;4.6.2.7</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312362">C# (.NET)</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/cocoa/README.md">Cocoa</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>unknown</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312398">Cocoa</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/cl/README.md">Common Lisp</a></td>
<!-- Since -----------------><td>0.12.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>SBCL 1.4.5</td><td>SBCL 1.4.9</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT-82">Common Lisp</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/d/README.md">Dlang</a></td>
<!-- Since -----------------><td>0.9.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>2.075.1</td><td>2.081.0</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12317904">D</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/dart/README.md">Dart</a></td>
<!-- Since -----------------><td>0.10.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>1.22.1</td><td>1.24.3</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12328006">Dart</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/delphi/README.md">Delphi</a></td>
<!-- Since -----------------><td>0.8.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>2010</td><td>unknown</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12316601">Delphi</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/netcore/README.md">.NET Core</a></td>
<!-- Since -----------------><td>0.11.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>2.1.4</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12331176">.NET Core</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/erl/README.md">Erlang</a></td>
<!-- Since -----------------><td>0.3.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>18.3</td><td>20.0.4</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312390">Erlang</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/go/README.md">Go</a></td>
<!-- Since -----------------><td>0.7.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>1.7.6</td><td>1.10.3</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12314307">Go</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/hs/README.md">Haskell</a></td>
<!-- Since -----------------><td>0.5.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Language Levels -------><td>7.10.3</td><td>8.0.2</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312704">Haskell</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/haxe/README.md">Haxe</a></td>
<!-- Since -----------------><td>0.9.3</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>3.2.1</td><td>3.4.4</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12324347">Haxe</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/java/README.md">Java (SE)</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Language Levels -------><td colspan=2>1.8.0_151</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312314">Java SE</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/javame/README.md">Java (ME)</a></td>
<!-- Since -----------------><td>0.5.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>unknown</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313759">Java ME</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/js/README.md">Javascript</a></td>
<!-- Since -----------------><td>0.3.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>unknown</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313418">Javascript</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/lua/README.md">Lua</a></td>
<!-- Since -----------------><td>0.9.2</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>5.1.5</td><td>5.2.4</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12322659">Lua</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/nodejs/README.md">node.js</a></td>
<!-- Since -----------------><td>0.6.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>6.x</td><td>8.11.3</td>
<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12314320">node.js</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/nodets/README.md">node.ts</a></td>
<!-- Since -----------------><td>0.12.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>3.1.6</td><td></td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/issues/?jql=project%20%3D%20THRIFT%20AND%20resolution%20%3D%20Unresolved%20and%20Component%20in%20(%22TypeScript%20-%20Library%22)%20ORDER%20BY%20priority%20DESC%2C%20updated%20DESC">node.ts</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/ocaml/README.md">OCaml</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>4.04.0</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313660">OCaml</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/perl/README.md">Perl</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>5.22.1</td><td>5.26.0</td>
<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312312">Perl</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/php/README.md">PHP</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>7.0.22</td><td>7.1.8</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312431">PHP</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/py/README.md">Python</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Language Levels -------><td>2.7.12, 3.5.2</td><td>2.7.14, 3.6.3</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312315">Python</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/rb/README.md">Ruby</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>2.3.1p112</td><td>2.3.3p222</td>
<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312316">Ruby</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/rs/README.md">Rust</a></td>
<!-- Since -----------------><td>0.11.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>1.17.0</td><td>1.21.0</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12331420">Rust</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/st/README.md">Smalltalk</a></td>
<!-- Since -----------------><td>0.2.0</td>
<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>unknown</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313861">Smalltalk</a></td>
</tr>
</tbody>
<tfoot>
<tr>
<th rowspan=2>Language</th>
<th rowspan=2 align=center>Since</th>
<!-- Build Systems ---------><th>autoconf</th><th>cmake</th>
<!-- Lang/Lib Levels -------><th>Min</th><th>Max</th>
<!-- Low-Level Transports --><th><a href="https://en.wikipedia.org/wiki/Unix_domain_socket">Domain</a></th></th><th>&nbsp;File&nbsp;</th><th>Memory</th><th>&nbsp;Pipe&nbsp;</th><th>Socket</th><th>&nbsp;TLS&nbsp;</th>
<!-- Transport Wrappers ----><th>Framed</th><th>&nbsp;http&nbsp;</th><th>&nbsp;zlib&nbsp;</th>
<!-- Protocols -------------><th><a href="doc/specs/thrift-binary-protocol.md">Binary</a></th><th><a href="doc/specs/thrift-compact-protocol.md">Compact</a></th><th>&nbsp;JSON&nbsp;</th><th>Multiplex</th>
<!-- Servers ---------------><th>Forking</th><th>Nonblocking</th><th>Simple</th><th>Threaded</th><th>ThreadPool</th>
<th rowspan=2>Open Issues</th>
</tr>
<tr>
<th colspan=2 align=center>Build Systems</th>
<th colspan=2 align=center>Lang/Lib Levels (Tested)</th>
<th colspan=6 align=center>Low-Level Transports</th>
<th colspan=3 align=center>Transport Wrappers</th>
<th colspan=4 align=center>Protocols</th>
<th colspan=5 align=center>Servers</th>
</tr>
</tfoot>
</table>

View file

@ -43,7 +43,7 @@ dist-hook:
find $(distdir) -type d \( -iname ".svn" -or -iname ".git" \) | xargs rm -rf
print-version:
@echo $(VERSION)
@echo $(PACKAGE_VERSION)
.PHONY: precross cross
precross-%: all
@ -54,7 +54,7 @@ empty :=
space := $(empty) $(empty)
comma := ,
CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@
CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_CL@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ @MAYBE_RS@ @MAYBE_DOTNETCORE@ @MAYBE_NODETS@
CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS))
if WITH_PY3
@ -65,14 +65,14 @@ endif
if WITH_PYTHON
crossfeature: precross
$(CROSS_PY) test/test.py --retry-count 3 --features .* --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED)
$(CROSS_PY) test/test.py --retry-count 5 --features .* --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED)
else
# feature test needs python build
crossfeature:
endif
cross-%: precross crossfeature
$(CROSS_PY) test/test.py --retry-count 3 --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED) --client $(CROSS_LANGS_COMMA_SEPARATED) --regex "$*"
$(CROSS_PY) test/test.py --retry-count 5 --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED) --client $(CROSS_LANGS_COMMA_SEPARATED) --regex "$*"
cross: cross-.*
@ -111,9 +111,13 @@ EXTRA_DIST = \
.clang-format \
.editorconfig \
.travis.yml \
.rustfmt.toml \
.dockerignore \
appveyor.yml \
bower.json \
build \
bootstrap.sh \
cleanup.sh \
CMakeLists.txt \
composer.json \
contrib \
@ -123,7 +127,7 @@ EXTRA_DIST = \
doap.rdf \
package.json \
sonar-project.properties \
Dockerfile \
LANGUAGES.md \
LICENSE \
CHANGES \
NOTICE \

View file

@ -1,5 +1,5 @@
Apache Thrift
Copyright 2006-2010 The Apache Software Foundation.
Copyright 2006-2017 The Apache Software Foundation.
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
The Apache Software Foundation (http://www.apache.org/).

View file

@ -1,29 +1,66 @@
Apache Thrift
=============
+[![Build Status](https://travis-ci.org/apache/thrift.svg?branch=master)](https://travis-ci.org/apache/thrift)
- +[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/e2qks7enyp9gw7ma?svg=true)](https://ci.appveyor.com/project/apache/thrift)
Introduction
============
Thrift is a lightweight, language-independent software stack with an
associated code generation mechanism for RPC. Thrift provides clean
abstractions for data transport, data serialization, and application
associated code generation mechanism for point-to-point RPC. Thrift provides
clean abstractions for data transport, data serialization, and application
level processing. The code generation system takes a simple definition
language as its input and generates code across programming languages that
language as input and generates code across programming languages that
uses the abstracted stack to build interoperable RPC clients and servers.
![Apache Thrift Layered Architecture](doc/images/thrift-layers.png)
Thrift makes it easy for programs written in different programming
languages to share data and call remote procedures. With support
for [25 programming languages](LANGUAGES.md), chances are Thrift
supports the languages that you currently use.
Thrift is specifically designed to support non-atomic version changes
across client and server code.
For more details on Thrift's design and implementation, take a gander at
the Thrift whitepaper included in this distribution or at the README.md files
For more details on Thrift's design and implementation, see the Thrift
whitepaper included in this distribution, or at the README.md file
in your particular subdirectory of interest.
Hierarchy
=========
Status
======
| Branch | Travis | Appveyor | Coverity Scan | codecov.io | Website |
| :----- | :----- | :------- | :------------ | :--------- | :------ |
| [`master`](https://github.com/apache/thrift/tree/master) | [![Build Status](https://travis-ci.org/apache/thrift.svg?branch=master)](https://travis-ci.org/apache/thrift) | [![Build status](https://ci.appveyor.com/api/projects/status/github/apache/thrift?branch=master&svg=true)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/thrift/history) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/1345/badge.svg)](https://scan.coverity.com/projects/thrift) | | [![Website](https://img.shields.io/badge/official-website-brightgreen.svg)](https://thrift.apache.org/) |
Releases
========
Thrift does not maintain a specific release calendar at this time.
We strive to release twice yearly. Download the [current release](http://thrift.apache.org/download).
License
=======
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Project Hierarchy
=================
thrift/
@ -42,6 +79,7 @@ thrift/
php/
py/
rb/
...
test/
@ -53,10 +91,16 @@ thrift/
Contains a basic tutorial that will teach you how to develop software
using Thrift.
Development
===========
To build the same way Travis CI builds the project you should use docker.
We have [comprehensive building instructions for docker](build/docker/README.md).
Requirements
============
See http://thrift.apache.org/docs/install for an up-to-date list of build requirements.
See http://thrift.apache.org/docs/install for a list of build requirements (may be stale). Alternatively see the docker build environments for a list of prerequisites.
Resources
=========
@ -145,22 +189,4 @@ To run the cross-language test suite, please run:
This will run a set of tests that use different language clients and
servers.
License
=======
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

16
vendor/git.apache.org/thrift.git/Thrift-swift3.podspec generated vendored Normal file
View file

@ -0,0 +1,16 @@
Pod::Spec.new do |s|
s.name = "Thrift-swift3"
s.version = "0.12.0"
s.summary = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC."
s.description = <<-DESC
The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.
DESC
s.homepage = "http://thrift.apache.org"
s.license = { :type => 'Apache License, Version 2.0', :url => 'https://www.apache.org/licenses/LICENSE-2.0' }
s.author = { "Apache Thrift Developers" => "dev@thrift.apache.org" }
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.10'
s.requires_arc = true
s.source = { :git => "https://github.com/apache/thrift.git", :tag => "0.12.0" }
s.source_files = "lib/swift/Sources/*.swift"
end

View file

@ -1,18 +1,18 @@
Pod::Spec.new do |s|
s.name = "Thrift"
s.version = "0.10.0"
s.version = "0.12.0"
s.summary = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC."
s.description = <<-DESC
The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.
DESC
s.homepage = "http://thrift.apache.org"
s.license = { :type => 'Apache License, Version 2.0', :url => 'https://raw.github.com/apache/thrift/thrift-0.9.0/LICENSE' }
s.author = { "The Apache Software Foundation" => "apache@apache.org" }
s.license = { :type => 'Apache License, Version 2.0', :url => 'https://www.apache.org/licenses/LICENSE-2.0' }
s.author = { "Apache Thrift Developers" => "dev@thrift.apache.org" }
s.requires_arc = true
s.ios.deployment_target = '7.0'
s.osx.deployment_target = '10.8'
s.ios.framework = 'CFNetwork'
s.osx.framework = 'CoreServices'
s.source = { :git => "https://github.com/apache/thrift.git", :tag => "thrift-0.10.0" }
s.source = { :git => "https://github.com/apache/thrift.git", :tag => "0.12.0" }
s.source_files = 'lib/cocoa/src/**/*.{h,m,swift}'
end
end

View file

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
# https://www.gnu.org/software/autoconf-archive/ax_boost_base.html
# ===========================================================================
#
# SYNOPSIS
@ -33,7 +33,15 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 23
#serial 45
# example boost program (need to pass version)
m4_define([_AX_BOOST_BASE_PROGRAM],
[AC_LANG_PROGRAM([[
#include <boost/version.hpp>
]],[[
(void) ((void)sizeof(char[1 - 2*!!((BOOST_VERSION) < ($1))]));
]])])
AC_DEFUN([AX_BOOST_BASE],
[
@ -44,101 +52,121 @@ AC_ARG_WITH([boost],
or disable it (ARG=no)
@<:@ARG=yes@:>@ ])],
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ac_boost_path=""
else
want_boost="yes"
ac_boost_path="$withval"
fi
AS_CASE([$withval],
[no],[want_boost="no";_AX_BOOST_BASE_boost_path=""],
[yes],[want_boost="yes";_AX_BOOST_BASE_boost_path=""],
[want_boost="yes";_AX_BOOST_BASE_boost_path="$withval"])
],
[want_boost="yes"])
AC_ARG_WITH([boost-libdir],
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
[Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
[
if test -d "$withval"
then
ac_boost_lib_path="$withval"
else
AC_MSG_ERROR(--with-boost-libdir expected directory name)
fi
],
[ac_boost_lib_path=""]
)
[AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
[Force given directory for boost libraries.
Note that this will override library path detection,
so use this parameter only if default library detection fails
and you know exactly where your boost libraries are located.])],
[
AS_IF([test -d "$withval"],
[_AX_BOOST_BASE_boost_lib_path="$withval"],
[AC_MSG_ERROR([--with-boost-libdir expected directory name])])
],
[_AX_BOOST_BASE_boost_lib_path=""])
if test "x$want_boost" = "xyes"; then
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
boost_lib_version_req_sub_minor="0"
fi
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
BOOST_LDFLAGS=""
BOOST_CPPFLAGS=""
AS_IF([test "x$want_boost" = "xyes"],
[_AX_BOOST_BASE_RUNDETECT([$1],[$2],[$3])])
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
])
# convert a version string in $2 to numeric and affect to polymorphic var $1
AC_DEFUN([_AX_BOOST_BASE_TONUMERICVERSION],[
AS_IF([test "x$2" = "x"],[_AX_BOOST_BASE_TONUMERICVERSION_req="1.20.0"],[_AX_BOOST_BASE_TONUMERICVERSION_req="$2"])
_AX_BOOST_BASE_TONUMERICVERSION_req_shorten=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\.[[0-9]]*\)'`
_AX_BOOST_BASE_TONUMERICVERSION_req_major=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '\([[0-9]]*\)'`
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_major" = "x"],
[AC_MSG_ERROR([You should at least specify libboost major version])])
_AX_BOOST_BASE_TONUMERICVERSION_req_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.\([[0-9]]*\)'`
AS_IF([test "x$_AX_BOOST_BASE_TONUMERICVERSION_req_minor" = "x"],
[_AX_BOOST_BASE_TONUMERICVERSION_req_minor="0"])
_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
AS_IF([test "X$_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor" = "X"],
[_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor="0"])
_AX_BOOST_BASE_TONUMERICVERSION_RET=`expr $_AX_BOOST_BASE_TONUMERICVERSION_req_major \* 100000 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_minor \* 100 \+ $_AX_BOOST_BASE_TONUMERICVERSION_req_sub_minor`
AS_VAR_SET($1,$_AX_BOOST_BASE_TONUMERICVERSION_RET)
])
dnl Run the detection of boost should be run only if $want_boost
AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
_AX_BOOST_BASE_TONUMERICVERSION(WANT_BOOST_VERSION,[$1])
succeeded=no
AC_REQUIRE([AC_CANONICAL_HOST])
dnl On 64-bit systems check for system libraries in both lib64 and lib.
dnl The former is specified by FHS, but e.g. Debian does not adhere to
dnl this (as it rises problems for generic multi-arch support).
dnl The last entry in the list is chosen by default when no libraries
dnl are found, e.g. when only header-only libraries are installed!
libsubdirs="lib"
ax_arch=`uname -m`
case $ax_arch in
x86_64|ppc64|s390x|sparc64|aarch64)
libsubdirs="lib64 lib lib64"
;;
esac
AS_CASE([${host_cpu}],
[x86_64],[libsubdirs="lib64 libx32 lib lib64"],
[ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64],[libsubdirs="lib64 lib lib64"],
[libsubdirs="lib"]
)
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
dnl them priority over the other paths since, if libs are found there, they
dnl are almost assuredly the ones desired.
AC_REQUIRE([AC_CANONICAL_HOST])
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
case ${host_cpu} in
i?86)
libsubdirs="lib/i386-${host_os} $libsubdirs"
;;
esac
AS_CASE([${host_cpu}],
[i?86],[multiarch_libsubdir="lib/i386-${host_os}"],
[multiarch_libsubdir="lib/${host_cpu}-${host_os}"]
)
dnl first we check the system location for boost libraries
dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM
if test "$ac_boost_path" != ""; then
BOOST_CPPFLAGS="-I$ac_boost_path/include"
for ac_boost_path_tmp in $libsubdirs; do
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
break
fi
done
elif test "$cross_compiling" != yes; then
for ac_boost_path_tmp in $lt_sysroot/usr $lt_sysroot/usr/local $lt_sysroot/opt $lt_sysroot/opt/local ; do
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
for libsubdir in $libsubdirs ; do
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
AS_IF([test "x$_AX_BOOST_BASE_boost_path" != "x"],[
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) includes in "$_AX_BOOST_BASE_boost_path/include"])
AS_IF([test -d "$_AX_BOOST_BASE_boost_path/include" && test -r "$_AX_BOOST_BASE_boost_path/include"],[
AC_MSG_RESULT([yes])
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include"
for _AX_BOOST_BASE_boost_path_tmp in $multiarch_libsubdir $libsubdirs; do
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION) lib path in "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp"])
AS_IF([test -d "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" && test -r "$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp" ],[
AC_MSG_RESULT([yes])
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$_AX_BOOST_BASE_boost_path_tmp";
break;
],
[AC_MSG_RESULT([no])])
done],[
AC_MSG_RESULT([no])])
],[
if test X"$cross_compiling" = Xyes; then
search_libsubdirs=$multiarch_libsubdir
else
search_libsubdirs="$multiarch_libsubdir $libsubdirs"
fi
for _AX_BOOST_BASE_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$_AX_BOOST_BASE_boost_path_tmp/include/boost" && test -r "$_AX_BOOST_BASE_boost_path_tmp/include/boost" ; then
for libsubdir in $search_libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path_tmp/include"
break;
fi
done
fi
])
dnl overwrite ld flags if we have required special directory with
dnl --with-boost-libdir parameter
if test "$ac_boost_lib_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_lib_path"
fi
AS_IF([test "x$_AX_BOOST_BASE_boost_lib_path" != "x"],
[BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_lib_path"])
AC_MSG_CHECKING([for boostlib >= $1 ($WANT_BOOST_VERSION)])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
@ -149,15 +177,7 @@ if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CXX])
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
@ -169,30 +189,50 @@ if test "x$want_boost" = "xyes"; then
dnl if we found no boost with system layout we search for boost libraries
dnl built and installed without the --layout=system option or for a staged(not installed) version
if test "x$succeeded" != "xyes"; then
if test "x$succeeded" != "xyes" ; then
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
BOOST_CPPFLAGS=
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
BOOST_LDFLAGS=
fi
_version=0
if test "$ac_boost_path" != ""; then
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
if test -n "$_AX_BOOST_BASE_boost_path" ; then
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path"; then
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path/include/boost-$VERSION_UNDERSCORE"
done
dnl if nothing found search for layout used in Windows distributions
if test -z "$BOOST_CPPFLAGS"; then
if test -d "$_AX_BOOST_BASE_boost_path/boost" && test -r "$_AX_BOOST_BASE_boost_path/boost"; then
BOOST_CPPFLAGS="-I$_AX_BOOST_BASE_boost_path"
fi
fi
dnl if we found something and BOOST_LDFLAGS was unset before
dnl (because "$_AX_BOOST_BASE_boost_lib_path" = ""), set it here.
if test -n "$BOOST_CPPFLAGS" && test -z "$BOOST_LDFLAGS"; then
for libsubdir in $libsubdirs ; do
if ls "$_AX_BOOST_BASE_boost_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$_AX_BOOST_BASE_boost_path/$libsubdir"
fi
fi
else
if test "$cross_compiling" != yes; then
for ac_boost_path in $lt_sysroot/usr $lt_sysroot/usr/local $lt_sysroot/opt $lt_sysroot/opt/local ; do
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
if test "x$cross_compiling" != "xyes" ; then
for _AX_BOOST_BASE_boost_path in /usr /usr/local /opt /opt/local ; do
if test -d "$_AX_BOOST_BASE_boost_path" && test -r "$_AX_BOOST_BASE_boost_path" ; then
for i in `ls -d $_AX_BOOST_BASE_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$_AX_BOOST_BASE_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
if test "x$V_CHECK" = "x1" ; then
_version=$_version_tmp
best_path=$ac_boost_path
best_path=$_AX_BOOST_BASE_boost_path
fi
done
fi
@ -200,7 +240,7 @@ if test "x$want_boost" = "xyes"; then
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
if test "$ac_boost_lib_path" = ""; then
if test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
for libsubdir in $libsubdirs ; do
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
@ -208,7 +248,7 @@ if test "x$want_boost" = "xyes"; then
fi
fi
if test "x$BOOST_ROOT" != "x"; then
if test -n "$BOOST_ROOT" ; then
for libsubdir in $libsubdirs ; do
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
@ -217,7 +257,7 @@ if test "x$want_boost" = "xyes"; then
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
if test "x$V_CHECK" = "x1" && test -z "$_AX_BOOST_BASE_boost_lib_path" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
@ -232,15 +272,7 @@ if test "x$want_boost" = "xyes"; then
export LDFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_COMPILE_IFELSE([_AX_BOOST_BASE_PROGRAM($WANT_BOOST_VERSION)],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
@ -249,17 +281,15 @@ if test "x$want_boost" = "xyes"; then
AC_LANG_POP([C++])
fi
if test "$succeeded" != "yes" ; then
if test "$_version" = "0" ; then
AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
if test "x$succeeded" != "xyes" ; then
if test "x$_version" = "x0" ; then
AC_MSG_NOTICE([[We could not detect the boost libraries (version $1 or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
else
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
fi
# execute ACTION-IF-NOT-FOUND (if present):
ifelse([$3], , :, [$3])
else
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
# execute ACTION-IF-FOUND (if present):
ifelse([$2], , :, [$2])
@ -267,6 +297,5 @@ if test "x$want_boost" = "xyes"; then
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])

View file

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
# https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
# ===========================================================================
#
# SYNOPSIS
@ -32,7 +32,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 8
#serial 10
AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
AC_DEFUN([AX_CHECK_OPENSSL], [
@ -51,7 +51,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
], [
# if pkg-config is installed and openssl has installed a .pc file,
# then use that information and don't search ssldirs
AC_PATH_PROG([PKG_CONFIG], [pkg-config])
AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
if test x"$PKG_CONFIG" != x""; then
OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
if test $? = 0; then

View file

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
# ===========================================================================
#
# SYNOPSIS
@ -79,7 +79,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 11
#serial 12
dnl #########################################################################
AC_DEFUN([AX_COMPARE_VERSION], [

View file

@ -0,0 +1,948 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the specified
# version of the C++ standard. If necessary, add switches to CXX and
# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
# or '14' (for the C++14 standard).
#
# The second argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
# -std=c++11). If neither is specified, you get whatever works, with
# preference for an extended mode.
#
# The third argument, if specified 'mandatory' or if left unspecified,
# indicates that baseline support for the specified C++ standard is
# required and that the macro should error out if no mode with that
# support is found. If specified 'optional', then configuration proceeds
# regardless, after defining HAVE_CXX${VERSION} if and only if a
# supporting mode is found.
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 10
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$2], [], [],
[$2], [ext], [],
[$2], [noext], [],
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
AC_LANG_PUSH([C++])dnl
ac_success=no
m4_if([$2], [noext], [], [dnl
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
switch="-std=gnu++${alternative}"
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
fi])
m4_if([$2], [ext], [], [dnl
if test x$ac_success = xno; then
dnl HP's aCC needs +std=c++11 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
dnl Cray's crayCC needs "-h std=c++11"
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
if test x$ac_success = xyes; then
break
fi
done
fi])
AC_LANG_POP([C++])
if test x$ax_cxx_compile_cxx$1_required = xtrue; then
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
fi
fi
if test x$ac_success = xno; then
HAVE_CXX$1=0
AC_MSG_NOTICE([No compiler with C++$1 support was found])
else
HAVE_CXX$1=1
AC_DEFINE(HAVE_CXX$1,1,
[define if the compiler supports basic C++$1 syntax])
fi
AC_SUBST(HAVE_CXX$1)
])
dnl Test body for checking C++11 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
)
dnl Test body for checking C++14 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
)
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
)
dnl Tests for new features in C++11
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
// If the compiler admits that it is not ready for C++11, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201103L
#error "This is not a C++11 compiler"
#else
namespace cxx11
{
namespace test_static_assert
{
template <typename T>
struct check
{
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
}
namespace test_final_override
{
struct Base
{
virtual void f() {}
};
struct Derived : public Base
{
virtual void f() override {}
};
}
namespace test_double_right_angle_brackets
{
template < typename T >
struct check {};
typedef check<void> single_type;
typedef check<check<void>> double_type;
typedef check<check<check<void>>> triple_type;
typedef check<check<check<check<void>>>> quadruple_type;
}
namespace test_decltype
{
int
f()
{
int a = 1;
decltype(a) b = 2;
return a + b;
}
}
namespace test_type_deduction
{
template < typename T1, typename T2 >
struct is_same
{
static const bool value = false;
};
template < typename T >
struct is_same<T, T>
{
static const bool value = true;
};
template < typename T1, typename T2 >
auto
add(T1 a1, T2 a2) -> decltype(a1 + a2)
{
return a1 + a2;
}
int
test(const int c, volatile int v)
{
static_assert(is_same<int, decltype(0)>::value == true, "");
static_assert(is_same<int, decltype(c)>::value == false, "");
static_assert(is_same<int, decltype(v)>::value == false, "");
auto ac = c;
auto av = v;
auto sumi = ac + av + 'x';
auto sumf = ac + av + 1.0;
static_assert(is_same<int, decltype(ac)>::value == true, "");
static_assert(is_same<int, decltype(av)>::value == true, "");
static_assert(is_same<int, decltype(sumi)>::value == true, "");
static_assert(is_same<int, decltype(sumf)>::value == false, "");
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
return (sumf > 0.0) ? sumi : add(c, v);
}
}
namespace test_noexcept
{
int f() { return 0; }
int g() noexcept { return 0; }
static_assert(noexcept(f()) == false, "");
static_assert(noexcept(g()) == true, "");
}
namespace test_constexpr
{
template < typename CharT >
unsigned long constexpr
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
{
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
}
template < typename CharT >
unsigned long constexpr
strlen_c(const CharT *const s) noexcept
{
return strlen_c_r(s, 0UL);
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("1") == 1UL, "");
static_assert(strlen_c("example") == 7UL, "");
static_assert(strlen_c("another\0example") == 7UL, "");
}
namespace test_rvalue_references
{
template < int N >
struct answer
{
static constexpr int value = N;
};
answer<1> f(int&) { return answer<1>(); }
answer<2> f(const int&) { return answer<2>(); }
answer<3> f(int&&) { return answer<3>(); }
void
test()
{
int i = 0;
const int c = 0;
static_assert(decltype(f(i))::value == 1, "");
static_assert(decltype(f(c))::value == 2, "");
static_assert(decltype(f(0))::value == 3, "");
}
}
namespace test_uniform_initialization
{
struct test
{
static const int zero {};
static const int one {1};
};
static_assert(test::zero == 0, "");
static_assert(test::one == 1, "");
}
namespace test_lambdas
{
void
test1()
{
auto lambda1 = [](){};
auto lambda2 = lambda1;
lambda1();
lambda2();
}
int
test2()
{
auto a = [](int i, int j){ return i + j; }(1, 2);
auto b = []() -> int { return '0'; }();
auto c = [=](){ return a + b; }();
auto d = [&](){ return c; }();
auto e = [a, &b](int x) mutable {
const auto identity = [](int y){ return y; };
for (auto i = 0; i < a; ++i)
a += b--;
return x + identity(a + b);
}(0);
return a + b + c + d + e;
}
int
test3()
{
const auto nullary = [](){ return 0; };
const auto unary = [](int x){ return x; };
using nullary_t = decltype(nullary);
using unary_t = decltype(unary);
const auto higher1st = [](nullary_t f){ return f(); };
const auto higher2nd = [unary](nullary_t f1){
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
};
return higher1st(nullary) + higher2nd(nullary)(unary);
}
}
namespace test_variadic_templates
{
template <int...>
struct sum;
template <int N0, int... N1toN>
struct sum<N0, N1toN...>
{
static constexpr auto value = N0 + sum<N1toN...>::value;
};
template <>
struct sum<>
{
static constexpr auto value = 0;
};
static_assert(sum<>::value == 0, "");
static_assert(sum<1>::value == 1, "");
static_assert(sum<23>::value == 23, "");
static_assert(sum<1, 2>::value == 3, "");
static_assert(sum<5, 5, 11>::value == 21, "");
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
}
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
// because of this.
namespace test_template_alias_sfinae
{
struct foo {};
template<typename T>
using member = typename T::member_type;
template<typename T>
void func(...) {}
template<typename T>
void func(member<T>*) {}
void test();
void test() { func<foo>(0); }
}
} // namespace cxx11
#endif // __cplusplus >= 201103L
]])
dnl Tests for new features in C++14
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
// If the compiler admits that it is not ready for C++14, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201402L
#error "This is not a C++14 compiler"
#else
namespace cxx14
{
namespace test_polymorphic_lambdas
{
int
test()
{
const auto lambda = [](auto&&... args){
const auto istiny = [](auto x){
return (sizeof(x) == 1UL) ? 1 : 0;
};
const int aretiny[] = { istiny(args)... };
return aretiny[0];
};
return lambda(1, 1L, 1.0f, '1');
}
}
namespace test_binary_literals
{
constexpr auto ivii = 0b0000000000101010;
static_assert(ivii == 42, "wrong value");
}
namespace test_generalized_constexpr
{
template < typename CharT >
constexpr unsigned long
strlen_c(const CharT *const s) noexcept
{
auto length = 0UL;
for (auto p = s; *p; ++p)
++length;
return length;
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("x") == 1UL, "");
static_assert(strlen_c("test") == 4UL, "");
static_assert(strlen_c("another\0test") == 7UL, "");
}
namespace test_lambda_init_capture
{
int
test()
{
auto x = 0;
const auto lambda1 = [a = x](int b){ return a + b; };
const auto lambda2 = [a = lambda1(x)](){ return a; };
return lambda2();
}
}
namespace test_digit_separators
{
constexpr auto ten_million = 100'000'000;
static_assert(ten_million == 100000000, "");
}
namespace test_return_type_deduction
{
auto f(int& x) { return x; }
decltype(auto) g(int& x) { return x; }
template < typename T1, typename T2 >
struct is_same
{
static constexpr auto value = false;
};
template < typename T >
struct is_same<T, T>
{
static constexpr auto value = true;
};
int
test()
{
auto x = 0;
static_assert(is_same<int, decltype(f(x))>::value, "");
static_assert(is_same<int&, decltype(g(x))>::value, "");
return x;
}
}
} // namespace cxx14
#endif // __cplusplus >= 201402L
]])
dnl Tests for new features in C++17
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
// If the compiler admits that it is not ready for C++17, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201703L
#error "This is not a C++17 compiler"
#else
#include <initializer_list>
#include <utility>
#include <type_traits>
namespace cxx17
{
namespace test_constexpr_lambdas
{
constexpr int foo = [](){return 42;}();
}
namespace test::nested_namespace::definitions
{
}
namespace test_fold_expression
{
template<typename... Args>
int multiply(Args... args)
{
return (args * ... * 1);
}
template<typename... Args>
bool all(Args... args)
{
return (args && ...);
}
}
namespace test_extended_static_assert
{
static_assert (true);
}
namespace test_auto_brace_init_list
{
auto foo = {5};
auto bar {5};
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
static_assert(std::is_same<int, decltype(bar)>::value);
}
namespace test_typename_in_template_template_parameter
{
template<template<typename> typename X> struct D;
}
namespace test_fallthrough_nodiscard_maybe_unused_attributes
{
int f1()
{
return 42;
}
[[nodiscard]] int f2()
{
[[maybe_unused]] auto unused = f1();
switch (f1())
{
case 17:
f1();
[[fallthrough]];
case 42:
f1();
}
return f1();
}
}
namespace test_extended_aggregate_initialization
{
struct base1
{
int b1, b2 = 42;
};
struct base2
{
base2() {
b3 = 42;
}
int b3;
};
struct derived : base1, base2
{
int d;
};
derived d1 {{1, 2}, {}, 4}; // full initialization
derived d2 {{}, {}, 4}; // value-initialized bases
}
namespace test_general_range_based_for_loop
{
struct iter
{
int i;
int& operator* ()
{
return i;
}
const int& operator* () const
{
return i;
}
iter& operator++()
{
++i;
return *this;
}
};
struct sentinel
{
int i;
};
bool operator== (const iter& i, const sentinel& s)
{
return i.i == s.i;
}
bool operator!= (const iter& i, const sentinel& s)
{
return !(i == s);
}
struct range
{
iter begin() const
{
return {0};
}
sentinel end() const
{
return {5};
}
};
void f()
{
range r {};
for (auto i : r)
{
[[maybe_unused]] auto v = i;
}
}
}
namespace test_lambda_capture_asterisk_this_by_value
{
struct t
{
int i;
int foo()
{
return [*this]()
{
return i;
}();
}
};
}
namespace test_enum_class_construction
{
enum class byte : unsigned char
{};
byte foo {42};
}
namespace test_constexpr_if
{
template <bool cond>
int f ()
{
if constexpr(cond)
{
return 13;
}
else
{
return 42;
}
}
}
namespace test_selection_statement_with_initializer
{
int f()
{
return 13;
}
int f2()
{
if (auto i = f(); i > 0)
{
return 3;
}
switch (auto i = f(); i + 4)
{
case 17:
return 2;
default:
return 1;
}
}
}
namespace test_template_argument_deduction_for_class_templates
{
template <typename T1, typename T2>
struct pair
{
pair (T1 p1, T2 p2)
: m1 {p1},
m2 {p2}
{}
T1 m1;
T2 m2;
};
void f()
{
[[maybe_unused]] auto p = pair{13, 42u};
}
}
namespace test_non_type_auto_template_parameters
{
template <auto n>
struct B
{};
B<5> b1;
B<'a'> b2;
}
namespace test_structured_bindings
{
int arr[2] = { 1, 2 };
std::pair<int, int> pr = { 1, 2 };
auto f1() -> int(&)[2]
{
return arr;
}
auto f2() -> std::pair<int, int>&
{
return pr;
}
struct S
{
int x1 : 2;
volatile double y1;
};
S f3()
{
return {};
}
auto [ x1, y1 ] = f1();
auto& [ xr1, yr1 ] = f1();
auto [ x2, y2 ] = f2();
auto& [ xr2, yr2 ] = f2();
const auto [ x3, y3 ] = f3();
}
namespace test_exception_spec_type_system
{
struct Good {};
struct Bad {};
void g1() noexcept;
void g2();
template<typename T>
Bad
f(T*, T*);
template<typename T1, typename T2>
Good
f(T1*, T2*);
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
}
namespace test_inline_variables
{
template<class T> void f(T)
{}
template<class T> inline T g(T)
{
return T{};
}
template<> inline void f<>(int)
{}
template<> int g<>(int)
{
return 5;
}
}
} // namespace cxx17
#endif // __cplusplus < 201703L
]])

View file

@ -1,26 +1,23 @@
# ============================================================================
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
# ============================================================================
# =============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
# =============================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the C++11
# standard; if necessary, add switches to CXXFLAGS to enable support.
# standard; if necessary, add switches to CXX and CXXCPP to enable
# support.
#
# The first argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
# -std=c++11). If neither is specified, you get whatever works, with
# preference for an extended mode.
#
# The second argument, if specified 'mandatory' or if left unspecified,
# indicates that baseline C++11 support is required and that the macro
# should error out if no mode with that support is found. If specified
# 'optional', then configuration proceeds regardless, after defining
# HAVE_CXX11 if and only if a supporting mode is found.
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
# macro with the version set to C++11. The two optional arguments are
# forwarded literally as the second and third argument respectively.
# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
# more information. If you want to use this macro, you also need to
# download the ax_cxx_compile_stdcxx.m4 file.
#
# LICENSE
#
@ -28,138 +25,15 @@
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 10
#serial 18
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
template <typename T>
struct check
{
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
struct Base {
virtual void f() {}
};
struct Child : public Base {
virtual void f() override {}
};
typedef check<check<bool>> right_angle_brackets;
int a;
decltype(a) b;
typedef check<int> check_type;
check_type c;
check_type&& cr = static_cast<check_type&&>(c);
auto d = a;
auto l = [](){};
// Prevent Clang error: unused variable 'l' [-Werror,-Wunused-variable]
struct use_l { use_l() { l(); } };
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this
namespace test_template_alias_sfinae {
struct foo {};
template<typename T>
using member = typename T::member_type;
template<typename T>
void func(...) {}
template<typename T>
void func(member<T>*) {}
void test();
void test() {
func<foo>(0);
}
}
]])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
m4_if([$1], [], [],
[$1], [ext], [],
[$1], [noext], [],
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
[$2], [optional], [ax_cxx_compile_cxx11_required=false],
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
AC_LANG_PUSH([C++])dnl
ac_success=no
AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
ax_cv_cxx_compile_cxx11,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
[ax_cv_cxx_compile_cxx11=yes],
[ax_cv_cxx_compile_cxx11=no])])
if test x$ax_cv_cxx_compile_cxx11 = xyes; then
ac_success=yes
fi
m4_if([$1], [noext], [], [dnl
if test x$ac_success = xno; then
for switch in -std=gnu++11 -std=gnu++0x; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
$cachevar,
[ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
ac_success=yes
break
fi
done
fi])
m4_if([$1], [ext], [], [dnl
if test x$ac_success = xno; then
for switch in -std=c++11 -std=c++0x; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
$cachevar,
[ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
ac_success=yes
break
fi
done
fi])
AC_LANG_POP([C++])
if test x$ax_cxx_compile_cxx11_required = xtrue; then
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
fi
else
if test x$ac_success = xno; then
HAVE_CXX11=0
AC_MSG_NOTICE([No compiler with C++11 support was found])
else
HAVE_CXX11=1
AC_DEFINE(HAVE_CXX11,1,
[define if the compiler supports basic C++11 syntax])
fi
AC_SUBST(HAVE_CXX11)
fi
])
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])

View file

@ -118,7 +118,7 @@ AC_DEFUN([AX_CHECK_JAVA_CLASS],
AC_DEFUN([AX_CHECK_ANT_VERSION],
[
AC_MSG_CHECKING(for ant version > $2)
ANT_VALID=`expr $($1 -version 2>/dev/null | sed -n 's/.*version \(@<:@0-9\.@:>@*\).*/\1/p') \>= $2`
ANT_VALID=`expr "x$(printf "$2\n$($1 -version 2>/dev/null | sed -n 's/.*version \(@<:@0-9\.@:>@*\).*/\1/p')" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -g | sed -n 1p)" = "x$2"`
if test "x$ANT_VALID" = "x1" ; then
AC_MSG_RESULT(yes)
else

View file

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_lua.html
# https://www.gnu.org/software/autoconf-archive/ax_lua.html
# ===========================================================================
#
# SYNOPSIS
@ -166,7 +166,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@ -181,7 +181,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 39
#serial 40
dnl =========================================================================
dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION],

View file

@ -0,0 +1,61 @@
# ===============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_prog_dotnetcore_version.html
# ===============================================================================
#
# SYNOPSIS
#
# AX_PROG_DOTNETCORE_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
#
# DESCRIPTION
#
# Makes sure that .NET Core supports the version indicated. If true the
# shell commands in ACTION-IF-TRUE are executed. If not the shell commands
# in ACTION-IF-FALSE are run. The $dotnetcore_version variable will be
# filled with the detected version.
#
# This macro uses the $DOTNETCORE variable to perform the check. If
# $DOTNETCORE is not set prior to calling this macro, the macro will fail.
#
# Example:
#
# AC_PATH_PROG([DOTNETCORE],[dotnet])
# AC_PROG_DOTNETCORE_VERSION([1.0.2],[ ... ],[ ... ])
#
# Searches for .NET Core, then checks if at least version 1.0.2 is
# present.
#
# LICENSE
#
# Copyright (c) 2016 Jens Geyer <jensg@apache.org>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 2
AC_DEFUN([AX_PROG_DOTNETCORE_VERSION],[
AC_REQUIRE([AC_PROG_SED])
AS_IF([test -n "$DOTNETCORE"],[
ax_dotnetcore_version="$1"
AC_MSG_CHECKING([for .NET Core version])
dotnetcore_version=`$DOTNETCORE --version 2>&1 | $SED -e 's/\(@<:@0-9@:>@*\.@<:@0-9@:>@*\.@<:@0-9@:>@*\)\(.*\)/\1/'`
AC_MSG_RESULT($dotnetcore_version)
AC_SUBST([DOTNETCORE_VERSION],[$dotnetcore_version])
AX_COMPARE_VERSION([$ax_dotnetcore_version],[le],[$dotnetcore_version],[
:
$2
],[
:
$3
])
],[
AC_MSG_WARN([could not find .NET Core])
$3
])
])

View file

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prog_haxe_version.html
# https://www.gnu.org/software/autoconf-archive/ax_prog_haxe_version.html
# ===========================================================================
#
# SYNOPSIS
@ -32,7 +32,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 1
#serial 2
AC_DEFUN([AX_PROG_HAXE_VERSION],[
AC_REQUIRE([AC_PROG_SED])

View file

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
# https://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
# ===========================================================================
#
# SYNOPSIS
@ -32,7 +32,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
#serial 8
AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES])
AC_DEFUN([AX_PROG_PERL_MODULES],[dnl

View file

@ -1,3 +1,4 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@ -18,76 +19,92 @@
# build Apache Thrift on AppVeyor - https://ci.appveyor.com
shallow_clone: true
clone_depth: 10
version: '0.12.0.{build}'
shallow_clone: true
version: '{build}'
os:
# - Windows Server 2012 R2
- Visual Studio 2015
- Visual Studio 2017
matrix:
allow_failures:
- PROFILE: CYGWIN
fast_finish: true
environment:
BOOST_ROOT: C:\Libraries\boost_1_59_0
BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib64-msvc-14.0
# Unfurtunately, this version needs manual update because old versions are quickly deleted.
ANT_VERSION: 1.9.7
matrix:
- PROFILE: MSVC2017
PLATFORM: x64
CONFIGURATION: Release
BOOST_VERSION: 1.65.1
LIBEVENT_VERSION: 2.1.8
PYTHON_VERSION: 3.6
QT_VERSION: 5.10
ZLIB_VERSION: 1.2.11
DISABLED_TESTS: StressTestNonBlocking
- PROFILE: MSVC2013
PLATFORM: x86
CONFIGURATION: Release
BOOST_VERSION: 1.58.0
LIBEVENT_VERSION: 2.0.22
PYTHON_VERSION: 3.5
QT_VERSION: 5.8
ZLIB_VERSION: 1.2.8
DISABLED_TESTS: StressTestNonBlocking
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- PROFILE: MINGW
PLATFORM: x64
CONFIGURATION: RelWithDebInfo
DISABLED_TESTS: StressTestNonBlocking
- PROFILE: CYGWIN
PLATFORM: x86
CONFIGURATION: RelWithDebInfo
DISABLED_TESTS: (ZlibTest|OpenSSLManualInitTest|TNonblockingServerTest|StressTestNonBlocking)
# - PROFILE: CYGWIN
# PLATFORM: x64
# CONFIGURATION: RelWithDebInfo
# DISABLED_TESTS: (ZlibTest|OpenSSLManualInitTest|TNonblockingServerTest|StressTestNonBlocking)
install:
- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64'
- cd \
# Zlib
- appveyor DownloadFile https://github.com/madler/zlib/archive/v1.2.8.tar.gz
- 7z x v1.2.8.tar.gz -so | 7z x -si -ttar > nul
- cd zlib-1.2.8
- cmake -G "Visual Studio 14 2015 Win64" .
- cmake --build . --config release
- cd ..
# OpenSSL
- C:\Python35-x64\python %APPVEYOR_BUILD_FOLDER%\build\appveyor\download_openssl.py
- ps: Start-Process "Win64OpenSSL.exe" -ArgumentList "/silent /verysilent /sp- /suppressmsgboxes" -Wait
# Libevent
- appveyor DownloadFile https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
- 7z x libevent-2.0.22-stable.tar.gz -so | 7z x -si -ttar > nul
- cd libevent-2.0.22-stable
- nmake -f Makefile.nmake
- mkdir lib
- move *.lib lib\
- move WIN32-Code\event2\* include\event2\
- move *.h include\
- cd ..
- appveyor-retry cinst -y winflexbison
- appveyor DownloadFile http://www.us.apache.org/dist/ant/binaries/apache-ant-%ANT_VERSION%-bin.zip
- 7z x apache-ant-%ANT_VERSION%-bin.zip > nul
- cd %APPVEYOR_BUILD_FOLDER%
# TODO: Enable Haskell build
# - cinst HaskellPlatform -version 2014.2.0.0
- cd %APPVEYOR_BUILD_FOLDER%
- call build\appveyor\%PROFILE:~0,4%-appveyor-install.bat
- refreshenv
build_script:
- set PATH=C:\ProgramData\chocolatey\bin;C:\apache-ant-%ANT_VERSION%\bin;%PATH%
- set JAVA_HOME=C:\Program Files\Java\jdk1.7.0
- set PATH=%JAVA_HOME%\bin;%PATH%
# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\bin
# - set PATH=%PATH%;C:\Program Files (x86)\Haskell Platform\2014.2.0.0\lib\extralibs\bin
- set PATH=C:\Python27-x64\scripts;C:\Python27-x64;%PATH%
- pip install ipaddress backports.ssl_match_hostname tornado twisted
- mkdir cmake-build
- cd cmake-build
- cmake -G "Visual Studio 14 2015 Win64" -DWITH_SHARED_LIB=OFF -DLIBEVENT_ROOT=C:\libevent-2.0.22-stable -DZLIB_INCLUDE_DIR=C:\zlib-1.2.8 -DZLIB_LIBRARY=C:\zlib-1.2.8\release\zlibstatic.lib -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ..
- findstr /b /e BUILD_COMPILER:BOOL=ON CMakeCache.txt
- findstr /b /e BUILD_CPP:BOOL=ON CMakeCache.txt
- findstr /b /e BUILD_JAVA:BOOL=ON CMakeCache.txt
- findstr /b /e BUILD_PYTHON:BOOL=ON CMakeCache.txt
# - findstr /b /e BUILD_C_GLIB:BOOL=ON CMakeCache.txt
# - findstr /b /e BUILD_HASKELL:BOOL=ON CMakeCache.txt
- findstr /b /e BUILD_TESTING:BOOL=ON CMakeCache.txt
# - cmake --build .
- cmake --build . --config Release
# TODO: Fix cpack
# - cpack
# TODO: Run more tests
# CTest fails to invoke ant seemingly due to "ant.bat" v.s. "ant" (shell script) conflict.
# Currently, everything that involves OpenSSL seems to hang forever on our Appveyor setup.
# Also a few C++ tests hang (on Appveyor or on Windows in general).
- ctest -C Release --timeout 600 -VV -E "(StressTestNonBlocking|PythonTestSSLSocket|python_test$|^Java)"
# TODO make it perfect ;-r
- cd %APPVEYOR_BUILD_FOLDER%
- call build\appveyor\%PROFILE:~0,4%-appveyor-build.bat
test_script:
- cd %APPVEYOR_BUILD_FOLDER%
- call build\appveyor\%PROFILE:~0,4%-appveyor-test.bat
# artifact capture disabled as it might increase service cost for little gain:
#
# artifacts:
# - path: local-thrift-inst
# name: cmake installed content
# type: zip
#
# - path: local-thrift-build\Testing
# name: ctest output
# type: zip
# RDP support: use one or the other...
#
# enables RDP for each build job so you can inspect the environment at the beginning of the job:
# init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#
# enables RDP at the end of the build job so you can login and re-run
# commands to see why something failed...
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#
# also need:
# environment:
# APPVEYOR_RDP_PASSWORD: thr1FT2345$xyzZ

View file

@ -38,17 +38,24 @@ else
exit 1
fi
format_version () {
printf "%03d%03d%03d%03d" $(echo $1 | tr '.' ' ');
}
# we require automake 1.13 or later
# check must happen externally due to use of newer macro
AUTOMAKE_VERSION=`automake --version | grep automake | egrep -o '([0-9]{1,}\.)+[0-9]{1,}'`
if [ "$AUTOMAKE_VERSION" \< "1.13" ]; then
if [ $(format_version $AUTOMAKE_VERSION) -lt $(format_version 1.13) ]; then
echo >&2 "automake version $AUTOMAKE_VERSION is too old (need 1.13 or later)"
exit 1
fi
set -e
autoscan
$LIBTOOLIZE --copy --automake
aclocal -I ./aclocal
autoheader
sed '/undef VERSION/d' config.hin > config.hin2
mv config.hin2 config.hin
autoconf
automake --copy --add-missing --foreign

View file

@ -1,6 +1,6 @@
{
"name": "thrift",
"version": "0.10.0",
"version": "0.12.0",
"homepage": "https://git-wip-us.apache.org/repos/asf/thrift.git",
"authors": [
"Apache Thrift <dev@thrift.apache.org>"

View file

@ -0,0 +1,36 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_build.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
SET CMAKEARGS=^
-G'%GENERATOR%' ^
-DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
-DCMAKE_INSTALL_PREFIX=%INSTDIR% ^
-DCMAKE_CXX_EXTENSIONS=ON ^
-DCMAKE_CXX_FLAGS="-D_GNU_SOURCE" ^
-DCMAKE_CXX_STANDARD=11 ^
-DWITH_PYTHON=OFF ^
-DWITH_SHARED_LIB=OFF ^
-DWITH_STATIC_LIB=ON ^
-DWITH_STDTHREADS=ON
@ECHO ON
%BASH% -lc "mkdir -p %BUILDDIR% && cd %BUILDDIR% && cmake.exe %SRCDIR% %CMAKEARGS% && cmake --build . --config %CONFIGURATION% --target install" || EXIT /B
@ECHO OFF

View file

@ -0,0 +1,34 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
::
:: Appveyor install script for CYGWIN
:: Installs third party packages we need for a cmake build
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_install.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
CALL cl_showenv.bat || EXIT /B
::
:: Install apt-cyg for package management
::
%BASH% -lc "wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg && install apt-cyg /bin && rm -f apt-cyg" || EXIT /B
%BASH% -lc "apt-cyg update" || EXIT /B
%BASH% -lc "apt-cyg install bison cmake flex gcc-g++ libboost-devel libevent-devel make openssl-devel zlib-devel"

View file

@ -0,0 +1,21 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_test.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
%BASH% -lc "cd %BUILDDIR% && ctest.exe -C %CONFIGURATION% --timeout 300 -VV -E '%DISABLED_TESTS%'" || EXIT /B

View file

@ -0,0 +1,36 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_build.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
SET CMAKEARGS=^
-G'%GENERATOR%' ^
-DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
-DCMAKE_INSTALL_PREFIX=%INSTDIR% ^
-DCMAKE_MAKE_PROGRAM=/mingw%NORM_PLATFORM%/bin/mingw32-make ^
-DCMAKE_C_COMPILER=/mingw%NORM_PLATFORM%/bin/gcc.exe ^
-DCMAKE_CXX_COMPILER=/mingw%NORM_PLATFORM%/bin/g++.exe ^
-DOPENSSL_ROOT_DIR=/mingw%NORM_PLATFORM% ^
-DWITH_PYTHON=OFF ^
-DWITH_SHARED_LIB=OFF ^
-DWITH_STATIC_LIB=ON
@ECHO ON
%BASH% -lc "mkdir -p %BUILDDIR% && cd %BUILDDIR% && cmake.exe %SRCDIR% %CMAKEARGS% && cmake --build . --config %CONFIGURATION% --target install" || EXIT /B
@ECHO OFF

View file

@ -0,0 +1,45 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
::
:: Appveyor install script for MINGW on MSYS2
:: Installs third party packages we need for a cmake build
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_install.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
CALL cl_showenv.bat || EXIT /B
SET PACKAGES=^
--needed -S bison flex make ^
mingw-w64-%MINGWPLAT%-boost ^
mingw-w64-%MINGWPLAT%-cmake ^
mingw-w64-%MINGWPLAT%-libevent ^
mingw-w64-%MINGWPLAT%-openssl ^
mingw-w64-%MINGWPLAT%-toolchain ^
mingw-w64-%MINGWPLAT%-zlib
::mingw-w64-%MINGWPLAT%-qt5 : WAY too large (1GB download!) - tested in cygwin builds anyway
:: Remove old packages that no longer exist to avoid an error
%BASH% -lc "pacman --noconfirm --remove libcatgets catgets || true" || EXIT /B
:: Upgrade things
%BASH% -lc "pacman --noconfirm -Syu %IGNORE%" || EXIT /B
%BASH% -lc "pacman --noconfirm -Su %IGNORE%" || EXIT /B
%BASH% -lc "pacman --noconfirm %PACKAGES%" || EXIT /B

View file

@ -0,0 +1,22 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_test.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
%BASH% -lc "cd %BUILDDIR% && ctest.exe -C %CONFIGURATION% --timeout 300 -VV -E '%DISABLED_TESTS%'" || EXIT /B

View file

@ -0,0 +1,47 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_build.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
MKDIR "%BUILDDIR%" || EXIT /B
CD "%BUILDDIR%" || EXIT /B
@ECHO ON
cmake "%SRCDIR%" ^
-G"%GENERATOR%" ^
-DBISON_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_bison.exe ^
-DBOOST_ROOT="%BOOST_ROOT%" ^
-DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ^
-DCMAKE_BUILD_TYPE="%CONFIGURATION%" ^
-DCMAKE_INSTALL_PREFIX="%INSTDIR%" ^
-DFLEX_EXECUTABLE=C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_flex.exe ^
-DINTTYPES_ROOT="%WIN3P%\msinttypes" ^
-DLIBEVENT_ROOT="%WIN3P%\libevent-%LIBEVENT_VERSION%-stable" ^
-DOPENSSL_ROOT_DIR="%OPENSSL_ROOT%" ^
-DOPENSSL_USE_STATIC_LIBS=OFF ^
-DZLIB_LIBRARY="%WIN3P%\zlib-inst\lib\zlib%ZLIB_LIB_SUFFIX%.lib" ^
-DZLIB_ROOT="%WIN3P%\zlib-inst" ^
-DWITH_PYTHON=%WITH_PYTHON% ^
-DWITH_%THREADMODEL%THREADS=ON ^
-DWITH_SHARED_LIB=OFF ^
-DWITH_STATIC_LIB=ON || EXIT /B
@ECHO OFF
cmake --build . ^
--config "%CONFIGURATION%" ^
--target INSTALL || EXIT /B

View file

@ -0,0 +1,59 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
::
:: Appveyor install script for MSVC
:: Installs (or builds) third party packages we need
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_install.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
CALL cl_showenv.bat || EXIT /B
MKDIR "%WIN3P%" || EXIT /B
choco feature enable -n allowGlobalConfirmation || EXIT /B
:: Things to install when NOT running in appveyor:
IF "%APPVEYOR_BUILD_ID%" == "" (
cup -y chocolatey || EXIT /B
cinst -y curl || EXIT /B
cinst -y 7zip || EXIT /B
cinst -y python3 || EXIT /B
cinst -y openssl.light || EXIT /B
)
cinst -y jdk8 || EXIT /B
cinst -y winflexbison3 || EXIT /B
:: zlib - not available through chocolatey
CD "%APPVEYOR_SCRIPTS%" || EXIT /B
call build-zlib.bat || EXIT /B
:: libevent - not available through chocolatey
CD "%APPVEYOR_SCRIPTS%" || EXIT /B
call build-libevent.bat || EXIT /B
:: python packages (correct path to pip set in cl_setenv.bat)
pip.exe ^
install backports.ssl_match_hostname ^
ipaddress ^
six ^
tornado ^
twisted || EXIT /B
cinst -y ghc || EXIT /B

View file

@ -0,0 +1,32 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
@ECHO ON
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_test.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
CD "%BUILDDIR%" || EXIT /B
DIR C:\libraries
DIR C:\libraries\boost_1_59_0
DIR C:\libraries\boost_1_60_0
DIR C:\libraries\boost_1_62_0
DIR C:\libraries\boost_1_63_0
DIR C:\libraries\boost_1_64_0
:: Add directories to the path to find DLLs of third party libraries so tests run properly!
SET PATH=%BOOST_LIBRARYDIR:/=\%;%OPENSSL_ROOT%\bin;%WIN3P%\zlib-inst\bin;%PATH%
ctest -C %CONFIGURATION% --timeout 300 -VV -E "(%DISABLED_TESTS%)" || EXIT /B

View file

@ -0,0 +1,48 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_build.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
SET BASH=C:\msys64\usr\bin\bash
SET CMAKE=/c/msys64/mingw64/bin/cmake.exe
@ECHO ON
SET CMAKEARGS=-G\"%GENERATOR%\" ^
-DBoost_DEBUG=ON ^
-DBoost_NAMESPACE=libboost ^
-DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% ^
-DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% ^
-DCMAKE_BUILD_TYPE=%CONFIGURATION% ^
-DCMAKE_C_COMPILER=gcc.exe ^
-DCMAKE_CXX_COMPILER=g++.exe ^
-DCMAKE_MAKE_PROGRAM=make.exe ^
-DCMAKE_INSTALL_PREFIX=%INSTDIR_MSYS% ^
-DLIBEVENT_ROOT=%LIBEVENT_ROOT% ^
-DOPENSSL_LIBRARIES=%OPENSSL_LIBRARIES% ^
-DOPENSSL_ROOT_DIR=%OPENSSL_ROOT% ^
-DOPENSSL_USE_STATIC_LIBS=ON ^
-DWITH_BOOST_STATIC=ON ^
-DWITH_JAVA=OFF ^
-DWITH_LIBEVENT=ON ^
-DWITH_PYTHON=%WITH_PYTHON% ^
-DWITH_SHARED_LIB=OFF ^
-DWITH_STATIC_LIB=ON
%BASH% -lc "mkdir %BUILDDIR_MSYS% && cd %BUILDDIR_MSYS% && %CMAKE% %SRCDIR_MSYS% %CMAKEARGS% && %CMAKE% --build . --config %CONFIGURATION% --target install" || EXIT /B
@ECHO OFF

View file

@ -0,0 +1,48 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
::
:: Appveyor install script for MSYS
:: Installs (or builds) third party packages we need
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_install.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
CALL cl_showenv.bat || EXIT /B
:: We're going to keep boost at a version cmake understands
SET BOOSTPKG=mingw-w64-x86_64-boost-1.64.0-3-any.pkg.tar.xz
SET IGNORE=--ignore mingw-w64-x86_64-boost
SET PACKAGES=^
--needed -S bison flex make ^
mingw-w64-x86_64-cmake ^
mingw-w64-x86_64-libevent ^
mingw-w64-x86_64-openssl ^
mingw-w64-x86_64-toolchain ^
mingw-w64-x86_64-zlib
%BASH% -lc "pacman --noconfirm -Syu %IGNORE%" || EXIT /B
%BASH% -lc "pacman --noconfirm -Su %IGNORE%" || EXIT /B
%BASH% -lc "pacman --noconfirm %PACKAGES%" || EXIT /B
:: Install a slightly older boost (1.64.0) as cmake 3.10
:: does not have built-in dependencies for boost 1.66.0 yet
:: -- this cuts down on build warning output --
%BASH% -lc "wget http://repo.msys2.org/mingw/x86_64/%BOOSTPKG% && pacman --noconfirm --needed -U %BOOSTPKG% && rm %BOOSTPKG%" || EXIT /B

View file

@ -0,0 +1,26 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
CD build\appveyor || EXIT /B
CALL cl_banner_test.bat || EXIT /B
CALL cl_setenv.bat || EXIT /B
CD "%BUILDDIR%" || EXIT /B
:: randomly fails on mingw; see Jira THRIFT-4106
SET DISABLED_TESTS=concurrency_test
%BASH% -lc "cd %BUILDDIR_MSYS% && ctest.exe -C %CONFIGURATION% --timeout 300 -VV -E '(%DISABLED_TESTS%)'" || EXIT /B

View file

@ -0,0 +1,34 @@
<!---
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
# Appveyor Build
Appveyor is capable of building MSVC 2010 through 2015 as well as
having the latest MSYS2/MinGW 64-bit environment. It has many versions
of boost and python installed as well. See what appveyor has
[installed on build workers](https://www.appveyor.com/docs/installed-software/).
We run a matrix build on Appveyor and build the following combinations:
* MinGW x64 (gcc 6.3.0)
* MSVC 2010 x86, an older boost, an older python
* MSVC 2015 x86/x64, the latest boost, the latest python
* MSYS2 x64 (gcc 6.3.0) - this is a work in progress
The Appveyor script takes the first four letters from the PROFILE specified in
the environment stanza and runs these scripts in order:
????-appveyor-install.bat will install third party libraries and set up the environment
????-appveyor-build.bat will build with cmake
????-appveyor-test.bat will run ctest

View file

@ -0,0 +1,37 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
SETLOCAL EnableDelayedExpansion
SET URLFILE=libevent-%LIBEVENT_VERSION%-stable.tar.gz
SET URL=https://github.com/libevent/libevent/releases/download/release-%LIBEVENT_VERSION%-stable/%URLFILE%
:: Download - support running a local build or a build in appveyor
CD "%WIN3P%" || EXIT /B
IF "%APPVEYOR_BUILD_ID%" == "" (
curl -L -f -o "%URLFILE%" "%URL%"
) ELSE (
appveyor DownloadFile "%URL%"
)
7z x "%URLFILE%" -so | 7z x -si -ttar > nul || EXIT /B
CD "libevent-%LIBEVENT_VERSION%-stable" || EXIT /B
nmake -f Makefile.nmake static_libs || EXIT /B
:: in libevent 2.0 there is no nmake subdirectory in WIN32-Code, but in 2.1 there is
mkdir lib || EXIT /B
move *.lib lib\ || EXIT /B
move WIN32-Code\event2\* include\event2\ || move WIN32-Code\nmake\event2\* include\event2\ || EXIT /B
move *.h include\ || EXIT /B
ENDLOCAL

View file

@ -0,0 +1,56 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
SETLOCAL EnableDelayedExpansion
SET PACKAGE=zlib-%ZLIB_VERSION%
SET BUILDDIR=%WIN3P%\zlib-build
SET INSTDIR=%WIN3P%\zlib-inst
SET SRCDIR=%WIN3P%\%PACKAGE%
SET URLFILE=%PACKAGE%.tar.gz
:: This allows us to tolerate when the current version is archived
SET URL=http://zlib.net/%URLFILE%
SET FURL=http://zlib.net/fossils/%URLFILE%
:: Download - support running a local build or a build in appveyor
CD "%WIN3P%" || EXIT /B
IF "%APPVEYOR_BUILD_ID%" == "" (
curl -L -f -o "%URLFILE%" "%URL%"
IF ERRORLEVEL 1 (
curl -L -f -o "%URLFILE%" "%FURL%"
)
) ELSE (
appveyor DownloadFile "%URL%"
IF ERRORLEVEL 1 (
appveyor DownloadFile "%FURL%" || EXIT /B
)
)
7z x "%URLFILE%" -so | 7z x -si -ttar > nul || EXIT /B
:: Generate
MKDIR "%BUILDDIR%" || EXIT /B
CD "%BUILDDIR%" || EXIT /B
cmake "%SRCDIR%" ^
-G"NMake Makefiles" ^
-DCMAKE_INSTALL_PREFIX="%INSTDIR%" ^
-DCMAKE_BUILD_TYPE="%CONFIGURATION%" || EXIT /B
:: Build
nmake /fMakefile install || EXIT /B
IF "%CONFIGURATION%" == "Debug" (
COPY "%BUILDDIR%\zlibd.pdb" "%INSTDIR%\bin\" || EXIT /B
)
ENDLOCAL

View file

@ -0,0 +1,24 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
:: A visual indicator in a large log helps you locate things when scanning
:: http://www.patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Apache%20Thrift
ECHO/
ECHO ___ __ ________ _ _____
ECHO / _ | ___ ___ _____/ / ___ /_ __/ / ____(_) _/ /_
ECHO / __ |/ _ \/ _ `/ __/ _ \/ -_) / / / _ \/ __/ / _/ __/
ECHO /_/ |_/ .__/\_,_/\__/_//_/\__/ /_/ /_//_/_/ /_/_/ \__/
ECHO /_/
ECHO/

View file

@ -0,0 +1,23 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
:: A visual indicator in a large log helps you locate things when scanning
:: http://www.patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Build
ECHO/
ECHO ___ _ __ __
ECHO / _ )__ __(_) /__/ /
ECHO / _ / // / / / _ / @@@ BUILD
ECHO /____/\_,_/_/_/\_,_/
ECHO/

View file

@ -0,0 +1,23 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
:: A visual indicator in a large log helps you locate things when scanning
:: http://www.patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Install
ECHO/
ECHO ____ __ ____
ECHO / _/__ ___ / /____ _/ / /
ECHO _/ // _ \(_-^</ __/ _ \/ / / @@@ INSTALL
ECHO /___/_//_/___/\__/\_,_/_/_/
ECHO/

View file

@ -0,0 +1,23 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
:: A visual indicator in a large log helps you locate things when scanning
:: http://www.patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Test
ECHO/
ECHO ______ __
ECHO /_ __/__ ___ / /_
ECHO / / / -_^|_-^</ __/ @@@ TEST
ECHO /_/ \__/___/\__/
ECHO/

View file

@ -0,0 +1,63 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
::
:: Detect the compiler edition we're building in.
:: Set the COMPILER environment variable to one of:
:: gcc = MinGW / MSYS2 and gcc toolchain
:: vc100 = Visual Studio 2010
:: vc110 = Visual Studio 2012
:: vc120 = Visual Studio 2013
:: vc140 = Visual Studio 2015
:: vc141 = Visual Studio 2017
::
:: Honors any existing COMPILER environment variable
:: setting instead of overwriting it, to allow it
:: to be forced if needed.
::
:: Sets ERRORLEVEL to 0 if COMPILER can be determined,
:: to 1 if it cannot.
::
IF DEFINED COMPILER (
ECHO [warn ] using existing environment variable COMPILER
EXIT /B 0
)
IF NOT "%PROFILE:~0,4%" == "MSVC" (
SET COMPILER=gcc
) ELSE (
CALL :CHECK 16
IF !ERRORLEVEL! == 0 (SET COMPILER=vc100)
CALL :CHECK 17
IF !ERRORLEVEL! == 0 (SET COMPILER=vc110)
CALL :CHECK 18
IF !ERRORLEVEL! == 0 (SET COMPILER=vc120)
CALL :CHECK 19.0
IF !ERRORLEVEL! == 0 (SET COMPILER=vc140)
CALL :CHECK 19.1
IF !ERRORLEVEL! == 0 (SET COMPILER=vc141)
)
IF NOT DEFINED COMPILER (
ECHO [error] unable to determine the compiler edition
EXIT /B 1
)
ECHO [info ] detected compiler edition %COMPILER%
EXIT /B 0
:CHECK
cl /? 2>&1 | findstr /C:"Version %1%" > nul
EXIT /B

View file

@ -0,0 +1,128 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
@ECHO OFF
IF "%PROFILE%" == "MSVC2010" (
CALL "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2012" (
CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2013" (
CALL "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2015" (
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %PLATFORM%
) ELSE IF "%PROFILE%" == "MSVC2017" (
CALL :SETUPNEWERMSVC || EXIT /B
) ELSE IF "%PROFILE%" == "MINGW" (
REM Supported, nothing special to do here.
) ELSE IF "%PROFILE%" == "CYGWIN" (
REM Supported, nothing special to do here.
) ELSE (
ECHO Unsupported PROFILE=%PROFILE% or PLATFORM=%PLATFORM%
EXIT /B 1
)
CALL cl_setcompiler.bat || EXIT /B
CALL cl_setgenerator.bat || EXIT /B
SET APPVEYOR_SCRIPTS=%APPVEYOR_BUILD_FOLDER%\build\appveyor
SET BUILDDIR=%APPVEYOR_BUILD_FOLDER%\..\build\%PROFILE%\%PLATFORM%
SET INSTDIR=%APPVEYOR_BUILD_FOLDER%\..\build\%PROFILE%\%PLATFORM%
SET SRCDIR=%APPVEYOR_BUILD_FOLDER%
:: PLATFORM is x64 or x86
:: NORM_PLATFORM is 64 or 32
SET NORM_PLATFORM=%PLATFORM:~-2,2%
IF "%NORM_PLATFORM%" == "86" (SET NORM_PLATFORM=32)
IF "%PROFILE:~0,4%" == "MSVC" (
:: FindBoost needs forward slashes so cmake doesn't see something as an escaped character
SET BOOST_ROOT=C:/Libraries/boost_%BOOST_VERSION:.=_%
SET BOOST_LIBRARYDIR=!BOOST_ROOT!/lib%NORM_PLATFORM%-msvc-%COMPILER:~-3,2%.%COMPILER:~-1,1%
SET OPENSSL_ROOT=C:\OpenSSL-Win%NORM_PLATFORM%
SET WIN3P=%APPVEYOR_BUILD_FOLDER%\thirdparty
:: MSVC2010 doesn't "do" std::thread
IF "%COMPILER%" == "vc100" (
SET THREADMODEL=BOOST
) ELSE (
SET THREADMODEL=STD
)
IF "%PYTHON_VERSION%" == "" (
SET WITH_PYTHON=OFF
) ELSE (
SET WITH_PYTHON=ON
IF /i "%PLATFORM%" == "x64" SET PTEXT=-x64
SET PATH=C:\Python%PYTHON_VERSION:.=%!PTEXT!\scripts;C:\Python%PYTHON_VERSION:.=%!PTEXT!;!PATH!
)
IF "%CONFIGURATION%" == "Debug" (SET ZLIB_LIB_SUFFIX=d)
IF NOT "%QT_VERSION%" == "" (
IF /i "%PLATFORM%" == "x64" SET QTEXT=_64
SET PATH=C:\Qt\%QT_VERSION%\%PROFILE%!QTEXT!\bin;!PATH!
)
) ELSE IF "%PROFILE:~0,4%" == "MING" (
:: PLATFORM = x86 means MINGWPLAT i686
:: PLATFORM = x64 means MINGWPLAT x86_64
SET MINGWPLAT=x86_64
IF "%PLATFORM%" == "x86" (SET MINGWPLAT=i686)
SET BASH=C:\msys64\usr\bin\bash.exe
!BASH! -lc "sed -i '/export PATH=\/mingw32\/bin/d' ~/.bash_profile && sed -i '/export PATH=\/mingw64\/bin/d' ~/.bash_profile && echo 'export PATH=/mingw%NORM_PLATFORM%/bin:$PATH' >> ~/.bash_profile" || EXIT /B
SET BUILDDIR=%BUILDDIR:\=/%
SET BUILDDIR=/c!BUILDDIR:~2!
SET INSTDIR=%INSTDIR:\=/%
SET INSTDIR=/c!INSTDIR:~2!
SET SRCDIR=%SRCDIR:\=/%
SET SRCDIR=/c!SRCDIR:~2!
) ELSE IF "%PROFILE:~0,4%" == "CYGW" (
SET CYGWINROOT=C:\cygwin
IF "%PLATFORM%" == "x64" (SET CYGWINROOT=!CYGWINROOT!64)
SET BASH=!CYGWINROOT!\bin\bash.exe
SET SETUP=!CYGWINROOT!\setup-x86
IF "%PLATFORM%" == "x64" (SET SETUP=!SETUP!_64)
SET SETUP=!SETUP!.exe
SET BUILDDIR=%BUILDDIR:\=/%
SET BUILDDIR=/cygdrive/c!BUILDDIR:~2!
SET INSTDIR=%INSTDIR:\=/%
SET INSTDIR_CYG=/cygdrive/c!INSTDIR:~2!
SET SRCDIR=%SRCDIR:\=/%
SET SRCDIR=/cygdrive/c!SRCDIR:~2!
)
GOTO :EOF
:SETUPNEWERMSVC
FOR /F "USEBACKQ TOKENS=*" %%i IN (`call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version "[15.0,16.0)" -property installationPath`) DO (
IF "%MSVCROOT%" == "" (SET MSVCROOT=%%i)
)
SET MSVCPLAT=x86
IF "%PLATFORM%" == "x64" (SET MSVCPLAT=amd64)
SET CURRENTDIR=%CD%
CALL "!MSVCROOT!\Common7\Tools\VsDevCmd.bat" -arch=!MSVCPLAT! || EXIT /B
CD %CURRENTDIR%
EXIT /B
:EOF

View file

@ -0,0 +1,79 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
::
:: Detect the compiler edition we're building in and then
:: set the GENERATOR environment variable to one of:
::
:: Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
:: Optional [arch] can be "Win64" or "ARM".
:: Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
:: Optional [arch] can be "Win64" or "ARM".
:: Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
:: Optional [arch] can be "Win64" or "ARM".
:: Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
:: Optional [arch] can be "Win64" or "ARM".
:: Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
:: Optional [arch] can be "Win64" or "IA64".
:: MinGW Makefiles = Generates makefiles for MinGW
:: MSYS Makefiles = Generates makefiles for MSYS
:: Unix Makefiles = Generates makefiles for CYGWIN
::
:: Honors any existing GENERATOR environment variable
:: setting instead of overwriting it, to allow it
:: to be forced if needed.
::
:: Sets ERRORLEVEL to 0 if GENERATOR can be determined,
:: to 1 if it cannot.
::
IF DEFINED GENERATOR (
ECHO [warn ] using existing environment variable GENERATOR
EXIT /B 0
)
IF "%PROFILE:~0,4%" == "MING" (
SET GENERATOR=MinGW Makefiles
) ELSE IF "%PROFILE:~0,4%" == "CYGW" (
SET GENERATOR=Unix Makefiles
) ELSE IF "%PROFILE:~0,4%" == "MSYS" (
SET GENERATOR=MSYS Makefiles
) ELSE (
IF /i "%PLATFORM%" == "x64" SET GENARCH= Win64
CALL :CHECK 16
IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 10 2010!GENARCH!
CALL :CHECK 17
IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 11 2012!GENARCH!
CALL :CHECK 18
IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 12 2013!GENARCH!
CALL :CHECK 19.0
IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 14 2015!GENARCH!
CALL :CHECK 19.1
IF !ERRORLEVEL! == 0 SET GENERATOR=Visual Studio 15 2017!GENARCH!
)
IF NOT DEFINED GENERATOR (
ECHO [error] unable to determine the CMake generator to use
EXIT /B 1
)
ECHO [info ] using CMake generator %GENERATOR%
EXIT /B 0
:CHECK
cl /? 2>&1 | findstr /C:"Version %1%" > nul
EXIT /B

View file

@ -0,0 +1,63 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
ECHO/
ECHO ===============================================================================
IF "%PROFILE:~0,4%" == "MSVC" (
ECHO Versions
ECHO -------------------------------------------------------------------------------
ECHO boost = %BOOST_VERSION%
ECHO libevent = %LIBEVENT_VERSION%
ECHO python = %PYTHON_VERSION%
ECHO qt = %QT_VERSION%
ECHO zlib = %ZLIB_VERSION%
ECHO/
)
ECHO Appveyor Variables
ECHO -------------------------------------------------------------------------------
ECHO APPVEYOR_BUILD_FOLDER = %APPVEYOR_BUILD_FOLDER%
ECHO CONFIGURATION = %CONFIGURATION%
ECHO PLATFORM = %PLATFORM%
ECHO PROFILE = %PROFILE%
ECHO/
ECHO Our Variables
ECHO -------------------------------------------------------------------------------
ECHO APPVEYOR_SCRIPTS = %APPVEYOR_SCRIPTS%
ECHO BASH = %BASH%
ECHO BOOST_ROOT = %BOOST_ROOT%
ECHO BOOST_INCLUDEDIR = %BOOST_INCLUDEDIR%
ECHO BOOST_LIBRARYDIR = %BOOST_LIBRARYDIR%
ECHO BUILDDIR = %BUILDDIR%
ECHO COMPILER = %COMPILER%
ECHO GENERATOR = %GENERATOR%
ECHO INSTDIR = %INSTDIR%
ECHO JAVA_HOME = %JAVA_HOME%
ECHO OPENSSL_ROOT = %OPENSSL_ROOT%
ECHO SETUP = %SETUP%
ECHO SRCDIR = %SRCDIR%
ECHO WIN3P = %WIN3P%
ECHO WITH_PYTHON = %WITH_PYTHON%
ECHO ZLIB_STATIC_SUFFIX = %ZLIB_STATIC_SUFFIX%
IF NOT "%PROFILE:~0,4%" == "MSVC" (
ECHO/
ECHO UNIXy PATH
ECHO -------------------------------------------------------------------------------
%BASH% -lc "echo $PATH"
)
ECHO/
ECHO Windows PATH
ECHO -------------------------------------------------------------------------------
ECHO %PATH%
ECHO ===============================================================================
ECHO/

View file

@ -1,41 +0,0 @@
import urllib.request
import sys
OUT = 'Win64OpenSSL.exe'
URL_STR = 'https://slproweb.com/download/Win64OpenSSL-%s.exe'
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_PATCH = 2
VERSION_SUFFIX = 'j'
VERSION_STR = '%d_%d_%d%s'
TRY_COUNT = 4
def main():
for patch in range(VERSION_PATCH, TRY_COUNT):
for suffix in range(TRY_COUNT):
if patch == VERSION_PATCH:
s = VERSION_SUFFIX
else:
s = 'a'
s = chr(ord(s) + suffix)
ver = VERSION_STR % (VERSION_MAJOR, VERSION_MINOR, patch, s)
url = URL_STR % ver
try:
with urllib.request.urlopen(url) as res:
if res.getcode() == 200:
with open(OUT, 'wb') as out:
out.write(res.read())
print('successfully downloaded from ' + url)
return 0
except urllib.error.HTTPError:
pass
print('failed to download from ' + url, file=sys.stderr)
print('could not download openssl', file=sys.stderr)
return 1
if __name__ == '__main__':
sys.exit(main())

View file

@ -0,0 +1,35 @@
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
::
::
:: Helps build thrift by pretending to be appveyor
:: Usage:
:: cd build\appveyor
:: simulate-appveyor.bat [Debug|Release] [x86|x64] [CYGWIN|MINGW|MSVC201?]
::
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET APPVEYOR_BUILD_FOLDER=%~dp0..\..
SET CONFIGURATION=%1
SET PLATFORM=%2
SET PROFILE=%3
CD %APPVEYOR_BUILD_FOLDER%
CALL build\appveyor\%PROFILE:~0,4%-appveyor-install.bat || EXIT /B
CD %APPVEYOR_BUILD_FOLDER%
CALL build\appveyor\%PROFILE:~0,4%-appveyor-build.bat || EXIT /B
CD %APPVEYOR_BUILD_FOLDER%
CALL build\appveyor\%PROFILE:~0,4%-appveyor-test.bat

View file

@ -17,17 +17,16 @@
# under the License.
#
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckSymbolExists)
# If AI_ADDRCONFIG is not defined we define it as 0
check_symbol_exists(AI_ADDRCONFIG "sys/types.h;sys/socket.h;netdb.h" HAVE_AI_ADDRCONFIG)
if(NOT HAVE_AI_ADDRCONFIG)
set(AI_ADDRCONFIG 1)
endif(NOT HAVE_AI_ADDRCONFIG)
if (Inttypes_FOUND)
# This allows the inttypes.h and stdint.h checks to succeed on platforms that
# do not natively provide there.
set (CMAKE_REQUIRED_INCLUDES ${INTTYPES_INCLUDE_DIRS})
endif ()
check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
check_include_file(fcntl.h HAVE_FCNTL_H)
@ -35,18 +34,22 @@ check_include_file(getopt.h HAVE_GETOPT_H)
check_include_file(inttypes.h HAVE_INTTYPES_H)
check_include_file(netdb.h HAVE_NETDB_H)
check_include_file(netinet/in.h HAVE_NETINET_IN_H)
check_include_file(signal.h HAVE_SIGNAL_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(pthread.h HAVE_PTHREAD_H)
check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H)
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(sys/un.h HAVE_SYS_UN_H)
check_include_file(poll.h HAVE_POLL_H)
check_include_file(sys/poll.h HAVE_SYS_POLL_H)
check_include_file(sys/select.h HAVE_SYS_SELECT_H)
check_include_file(sched.h HAVE_SCHED_H)
check_include_file(string.h HAVE_STRING_H)
check_include_file(strings.h HAVE_STRINGS_H)
check_function_exists(gethostbyname HAVE_GETHOSTBYNAME)
@ -72,5 +75,5 @@ set(VERSION ${thrift_VERSION})
# generate a config.h file
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/thrift/config.h")
# HACK: Some files include thrift/config.h and some config.h so we include both. This should be cleaned up.
include_directories("${CMAKE_CURRENT_BINARY_DIR}/thrift" "${CMAKE_CURRENT_BINARY_DIR}")
include_directories("${CMAKE_CURRENT_BINARY_DIR}")

View file

@ -35,7 +35,7 @@ set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
set(CMAKE_COLOR_MAKEFILE ON)
# Define the generic version of the libraries here
set(GENERIC_LIB_VERSION "0.10.0")
set(GENERIC_LIB_VERSION "0.12.0")
set(GENERIC_LIB_SOVERSION "0")
# Set the default build type to release with debug info
@ -68,3 +68,26 @@ set(CMAKE_MACOSX_RPATH TRUE)
# locations and running the executables without LD_PRELOAD or similar.
# This requires the library to be built with rpath support.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#
# C++ Language Level Defaults - this depends on the compiler capabilities
#
if (NOT DEFINED CMAKE_CXX_STANDARD)
if (MSVC AND MSVC_VERSION LESS 1800)
# MSVC 2012 and earlier don't support template aliases so you have to use C++98
set(CMAKE_CXX_STANDARD 98)
message(STATUS "Setting C++98 as the default language level (for an older MSVC compiler).")
else()
set(CMAKE_CXX_STANDARD 11) # C++11
message(STATUS "Setting C++11 as the default language level.")
endif()
message(STATUS "To specify a different C++ language level, set CMAKE_CXX_STANDARD")
endif()
if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED OFF) # can degrade to C++98 if compiler does not support C++11
endif()
if (NOT DEFINED CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF) # use standards compliant language level for portability
endif()

Some files were not shown because too many files have changed in this diff Show more