Skip to content

Commit

Permalink
Merge branch 'main' into workflow/update-protos
Browse files Browse the repository at this point in the history
  • Loading branch information
njooma authored May 16, 2024
2 parents cc387b7 + cee5f27 commit 512e040
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 45 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Build + Sign
run: ./gradlew signMavenPublication
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Publish package
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}

- name: Publish plugin
run: ./gradlew publishPlugins
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }}
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,15 @@ See examples for more information:
* JDK 21+ (source is Java 11 compatible) (be sure to set `JAVA_HOME`)
* Run `make setup buf`

## Pure Java SDK

### Server
## Examples

* `make run_server`
Examples can be found in the various example directories:
* [Java Examples](./java/examples/src/main/java/com/viam/sdk/java/examples)
* [Android Examples](./android/examples)
* [Standalone Examples](./standalone-examples)

### Client

* `make run_client`

## Publishing to mavenLocal

Run `./gradlew install`.
Two pure Java examples are ready to run out of the box to help get you started. You can run them with the commands `make run_server` to start a gRPC server, and then `make run_client` to run the example client against that server.

## Known Issues

Expand Down
11 changes: 11 additions & 0 deletions android/module-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
plugins {
id 'groovy-gradle-plugin'
id "com.gradle.plugin-publish" version "1.2.1"
id 'signing'
}

gradlePlugin {
website = 'https://github.com/viamrobotics/viam-java-sdk'
vcsUrl = 'https://github.com/viamrobotics/viam-java-sdk'
plugins {
androidModulePlugin {
id = 'com.viam.sdk.android.module'
displayName = 'Plugin for Viam Modules'
description = 'A plugin that enables Viam Modules on Android devices'
tags.addAll('viam', 'robotics', 'smart machine')
implementationClass = 'com.viam.sdk.android.module.AndroidModulePlugin'
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
}
}
}
}
Expand Down
50 changes: 22 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group 'com.viam'
version '0.0.1-SNAPSHOT'
version '0.0.2'

repositories {
google()
Expand Down Expand Up @@ -69,6 +69,9 @@ subprojects {
return
}

if (project.plugins.hasPlugin("groovy-gradle-plugin")) {
return
}

def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
Expand Down Expand Up @@ -104,28 +107,16 @@ subprojects {

publishing {
publications {
if (project.plugins.hasPlugin("groovy-gradle-plugin")) {
pluginMaven(MavenPublication) {
pom.withXml {
def root = asNode()
def displayName = project.properties.get("pomDisplayName", project.name)
root.appendNode('name', "Viam Java/Android SDK - $displayName")
root.appendNode('description', "Viam Java/Android SDK - $displayName")
root.children().last() + pomConfig
}
}
} else {
maven(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom.withXml {
def root = asNode()
def displayName = project.properties.get("pomDisplayName", project.name)
root.appendNode('name', "Viam Java/Android SDK - $displayName")
root.appendNode('description', "Viam Java/Android SDK - $displayName")
root.children().last() + pomConfig
}
maven(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom.withXml {
def root = asNode()
def displayName = project.properties.get("pomDisplayName", project.name)
root.appendNode('name', "Viam Java/Android SDK - $displayName")
root.appendNode('description', "Viam Java/Android SDK - $displayName")
root.children().last() + pomConfig
}
}
}
Expand All @@ -148,11 +139,7 @@ subprojects {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
if (project.plugins.hasPlugin("groovy-gradle-plugin")) {
sign publishing.publications.pluginMaven
} else {
sign publishing.publications.maven
}
sign publishing.publications.maven
}
}
if (project.plugins.hasPlugin("com.android.library")) {
Expand All @@ -162,6 +149,13 @@ subprojects {
groupId = groupId
artifactId = project.name
version = version
pom.withXml {
def root = asNode()
def displayName = project.properties.get("pomDisplayName", project.name)
root.appendNode('name', "Viam Java/Android SDK - $displayName")
root.appendNode('description', "Viam Java/Android SDK - $displayName")
root.children().last() + pomConfig
}

afterEvaluate {
from components.default
Expand Down
2 changes: 1 addition & 1 deletion core/sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {
api 'io.grpc:grpc-protobuf-lite:1.63.0'
api 'io.grpc:grpc-stub:1.63.0'
implementation 'org.json:json:20240205'
implementation 'com.google.protobuf:protobuf-javalite:4.27.0-RC1'
implementation 'com.google.protobuf:protobuf-javalite:4.27.0-RC3'
api 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
implementation 'commons-io:commons-io:2.15.1'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
Expand Down
2 changes: 1 addition & 1 deletion java/sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ java {
downloadLicenses {
includeProjectDependencies = true
dependencyConfiguration = 'runtimeClasspath'
}
}

0 comments on commit 512e040

Please sign in to comment.