Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions components/bundle/.gitignore
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
2 changes: 2 additions & 0 deletions components/bundle/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gradle
build
23 changes: 23 additions & 0 deletions components/bundle/android/AndroidManifest.xml
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>
73 changes: 73 additions & 0 deletions components/bundle/android/build.gradle
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"
1 change: 1 addition & 0 deletions components/bundle/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mavenArtifactId = microsoft-kiota-bundle
227 changes: 227 additions & 0 deletions components/bundle/build.gradle
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')
1 change: 1 addition & 0 deletions components/bundle/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mavenArtifactId = microsoft-kiota-bundle
10 changes: 10 additions & 0 deletions components/bundle/gradle/dependencies.gradle
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')
}
2 changes: 2 additions & 0 deletions components/bundle/java-8/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gradle
build/
28 changes: 28 additions & 0 deletions components/bundle/java-8/build.gradle
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"
1 change: 1 addition & 0 deletions components/bundle/java-8/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mavenArtifactId = microsoft-kiota-bundle
6 changes: 6 additions & 0 deletions components/bundle/spotBugsExcludeFilter.xml
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>
Loading