Skip to content

Commit

Permalink
Merge pull request #34 from StefMa/update_deps
Browse files Browse the repository at this point in the history
Update deps
  • Loading branch information
StefMa authored Feb 14, 2019
2 parents 026cf9f + 1e262d9 commit 16ddeb3
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 64 deletions.
8 changes: 2 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ jobs:
- run: unzip -q sdk-tools-linux-4333796.zip
- run: mkdir $HOME/android-sdk
- run: mv tools $HOME/android-sdk/tools
- run: mkdir $HOME/android-sdk/licenses
- run: echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$HOME/android-sdk/licenses/android-sdk-license"
- run: echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$HOME/android-sdk/licenses/android-sdk-preview-license"
- run: yes | $HOME/android-sdk/tools/bin/sdkmanager --licenses || true

# Try to restore cache (see how to save cache below)
- restore_cache:
Expand Down Expand Up @@ -63,9 +61,7 @@ jobs:
- run: unzip -q sdk-tools-linux-4333796.zip
- run: mkdir $HOME/android-sdk
- run: mv tools $HOME/android-sdk/tools
- run: mkdir $HOME/android-sdk/licenses
- run: echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$HOME/android-sdk/licenses/android-sdk-license"
- run: echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$HOME/android-sdk/licenses/android-sdk-preview-license"
- run: yes | $HOME/android-sdk/tools/bin/sdkmanager --licenses || true

# Try to restore cache
- restore_cache:
Expand Down
31 changes: 17 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import guru.stefma.bintrayrelease.PublishExtension

plugins {
kotlin("jvm") version "1.2.71"
kotlin("jvm") version "1.3.21"
`java-gradle-plugin`
`java-library`
id("guru.stefma.bintrayrelease") version "1.0.0" apply false
maven
id("guru.stefma.bintrayrelease") version "1.1.1"
}
apply(plugin = "guru.stefma.bintrayrelease")

