Showing
2 changed files
with
23 additions
and
8 deletions
| ... | @@ -32,13 +32,12 @@ afterEvaluate { | ... | @@ -32,13 +32,12 @@ afterEvaluate { |
| 32 | 32 | ||
| 33 | // Two artifacts, the `aar` (or `jar`) and the sources | 33 | // Two artifacts, the `aar` (or `jar`) and the sources |
| 34 | if (project.plugins.findPlugin("com.android.library")) { | 34 | if (project.plugins.findPlugin("com.android.library")) { |
| 35 | -// from components.release | 35 | + from(project.components.findByName("release")) |
| 36 | - from components.findByName('release') | ||
| 37 | } else { | 36 | } else { |
| 38 | from components.java | 37 | from components.java |
| 39 | } | 38 | } |
| 40 | 39 | ||
| 41 | - artifact androidSourcesJar | 40 | + // Sources are now handled by the android block's singleVariant |
| 42 | // artifact javadocJar | 41 | // artifact javadocJar |
| 43 | 42 | ||
| 44 | // Mostly self-explanatory metadata | 43 | // Mostly self-explanatory metadata | ... | ... |
| 1 | apply plugin: 'com.android.library' | 1 | apply plugin: 'com.android.library' |
| 2 | +apply plugin: 'maven-publish' | ||
| 3 | + | ||
| 4 | +android.buildFeatures.buildConfig = true | ||
| 2 | 5 | ||
| 3 | ext { | 6 | ext { |
| 4 | PUBLISH_GROUP_ID = 'ly.warp' | 7 | PUBLISH_GROUP_ID = 'ly.warp' |
| 5 | - PUBLISH_VERSION = '4.5.5.4r45' | 8 | + PUBLISH_VERSION = '4.5.5.4r46' |
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 9 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
| 7 | } | 10 | } |
| 8 | 11 | ||
| ... | @@ -14,6 +17,14 @@ android { | ... | @@ -14,6 +17,14 @@ android { |
| 14 | 17 | ||
| 15 | useLibrary 'org.apache.http.legacy' | 18 | useLibrary 'org.apache.http.legacy' |
| 16 | 19 | ||
| 20 | + publishing { | ||
| 21 | + // Configure all components to be published | ||
| 22 | + singleVariant('release') { | ||
| 23 | + // Publish the release variant with sources | ||
| 24 | + withSourcesJar() | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | + | ||
| 17 | defaultConfig { | 28 | defaultConfig { |
| 18 | minSdkVersion 23 | 29 | minSdkVersion 23 |
| 19 | targetSdkVersion 34 | 30 | targetSdkVersion 34 |
| ... | @@ -102,12 +113,17 @@ dependencies { | ... | @@ -102,12 +113,17 @@ dependencies { |
| 102 | } | 113 | } |
| 103 | 114 | ||
| 104 | // In every export please update the version number | 115 | // In every export please update the version number |
| 105 | -task deleteJarLibrary(type: Delete) { | 116 | +tasks.register('deleteJarLibrary', Delete) { |
| 106 | delete 'jar/warply_android_sdk_v4.5.0.jar' | 117 | delete 'jar/warply_android_sdk_v4.5.0.jar' |
| 107 | } | 118 | } |
| 108 | 119 | ||
| 109 | -task createJarLibrary(type: Jar, dependsOn: 'assembleRelease') { | 120 | +tasks.register('createJarLibrary', Jar) { |
| 110 | - from fileTree('build/intermediates/bundles/release/') | 121 | + dependsOn('assembleRelease') |
| 122 | + from(fileTree('build/intermediates/aar/release/')) | ||
| 123 | + destinationDirectory = file('jar') | ||
| 124 | + archiveFileName = "warply_android_sdk_v${PUBLISH_VERSION}.jar" | ||
| 111 | } | 125 | } |
| 112 | 126 | ||
| 113 | -createJarLibrary.dependsOn(deleteJarLibrary, build) | 127 | +tasks.named('createJarLibrary') { |
| 128 | + dependsOn('deleteJarLibrary', 'build') | ||
| 129 | +} | ... | ... |
-
Please register or login to post a comment