-
Notifications
You must be signed in to change notification settings - Fork 30
Bundle for java #1450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Bundle for java #1450
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f6378dd
WIP: Bundle for java
58d43f9
Suppress warning
d4db102
Bumps version and adds tests
9027ad4
fix issue
80c185f
Change transivity of the dependencies
fa50612
Merge remote-tracking branch 'origin/main' into andrueastman/kiotaBundle
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Ignore Gradle project-specific cache directory | ||
| .gradle | ||
|
|
||
| # Ignore Gradle build output directory | ||
| build | ||
|
|
||
|
|
||
| .settings | ||
| .project | ||
| .classpath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| .gradle | ||
| build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:tools="http://schemas.android.com/tools" | ||
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| buildscript { | ||
| repositories { | ||
| google() | ||
| gradlePluginPortal() | ||
| maven { | ||
| url "https://plugins.gradle.org/m2/" | ||
| } | ||
| maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } | ||
| } | ||
|
|
||
| dependencies { | ||
| classpath "com.gradle:gradle-enterprise-gradle-plugin:3.17.5" | ||
| classpath "com.android.tools.build:gradle:8.5.1" | ||
| classpath "com.github.ben-manes:gradle-versions-plugin:0.51.0" | ||
| } | ||
| } | ||
|
|
||
| repositories { | ||
| google() | ||
| gradlePluginPortal() | ||
| } | ||
|
|
||
| apply plugin: "com.android.library" | ||
| apply plugin: "com.github.ben-manes.versions" | ||
|
|
||
| android { | ||
| namespace "com.microsoft.kiota.bundle" | ||
| compileSdkVersion 35 | ||
|
|
||
| defaultConfig { | ||
| versionCode 1 | ||
| versionName "1.0" | ||
| minSdkVersion 26 | ||
| targetSdkVersion 35 | ||
| } | ||
|
|
||
| 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 "DuplicatePlatformClasses" // xpp3 added by azure-identity | ||
| } | ||
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| mavenArtifactId = microsoft-kiota-bundle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,227 @@ | ||
| plugins { | ||
| // Apply the java-library plugin to add support for Java Library | ||
| id 'java-library' | ||
| id 'eclipse' | ||
| id 'maven-publish' | ||
| id 'signing' | ||
| id 'jacoco' | ||
| id 'com.github.spotbugs' | ||
| id 'com.diffplug.spotless' | ||
| } | ||
|
|
||
| java { | ||
| modularity.inferModulePath = true | ||
| withSourcesJar() | ||
| withJavadocJar() | ||
| } | ||
|
|
||
| test { | ||
| useJUnitPlatform() | ||
| finalizedBy jacocoTestReport // report is always generated after tests run | ||
| } | ||
|
|
||
| jacocoTestReport { | ||
| dependsOn test // tests are required to run before generating the report | ||
| reports.xml.required = true | ||
| } | ||
|
|
||
| jacoco { | ||
| toolVersion = "0.8.11" | ||
| } | ||
|
|
||
| spotbugsMain { | ||
| excludeFilter = file("spotBugsExcludeFilter.xml") | ||
| reports { | ||
| html { | ||
| required | ||
| outputLocation = file("$buildDir/reports/spotbugs/main/spotbugs.html") | ||
| stylesheet = 'fancy-hist.xsl' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| spotbugsTest { | ||
| excludeFilter = file("spotBugsExcludeFilter.xml") | ||
| reports { | ||
| html { | ||
| required | ||
| outputLocation = file("$buildDir/reports/spotbugs/test/spotbugs.html") | ||
| stylesheet = 'fancy-hist.xsl' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| sourceSets { | ||
| main { | ||
| java { | ||
| exclude 'pom.xml' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // In this section you declare where to find the dependencies of your project | ||
| repositories { | ||
| // You can declare any Maven/Ivy/file repository here. | ||
| mavenCentral() | ||
| } | ||
|
|
||
| apply from: "gradle/dependencies.gradle" | ||
|
|
||
| def pomConfig = { | ||
| licenses { | ||
| license([:]) { | ||
| name "MIT License" | ||
| url "http://opensource.org/licenses/MIT" | ||
| distribution "repo" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| //Publishing tasks- | ||
| //Maven Central Snapshot: publishMavenPublicationToMavenRepository | ||
| //Maven Central Release: publishmavenPublicationToMaven2Repository | ||
|
|
||
| tasks.jar { | ||
| manifest { | ||
| attributes('Automatic-Module-Name': project.property('mavenGroupId')) | ||
| } | ||
| } | ||
|
|
||
| publishing { | ||
|
|
||
| publications { | ||
| maven(MavenPublication) { | ||
| customizePom(pom) | ||
| groupId project.property('mavenGroupId') | ||
| artifactId project.property('mavenArtifactId') | ||
| version "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenCentralSnapshotArtifactSuffix}" | ||
| from components.java | ||
| pom.withXml { | ||
| def pomFile = file("${project.buildDir}/generated-pom.xml") | ||
| writeTo(pomFile) | ||
| } | ||
| } | ||
| } | ||
| repositories { | ||
| maven { | ||
| url = 'https://oss.sonatype.org/content/repositories/snapshots' | ||
| name = 'sonatypeSnapshot' | ||
|
|
||
| credentials { | ||
| if (project.rootProject.file('local.properties').exists()) { | ||
| Properties properties = new Properties() | ||
| properties.load(project.rootProject.file('local.properties').newDataInputStream()) | ||
| username = properties.getProperty('sonatypeUsername') | ||
| password = properties.getProperty('sonatypePassword') | ||
| } | ||
| } | ||
| } | ||
|
|
||
| maven { | ||
| url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2' | ||
| name = 'sonatype' | ||
|
|
||
| credentials { | ||
| if (project.rootProject.file('local.properties').exists()) { | ||
| Properties properties = new Properties() | ||
| properties.load(project.rootProject.file('local.properties').newDataInputStream()) | ||
| username = properties.getProperty('sonatypeUsername') | ||
| password = properties.getProperty('sonatypePassword') | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| signing { | ||
| sign publishing.publications.maven | ||
| } | ||
| tasks.withType(Sign)*.enabled = mavenCentralPublishingEnabled.toBoolean() | ||
|
|
||
| def fixAscNames = { name -> | ||
| if(name.contains('pom')) { | ||
| "${project.property('mavenArtifactId')}-${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}.pom.asc" | ||
| } else { | ||
| name.replace('microsoft-kiota-bundle', "${project.property('mavenArtifactId')}-${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}") | ||
| } | ||
| } | ||
|
|
||
| compileJava { | ||
| options.compilerArgs << "-parameters" | ||
| sourceCompatibility = '1.8' | ||
| targetCompatibility = '1.8' | ||
| } | ||
|
|
||
| def getVersionCode() { | ||
| return mavenMajorVersion.toInteger() * 10000 + mavenMinorVersion.toInteger() * 100 + mavenPatchVersion.toInteger() | ||
| } | ||
|
|
||
| def getVersionName() { | ||
| return "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenArtifactSuffix}" | ||
| } | ||
|
|
||
| artifacts { | ||
| archives jar | ||
| } | ||
|
|
||
| def customizePom(pom) { | ||
| pom.withXml { | ||
| def root = asNode() | ||
|
|
||
| root.dependencies.removeAll { dep -> | ||
| dep.scope == "test" | ||
| } | ||
|
|
||
| root.children().last() + { | ||
| resolveStrategy = Closure.DELEGATE_FIRST | ||
|
|
||
| description 'Microsoft Kiota-Bundle' | ||
| name 'Microsoft Kiota-Java Bundle' | ||
| url 'https://github.com/microsoft/kiota-java' | ||
| organization { | ||
| name 'Microsoft' | ||
| url 'https://github.com/microsoft/kiota-java' | ||
| } | ||
| issueManagement { | ||
| system 'GitHub' | ||
| url 'https://github.com/microsoft/kiota-java/issues' | ||
| } | ||
| licenses { | ||
| license { | ||
| name "MIT License" | ||
| url "http://opensource.org/licenses/MIT" | ||
| distribution "repo" | ||
| } | ||
| } | ||
| scm { | ||
| url 'https://github.com/microsoft/kiota-java' | ||
| connection 'scm:git:git://github.com/microsoft/kiota-java.git' | ||
| developerConnection 'scm:git:ssh://git@github.com:microsoft/kiota-java.git' | ||
| } | ||
| developers { | ||
| developer { | ||
| name 'Microsoft' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| gradle.taskGraph.whenReady { taskGraph -> | ||
| if (project.rootProject.file('local.properties').exists()) { | ||
| Properties properties = new Properties() | ||
| properties.load(project.rootProject.file('local.properties').newDataInputStream()) | ||
| tasks.withType(Sign)*.enabled = (properties.containsKey('enableSigning')) ? properties.getProperty('enableSigning').toBoolean() : false | ||
| allprojects { ext."signing.keyId" = properties.getProperty('signing.keyId') } | ||
| allprojects { ext."signing.secretKeyRingFile" = properties.getProperty('signing.secretKeyRingFile') } | ||
| allprojects { ext."signing.password" = properties.getProperty('signing.password') } | ||
| } | ||
| } | ||
|
|
||
| model { | ||
| tasks.generatePomFileForMavenPublication { | ||
| destination = file("${project.buildDir}/generated-pom.xml") | ||
| } | ||
| } | ||
|
|
||
| apply from: file('../../spotless.groovy') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| mavenArtifactId = microsoft-kiota-bundle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| dependencies { | ||
| implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1' | ||
|
|
||
| api project(':components:abstractions') | ||
| api project(':components:http:okHttp') | ||
| api project(':components:serialization:json') | ||
| api project(':components:serialization:text') | ||
| api project(':components:serialization:multipart') | ||
| api project(':components:serialization:form') | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| .gradle | ||
| build/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| plugins { | ||
| // Apply the java-library plugin to add support for Java Library | ||
| id 'java-library' | ||
| id 'eclipse' | ||
| } | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| sourceSets { | ||
| main { | ||
| java { | ||
| srcDirs = ['../src'] | ||
| exclude 'test/**' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| java { | ||
| toolchain { | ||
| languageVersion = JavaLanguageVersion.of(8) | ||
| } | ||
| withSourcesJar() | ||
| withJavadocJar() | ||
| } | ||
|
|
||
| apply from: "../gradle/dependencies.gradle" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| mavenArtifactId = microsoft-kiota-bundle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <FindBugsFilter | ||
| xmlns="https://github.com/spotbugs/filter/3.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd"> | ||
| </FindBugsFilter> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.