Skip to content

Commit

Permalink
Merge branch 'ballerina-platform:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshanSS authored Jun 23, 2021
2 parents 7354194 + fa4287e commit ff6b5ed
Show file tree
Hide file tree
Showing 42 changed files with 965 additions and 311 deletions.
Empty file removed .ballerina/Settings.toml
Empty file.
1 change: 0 additions & 1 deletion .ballerina/ballerina-version

This file was deleted.

1 change: 0 additions & 1 deletion .ballerina/command-notice

This file was deleted.

1 change: 0 additions & 1 deletion .ballerina/installer-version

This file was deleted.

6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Ballerina Build
uses: ballerina-platform/ballerina-action/@master
uses: ballerina-platform/ballerina-action/@nightly
with:
args:
build -c
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
WORKING_DIR: ./gpeople

57 changes: 57 additions & 0 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Daily build

# Controls when the action will run.
on:
schedule:
- cron: '30 2 * * *'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Set up Java Environment
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

# Grant execute permission to the gradlew script
- name: Grant execute permission for gradlew
run: chmod +x gradlew

# Build the project with Gradle
- name: Build with Gradle
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true
run: |
./gradlew build
# Build the ballerina project
- name: Ballerina Build
uses: ballerina-platform/ballerina-action/@nightly
with:
args:
build -c --skip-tests
env:
JAVA_HOME: /usr/lib/jvm/default-jvm
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
WORKING_DIR: ./gpeople
# Publish Github Package
- name: Publish Github Package
env:
publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
publishPAT: ${{ secrets.CONNECTOR_PUBLISH_PAT }}
JAVA_OPTS: -DBALLERINA_DEV_COMPILE_BALLERINA_ORG=true
run: |
./gradlew publish
5 changes: 3 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Ballerina Build
uses: ballerina-platform/ballerina-action/@master
uses: ballerina-platform/ballerina-action/@nightly
with:
args:
build -c
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
WORKING_DIR: ./gpeople
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ jobs:
uses: ballerina-platform/ballerina-action/@master
with:
args:
build --skip-tests
build -c --skip-tests
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
WORKING_DIR: ./gpeople
- name: Ballerina Push
uses: ballerina-platform/ballerina-action/@swan-lake-connector-release
uses: ballerina-platform/ballerina-action/@master
with:
args:
push
Expand Down
43 changes: 10 additions & 33 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
# Compiled class file
*.class
# resources folder
/resources

# Log file
*.log
# idea files
*.idea

# BlueJ files
*.ctxt
# .ballerina files
*.ballerina

# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Ignore Gradle project-specific cache directory
.gradle

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

#Ballerina configuartion file
ballerina.conf

#Target folder of ballerina project
/target

#json files created inside resources folder
/modules

#resource folder in tests folder
/tests/resources

Config.toml
# Ignore Gradle build output directory
build
7 changes: 0 additions & 7 deletions Ballerina.toml

This file was deleted.

20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ The Google People Ballerina Connector allows you to access the Google People API
* Java 11 Installed
Java Development Kit (JDK) with version 11 is required.

* Download the Ballerina [distribution](https://ballerinalang.org/downloads/) SLAlpha4
Ballerina Swan Lake Alpha Version 4 is required.
* Download the Ballerina [distribution](https://ballerinalang.org/downloads/) SLAlpha5
Ballerina Swan Lake Alpha Version 5 is required.

* Instantiate the connector by giving authentication details in the HTTP client config. The HTTP client config has built-in support for BasicAuth and OAuth 2.0. Google People uses OAuth 2.0 to authenticate and authorize requests.
* The Google People connector can be minimally instantiated in the HTTP client config using client ID, client secret, and refresh token.
Expand All @@ -38,7 +38,7 @@ The Google People Ballerina Connector allows you to access the Google People API

| | Versions |
|:---------------------------:|:-------------------------------:|
| Ballerina Language | Swan Lake Alpha 4 |
| Ballerina Language | Swan Lake Alpha 5 |
| Google People API | V1 |


Expand All @@ -62,7 +62,7 @@ This file should have following configurations. Add the tokens obtained in the p

#### For client operations
```
[ballerinax.googleapis_people]
[ballerinax.googleapis.people]
clientId = "<client_id">
clientSecret = "<client_secret>"
refreshToken = "<refresh_token>"
Expand All @@ -73,7 +73,7 @@ refreshUrl = "<refresh_URL>"

### Create a Contact
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -113,7 +113,7 @@ public function main() {
```
### Fetch a Contact
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -164,7 +164,7 @@ public function main() {
```
### Search a Contact using a string value
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -196,7 +196,7 @@ public function main() {

### Delete a Contact
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -248,7 +248,7 @@ public function main() {

### Create a Contact Group
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down Expand Up @@ -279,7 +279,7 @@ public function main() {
```
### Fetch a Contact Group
```ballerina
import ballerinax/googleapis_people as contacts;
import ballerinax/googleapis.people as contacts;
import ballerina/log;
configurable string refreshToken = ?;
Expand Down
96 changes: 96 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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.
*
*/

plugins {
id "com.github.spotbugs" version "4.0.5"
id "com.github.johnrengelman.shadow" version "5.2.0"
id "de.undercouch.download" version "4.0.4"
id "net.researchgate.release" version "2.8.0"
}

ext.ballerinaLangVersion = project.ballerinaLangVersion

allprojects {
group = project.group
version = project.version

apply plugin: 'jacoco'
apply plugin: 'maven-publish'
}

subprojects {
apply plugin: 'java'
}

def artifactCacheParent = file("${project.projectDir}/build/cache_parent/")
def packageName = "googleapis.people"
def packageOrg = "ballerinax"
def pathToBala = file("${project.projectDir}/gpeople/target/bala")
def platform = "java11"

task createBalaDirectory {
mkdir "${project.projectDir}/gpeople/target/bala"
}

task build {
dependsOn('gpeople:build')
}

task copyDistribution {
inputs.dir file(project.projectDir)

pathToBala.eachFileMatch(~/.*.bala/) { balaFile ->
copy {
from zipTree(balaFile)
into file("${artifactCacheParent}/bala/${packageOrg}/${packageName}/${project.version}/${platform}")
}
}
copy {
from file("${project.projectDir}/gpeople/target/cache")
exclude '**/*-testable.jar'
exclude '**/tests_cache/'
into file("${artifactCacheParent}/cache/")
}
outputs.dir artifactCacheParent
}

task createArtifactZip(type: Zip) {
from "${buildDir}/cache_parent"
archiveName 'distribution.zip'
destinationDir(file("${buildDir}/distribution"))
}

publishing {
publications {
mavenJava(MavenPublication) {
artifact source: createArtifactZip, extension: 'zip'
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ballerina-platform/module-ballerinax-googleapis.people")
credentials {
username = System.getenv("publishUser")
password = System.getenv("publishPAT")
}
}
}
}

publish.dependsOn copyDistribution
Loading

0 comments on commit ff6b5ed

Please sign in to comment.