Skip to content

Commit

Permalink
Add java implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
petemoore committed Sep 7, 2018
1 parent 2b2f52d commit bb036c4
Show file tree
Hide file tree
Showing 12 changed files with 973 additions and 38 deletions.
82 changes: 54 additions & 28 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ tasks:
- /bin/bash
- '--login'
- '-cx'
- >-
git clone {{event.head.repo.url}} repo &&
cd repo &&
git config advice.detachedHead false &&
git checkout {{event.head.sha}} &&
export DEBUG=* DOCS_PROJECT=taskcluster-lib-urls DOCS_TIER=libraries DOCS_FOLDER=docs DOCS_README=README.md &&
- |
git clone {{event.head.repo.url}} repo
cd repo
git config advice.detachedHead false
git checkout {{event.head.sha}}
export DEBUG=* DOCS_PROJECT=taskcluster-lib-urls DOCS_TIER=libraries DOCS_FOLDER=docs DOCS_README=README.md
upload-project-docs
metadata:
name: "taskcluster-lib-urls docs upload"
Expand All @@ -75,22 +75,48 @@ tasks:
command:
- /bin/bash
- '-c'
- >-
mkdir -p /go/src/github.com/taskcluster/taskcluster-lib-urls &&
cd /go/src/github.com/taskcluster/taskcluster-lib-urls &&
git clone {{event.head.repo.url}} . &&
git config advice.detachedHead false &&
git checkout {{event.head.sha}} &&
go get -v -d -t ./... &&
go test -v -race ./... &&
go get -u github.com/alecthomas/gometalinter &&
gometalinter --install &&
- |
mkdir -p /go/src/github.com/taskcluster/taskcluster-lib-urls
cd /go/src/github.com/taskcluster/taskcluster-lib-urls
git clone {{event.head.repo.url}} .
git config advice.detachedHead false
git checkout {{event.head.sha}}
go get -v -d -t ./...
go test -v -race ./...
go get -u github.com/alecthomas/gometalinter
gometalinter --install
gometalinter
metadata:
name: "taskcluster-lib-urls go test"
description: Run library test suite - golang 1.10
owner: '{{ event.head.user.email }}'
source: '{{ event.head.repo.url }}'
- provisionerId: '{{ taskcluster.docker.provisionerId }}'
workerType: '{{ taskcluster.docker.workerType }}'
extra:
github:
events:
- pull_request.opened
- pull_request.synchronize
- pull_request.reopened
- push
payload:
maxRunTime: 3600
image: 'maven'
command:
- /bin/bash
- '-c'
- |
git clone {{event.head.repo.url}} repo
cd repo
git config advice.detachedHead false
git checkout {{event.head.sha}}
mvn install
metadata:
name: taskcluster-lib-urls java test
description: Run library test suite - java
owner: '{{ event.head.user.email }}'
source: '{{ event.head.repo.url }}'
- provisionerId: '{{ taskcluster.docker.provisionerId }}'
workerType: '{{ taskcluster.docker.workerType }}'
extra:
Expand All @@ -106,12 +132,12 @@ tasks:
command:
- /bin/bash
- '-c'
- >-
git clone {{event.head.repo.url}} repo &&
cd repo &&
git config advice.detachedHead false &&
git checkout {{event.head.sha}} &&
pip install tox &&
- |
git clone {{event.head.repo.url}} repo
cd repo
git config advice.detachedHead false
git checkout {{event.head.sha}}
pip install tox
tox -e py27
metadata:
name: "taskcluster-lib-urls python 2.7 test"
Expand All @@ -133,12 +159,12 @@ tasks:
command:
- /bin/bash
- '-c'
- >-
git clone {{event.head.repo.url}} repo &&
cd repo &&
git config advice.detachedHead false &&
git checkout {{event.head.sha}} &&
pip install tox &&
- |
git clone {{event.head.repo.url}} repo
cd repo
git config advice.detachedHead false
git checkout {{event.head.sha}}
pip install tox
tox -e py36
metadata:
name: taskcluster-lib-urls python 3.6 test
Expand Down
103 changes: 93 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Taskcluster URL Building Library

