mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: Gradle tasks for publishing to bintray and jcenter, mavencentral; snapshot buidls go to oss.sonatype.org Those gradle changes adds tasks: bintrayUpload - publishing on bintray, in 'facebook' org uploadArchives - uploading to maven repos Gradle tasks are copied from facebook open sourced libraries like https://github.com/facebook/litho, https://github.com/facebookincubator/spectrum To do the publishing we need to provide somehow (e.g. in ~/.gradle/gradle.properties) ``` signing.keyId= signing.password= signing.secretKeyRingFile= bintrayUsername= bintrayApiKey= bintrayGpgPassword= SONATYPE_NEXUS_USERNAME= SONATYPE_NEXUS_PASSWORD= ``` android/libs/fbjni is submodule, to be able to add publishing tasks to it (it needs to be published as separate maven dependency) - I created `android/libs/fbjni_local` that has only `build.gradle` with release tasks. pytorch_android dependency for ':fbjni' changed from implementation -> api as implementation treated as 'private' dependency which is translated to scope=runtime in maven pom file, api works as 'compile' Testing: it's already published on bintray with version 0.0.4 and can be used in gradle files as ``` repositories { maven { url "https://dl.bintray.com/facebook/maven" } } dependencies { implementation 'com.facebook:pytorch_android:0.0.4' implementation 'com.facebook:pytorch_android_torchvision:0.0.4' } ``` It was published in com.facebook group I requested sync to jcenter from bintray, that usually takes 2-3 days Versioning added version suffixes to aar output files and circleCI jobs for android start failing as they expected just pytorch_android.aar pytorch_android_torchvision.aar, without any version To avoid it - I changed circleCI android jobs to zip *.aar files and publish as single artifact with name artifacts.zip, I will add kostmo to check this part, if circleCI jobs finish ok - everything works :) Pull Request resolved: https://github.com/pytorch/pytorch/pull/25351 Reviewed By: kostmo Differential Revision: D17135886 Pulled By: IvanKobzarev fbshipit-source-id: 64eebac670bbccaaafa1b04eeab15760dd5ecdf9
56 lines
1.5 KiB
Groovy
56 lines
1.5 KiB
Groovy
apply plugin: 'com.android.library'
|
|
apply plugin: 'maven'
|
|
|
|
android {
|
|
compileSdkVersion rootProject.compileSdkVersion
|
|
buildToolsVersion rootProject.buildToolsVersion
|
|
|
|
|
|
defaultConfig {
|
|
minSdkVersion rootProject.minSdkVersion
|
|
targetSdkVersion rootProject.targetSdkVersion
|
|
versionCode 0
|
|
versionName "0.1"
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
minifyEnabled false
|
|
}
|
|
release {
|
|
minifyEnabled false
|
|
}
|
|
}
|
|
|
|
useLibrary 'android.test.runner'
|
|
useLibrary 'android.test.base'
|
|
useLibrary 'android.test.mock'
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':pytorch_android')
|
|
|
|
implementation 'com.android.support:appcompat-v7:28.0.0'
|
|
|
|
testImplementation 'junit:junit:' + rootProject.junitVersion
|
|
testImplementation 'androidx.test:core:' + rootProject.coreVersion
|
|
|
|
androidTestImplementation 'junit:junit:' + rootProject.junitVersion
|
|
androidTestImplementation 'androidx.test:core:' + rootProject.coreVersion
|
|
androidTestImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion
|
|
androidTestImplementation 'androidx.test:rules:' + rootProject.rulesVersion
|
|
androidTestImplementation 'androidx.test:runner:' + rootProject.runnerVersion
|
|
}
|
|
|
|
apply from: rootProject.file('gradle/release.gradle')
|
|
|
|
task sourcesJar(type: Jar) {
|
|
from android.sourceSets.main.java.srcDirs
|
|
archiveClassifier.set('sources')
|
|
}
|
|
|
|
artifacts.add('archives', sourcesJar)
|