Skip to content

Commit

Permalink
Merge pull request #78 from microsoftgraph/feature/v3
Browse files Browse the repository at this point in the history
- aligns beta sdk with v3 work
  • Loading branch information
baywet committed Mar 15, 2021
2 parents 871dd42 + 986f884 commit 60dcbc4
Show file tree
Hide file tree
Showing 31,861 changed files with 1,286,793 additions and 2,120,219 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
34 changes: 34 additions & 0 deletions .github/workflows/api-level-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Checks the SDK only using APIs from the targeted API level"

on:
push:
branches:
- dev
pull_request:
branches:
- dev
- feature/v3

jobs:
lint-api-level:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 15
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Add execution right to the script
run: chmod +x gradlew
working-directory: ./android
- name: Build SDK with Android project configuration
id: lint
run: ./gradlew --no-daemon build
working-directory: ./android
- name: Upload linting results
if: failure() && steps.lint.outcome == 'failure'
uses: actions/upload-artifact@v2
with:
name: lint-report
path: ./android/build/reports
7 changes: 5 additions & 2 deletions .github/workflows/type-summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ jobs:
with:
java-version: 15
- name: Add execution right to the script
run: chmod +x gradlew
working-directory: ./typesummary
run: |
chmod +x ./typesummary/gradlew
chmod +x ./gradlew
- name: Build SDK
run: ./gradlew --no-daemon build
- name: Build and run type summary project
run: ./gradlew --no-daemon run --args='-o ${{ github.workspace }}/typeSummary.txt'
working-directory: ./typesummary
Expand Down
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repositories {
dependencies {
// Include the sdk as a dependency
implementation 'com.microsoft.graph:microsoft-graph-beta:0.6.0-SNAPSHOT'
implementation 'com.microsoft.graph:microsoft-graph-beta:0.7.0-SNAPSHOT'
}
```

Expand All @@ -31,7 +31,7 @@ Add the dependency in `dependencies` in pom.xml
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph-beta</artifactId>
<version>0.6.0-SNAPSHOT</version>
<version>0.7.0-SNAPSHOT</version>
</dependency>
```

Expand Down Expand Up @@ -61,14 +61,14 @@ Register your application by following the steps at [Register your app with the

An instance of the **GraphServiceClient** class handles building requests, sending them to the Microsoft Graph API, and processing the responses. To create a new instance of this class, you need to provide an instance of `IAuthenticationProvider`, which can authenticate requests to Microsoft Graph.

For an example of authentication in a Java desktop client application, see the [Preview msgraph-sdk-java-auth](https://github.com/microsoftgraph/msgraph-sdk-android-msa-auth-for-android-adapter) and for an Android application see [Preview msgraph-sdk-android-auth](https://github.com/microsoftgraph/msgraph-sdk-android-auth).
For an example of how to get an authentication provider, see [choose a Microsoft Graph authentication provider](https://docs.microsoft.com/graph/sdks/choose-authentication-providers?tabs=Java).

### 2.3 Get a GraphServiceClient object

After you have set the correct application ID and URL, you must get a **GraphServiceClient** object to make requests against the service. The SDK stores the account information for you, but when a user signs in for the first time, it invokes the UI to get the user's account information.

```java
IGraphServiceClient graphClient =
GraphServiceClient graphClient =
GraphServiceClient
.builder()
.authenticationProvider(authenticationProvider)
Expand All @@ -83,23 +83,28 @@ After you have a GraphServiceClient that is authenticated, you can begin making

To retrieve the user's drive:

```java
final Drive result = graphClient
.me()
.drive()
.buildRequest()
.get();
System.out.println("Found Drive " + result.id);
```

Or with the asynchronous API.

```java
graphClient
.me()
.drive()
.buildRequest()
.get(new ICallback<Drive>() {
@Override
public void success(final Drive result) {
System.out.println("Found Drive " + result.id);
}
...
// Handle failure case
.futureGet()
.thenApply(result -> {
System.out.println("Found Drive " + result.id);
});
```

For a general overview of how the SDK is designed, see [overview](https://github.com/microsoftgraph/msgraph-sdk-java/wiki/Overview).

## 4. Documentation

For more detailed documentation, see:
Expand All @@ -120,7 +125,9 @@ The Microsoft Graph SDK is open for contribution. To contribute to this project,

## 7. Supported Java versions

The Microsoft Graph beta SDK for Java library is supported at runtime for Java 8+ and [Android API revision 15](http://source.android.com/source/build-numbers.html) and greater through [desugaring](https://developer.android.com/studio/write/java8-support.html#library-desugaring).
The Microsoft Graph beta SDK for Java library is supported at runtime for Java 8+ and [Android API revision 26](http://source.android.com/source/build-numbers.html) and greater.

Android developers targeting lower android API levels can do so by [enabling desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) in their project.

## 8. License

Expand All @@ -129,7 +136,3 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the [MI
## 9. Third-party notices

[Third-party notices](THIRD%20PARTY%20NOTICES)




2 changes: 1 addition & 1 deletion Scripts/incrementMinorVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function Update-MinorVersionNumber([version]$currentVersion) {
function Update-MinorVersion() {
$readmeFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../README.md"
$propertiesFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../gradle.properties"
$telemetryFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../src/main/java/com/microsoft/graph/core/Constants.java"
$telemetryFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../src/main/java/com/microsoft/graph/info/Constants.java"
$currentVersion = Get-CurrentTelemetryVersion -telemetryFilePath $telemetryFilePath
$nextVersion = Update-MinorVersionNumber -currentVersion $currentVersion
Update-ReadmeVersion -version $nextVersion -readmeFilePath $readmeFilePath
Expand Down
2 changes: 2 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gradle
build
24 changes: 24 additions & 0 deletions android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.microsoft.graph"
android:installLocation="auto"
tools:ignore="UnusedAttribute">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />

<application
android:hardwareAccelerated="true"
android:fullBackupContent="true"
android:allowBackup="true"
android:supportsRtl="true"
tools:ignore="GoogleAppIndexingWarning"></application>
</manifest>
71 changes: 71 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
buildscript {
repositories {
google()
gradlePluginPortal()
maven {
url "https://plugins.gradle.org/m2/"
}
}

dependencies {
classpath "com.gradle:gradle-enterprise-gradle-plugin:3.5"
classpath "com.android.tools.build:gradle:4.0.1"
classpath "com.github.ben-manes:gradle-versions-plugin:0.36.0"
}
}

repositories {
google()
gradlePluginPortal()
}

apply plugin: "com.android.library"
apply plugin: "com.github.ben-manes.versions"

android {
compileSdkVersion 30

defaultConfig {
versionCode 1
versionName "1.0"
minSdkVersion 26
targetSdkVersion 30
}

buildTypes {
release {
minifyEnabled false
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

lintOptions {
textOutput "stdout"
checkAllWarnings true
warningsAsErrors true
disable "UnusedResources" // Unused will be removed on release
disable "IconExpectedSize" // Using the material icons provided from Google
disable "GoogleAppIndexingApiWarning" // We might want to index our app later
disable "InvalidPackage" // Butterknife, Okio and Realm
disable "ResourceType" // Annotation binding
disable "GradleDependency"
disable "NewerVersionAvailable"
disable "PropertyPrefixes" // getting false positives because of odata actions & functions (getOrder setOrder)
}
sourceSets {
main {
java.srcDirs = ['../src/main/java']
res.srcDirs = ['../src/main/java']
manifest.srcFile 'AndroidManifest.xml'
}
androidTest {
setRoot '../src/test'
}
}
}

apply from: "../gradle/dependencies.gradle"
43 changes: 43 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Project-wide Gradle settings.

# IDE users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

# The size of the library demands a large amount of RAM to build. Increase as necessary if you get GC errors
## linux requires 10G, OSX requires 11G
org.gradle.jvmargs=-XX:MaxPermSize=512m -Xmx2g
org.gradle.parallel=true
org.gradle.caching=true

mavenGroupId = com.microsoft.graph
mavenArtifactId = microsoft-graph
mavenMajorVersion = 2
mavenMinorVersion = 3
mavenPatchVersion = 1
mavenArtifactSuffix =

#These values are used to run functional tests
#If you wish to run the functional tests, edit the gradle.properties
#file in your user directory instead of adding them here.
#ex: C:\Users\username\.gradle\gradle.properties
ClientId="CLIENT_ID"
Username="USERNAME"
Password="PASSWORD"

#enable mavenCentralPublishingEnabled to publish to maven central
mavenCentralSnapshotArtifactSuffix = -SNAPSHOT
mavenCentralPublishingEnabled=false
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 60dcbc4

Please sign in to comment.