[![Build Status](https://travis-ci.org/taskcluster/taskcluster-lib-urls.svg?branch=master)](https://travis-ci.org/taskcluster/taskcluster-lib-urls)
[![npm](https://img.shields.io/npm/v/taskcluster-lib-urls.svg?maxAge=2592000)](https://www.npmjs.com/package/taskcluster-lib-urls)
[![License](https://img.shields.io/badge/license-MPL%202.0-orange.svg)](http://mozilla.org/MPL/2.0)

A simple library to generate URLs for various Taskcluster resources across our various deployment methods.
Expand All @@ -21,7 +19,9 @@ Requirements
This is tested on and should run on any of Node.js `{8, 10}`.

JS Usage
-----
--------
[![Node.js Build Status](https://travis-ci.org/taskcluster/taskcluster-lib-urls.svg?branch=master)](https://travis-ci.org/taskcluster/taskcluster-lib-urls)
[![npm](https://img.shields.io/npm/v/taskcluster-lib-urls.svg?maxAge=2592000)](https://www.npmjs.com/package/taskcluster-lib-urls)

This package exports several methods for generating URLs conditionally based on
a root URL, as well as a few helper classes for generating URLs for a pre-determined
Expand Down Expand Up @@ -81,9 +81,19 @@ If you would like, you can set this up via [taskcluster-lib-loader](https://gith
}
```

Test with:

```
yarn install
yarn test
```


Go Usage
--------

[![GoDoc](https://godoc.org/github.com/taskcluster/taskcluster-lib-urls?status.svg)](https://godoc.org/github.com/taskcluster/taskcluster-lib-urls)

The go package exports the following functions:

```go
Expand All @@ -96,8 +106,20 @@ func UI(rootURL string, path string) string
func ServicesManifest(rootURL string) string
```

Install with:

```
go install ./..
```

Test with:

```
go test -v ./...
```

Python Usage
--------
------------

You can install the python client with `pip install taskcluster-urls`;

Expand All @@ -113,17 +135,78 @@ taskcluster_urls.servicesManifest(root_url)
taskcluster_urls.docs(root_url, 'foo/bar')
```

Testing
-------
Test with:

```
tox
```

`yarn install` and `yarn test`.
Java Usage
----------

Hacking
-------
[![JavaDoc](https://img.shields.io/badge/javadoc-reference-blue.svg)](http://taskcluster.github.io/taskcluster-lib-urls/apidocs)

In order to use this library from your maven project, simply include it as a project dependency:

New releases should be tested on Travis to allow for all supported versions of Node to be tested. Once satisfied that it works, new versions should be created with
```
<project>
...
<dependencies>
...
<dependency>
<groupId>org.mozilla.taskcluster</groupId>
<artifactId>taskcluster-lib-urls</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>
```

The taskcluster-lib-urls artifacts are now available from the [maven central repository](http://central.sonatype.org/):

* [Search Results](http://search.maven.org/#search|gav|1|g%3A%22org.mozilla.taskcluster%22%20AND%20a%3A%22taskcluster-lib-urls%22)
* [Directory Listing](https://repo1.maven.org/maven2/org/mozilla/taskcluster/taskcluster-lib-urls/)

To use the library, do as follows:

```java
import org.mozilla.taskcluster.urls.*;

...

URLProvider urlProvider = URLs.provider("https://mytaskcluster.acme.org");

String fooBarAPI = urlProvider.api("auth", "v1", "foo/bar");
String fooSchema = urlProvider.schema("auth", "v1/foo.yml"); // Note that schema names have versions in them
String authAPIRef = urlProvider.apiReference("auth", "v1");
String authExchangesRef = urlProvider.exchangeReference("auth", "v1");
String uiFooBar = urlProvider.ui("foo/bar");
String servicesManifest = urlProvider.servicesManifest();
String docsFooBar = urlProvider.docs("foo/bar");

...
```

Install with:

```
mvn install
```

Test with:

```
mvn test
```


Releasing
---------

New releases should be tested on Travis and Taskcluster to allow for all supported versions of Node to be tested. Once satisfied that it works, new versions should be created with
`yarn version` rather than by manually editing `package.json` and tags should be pushed to Github. Make sure to update [the changelog](https://github.com/taskcluster/taskcluster-lib-urls/releases)!


License
-------

Expand Down
Loading

0 comments on commit bb036c4

Please sign in to comment.