repositories {
google()
Expand All @@ -17,16 +14,19 @@ repositories {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
implementation("guru.stefma.androidartifacts:androidartifacts:1.2.0")
implementation("guru.stefma.androidartifacts:androidartifacts:1.4.0")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.3.1")
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.3.1")
testImplementation("org.junit.jupiter:junit-jupiter:5.4.0")
testImplementation("org.assertj:assertj-core:3.11.1")
}

tasks.withType(Test::class.java) {
useJUnitPlatform()
afterEvaluate {
tasks.withType(Test::class.java).configureEach {
dependsOn(tasks.named("publishToMavenLocal"))
systemProperty("pluginVersion", version)

useJUnitPlatform()
}
}

gradlePlugin {
Expand All @@ -38,11 +38,14 @@ gradlePlugin {
}
}

version = "1.1.1"
version = "1.1.1-NOSNAPSHOT"
group = "guru.stefma.bintrayrelease"
configure<PublishExtension> {
userOrg = "stefma"
javaArtifact {
artifactId = "bintrayrelease"
}

publish {
userOrg = "stefma"
uploadName = "BintrayRelease"
desc = "Super duper easy way to release your Android and other artifacts to bintray"
website = "https://github.com/StefMa/bintray-release"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ class AndroidDifferentGradleVersionsTest {
writeText(androidBuildScript)
}

File(projectDir, "settings.gradle").apply {
val agpVersion = when {
listOf("4.4", "4.5", "4.5.1").contains(gradleVersion) -> "3.1.0"
"4.10.2" == gradleVersion -> "3.3.0"
else -> "3.2.1"
}
writeText(androidSettingsScript(agpVersion))
}

File(projectDir, "/src/main/AndroidManifest.xml").apply {
parentFile.mkdirs()
writeText("<manifest package=\"guru.stefma.bintrayrelease.test\"/>")
Expand All @@ -36,7 +45,6 @@ class AndroidDifferentGradleVersionsTest {
val runner = GradleRunner.create()
.withProjectDir(projectDir)
.withArguments("build", "bintrayUpload", "-PbintrayKey=key", "-PbintrayUser=user")
.withPluginClasspath()
.withGradleVersion(gradleVersion)

assertThat(runner.build().task(":bintrayUpload")!!.outcome).isEqualTo(TaskOutcome.SUCCESS)
Expand Down
41 changes: 26 additions & 15 deletions src/test/kotlin/guru/stefma/bintrayrelease/GradleScriptTemplates.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,11 @@ val javaBuildScript: String
val androidBuildScript: String
get() {
return """
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
plugins {
id 'guru.stefma.bintrayrelease' apply false
id 'guru.stefma.bintrayrelease'
id 'com.android.library'
}
apply plugin: "guru.stefma.bintrayrelease"
apply plugin: "com.android.library"
android {
compileSdkVersion 26
Expand Down Expand Up @@ -81,4 +69,27 @@ val androidBuildScript: String
desc = 'description'
}
"""
}
}

val androidSettingsScript = androidSettingsScript()

fun androidSettingsScript(agpVersion: String = "3.2.1"): String =
"""
pluginManagement {
repositories {
mavenLocal()
google()
jcenter()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id.startsWith("com.android")) {
useModule("com.android.tools.build:gradle:$agpVersion")
}
if (requested.id.id.startsWith("guru.stefma")) {
useModule("guru.stefma.bintrayrelease:bintrayrelease:${System.getProperty("pluginVersion")}")
}
}
}
}
"""
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,11 @@ class PublishExtensionCompatTest {
fun `test artifactId in the publish extension in a compatibility way`() {
File(projectDir, "build.gradle").apply {
writeText("""
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
plugins {
id 'guru.stefma.bintrayrelease' apply false
id 'guru.stefma.bintrayrelease'
id 'com.android.library'
}
apply plugin: "guru.stefma.bintrayrelease"
apply plugin: "com.android.library"
android {
compileSdkVersion 26
Expand Down Expand Up @@ -70,6 +58,10 @@ class PublishExtensionCompatTest {
""".trimIndent())
}

File(projectDir, "settings.gradle").apply {
writeText(androidSettingsScript)
}

File(projectDir, "/src/main/AndroidManifest.xml").apply {
parentFile.mkdirs()
writeText("<manifest package=\"guru.stefma.bintrayrelease.test\"/>")
Expand All @@ -78,7 +70,6 @@ class PublishExtensionCompatTest {
val runner = GradleRunner.create()
.withProjectDir(projectDir)
.withArguments("build", "bintrayUpload", "-PbintrayKey=key", "-PbintrayUser=user")
.withPluginClasspath()

assertThat(runner.build().task(":bintrayUpload")!!.outcome).isEqualTo(TaskOutcome.SUCCESS)
}
Expand Down
10 changes: 0 additions & 10 deletions subprojects/consumer/android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ import guru.stefma.androidartifacts.ArtifactsExtension
import guru.stefma.bintrayrelease.PublishExtension
import guru.stefma.bintrayrelease.BintrayReleasePlugin

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.0.1")
}
}

apply<BintrayReleasePlugin>()
apply(plugin = "com.android.library")

Expand Down
12 changes: 9 additions & 3 deletions subprojects/consumer/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.2.71"
kotlin("jvm") version "1.3.21"
}

repositories {
Expand All @@ -9,8 +9,14 @@ repositories {

// We have to make sure that we are using the same dependencies as in our top-level project
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation(kotlin("stdlib-jdk8"))
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
implementation("guru.stefma.androidartifacts:androidartifacts:1.2.0")
implementation("guru.stefma.androidartifacts:androidartifacts:1.4.0")

// This dependency is only needed for the `android` sub-project.
// We need it here because otherwise the `AndroidArtifacts` plugin
// doesn't have the AGP in the same classpath and therefore it will
// crash with a `NoClassDefFoundException`
implementation("com.android.tools.build:gradle:3.2.1")
}
kotlin.sourceSets["main"].kotlin.srcDir("../../../src/main/kotlin")

0 comments on commit 16ddeb3

Please sign in to comment.