jenkins-bot has submitted this change and it was merged. Change subject: Add fallback json Gradle project ......................................................................
Add fallback json Gradle project * Use java-mwapi Gradle project when available. Otherwise, use OSSHR module dependency. * Require JDK7 compilation. The Wikipedia Android app has transitioned from Maven to Gradle and it's time for the json library to do the same. It has become too burdensome to maintain a Maven repo and develop across multiple projects. This patch replaces the Maven Gradle module dependency with a Gradle Java project dependency, when present. Json library dependency patch: https://gerrit.wikimedia.org/r/#/c/223718/ Bug: T105235, T103051 Change-Id: I1ea910bfb1200f37980c46b2d8ae8b51b4cfed90 --- M build.gradle M settings.gradle M wikipedia/build.gradle 3 files changed, 41 insertions(+), 5 deletions(-) Approvals: BearND: Looks good to me, approved jenkins-bot: Verified diff --git a/build.gradle b/build.gradle index 542b502..e7be4df 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,7 @@ classpath 'com.android.tools.build:gradle:1.2.3' classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0' classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1' + classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -18,6 +19,6 @@ repositories { mavenLocal() jcenter() - maven { url 'https://tools.wmflabs.org/android-maven-repo' } + maven { url 'https://oss.sonatype.org/content/groups/staging' } } } diff --git a/settings.gradle b/settings.gradle index 031a674..d738c4d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,19 @@ +def fileExists = {String filename -> + new File(filename).exists() +} + +def hierarchyToFilename = { String hierarchy -> + return hierarchy ? hierarchy.substring(1).replaceAll(':', File.separator) : hierarchy +} + +def includeExists = { String projectPath, String name -> + if (fileExists(hierarchyToFilename(projectPath))) { + include projectPath + + // Replace a generic name like "lib". + project(projectPath).name = name + } +} + include ':wikipedia' +includeExists ':java-mwapi:lib', 'json' diff --git a/wikipedia/build.gradle b/wikipedia/build.gradle index 7713a15..46b1ddc 100644 --- a/wikipedia/build.gradle +++ b/wikipedia/build.gradle @@ -13,9 +13,19 @@ return "2.0.${android.defaultConfig.versionCode}-${label}-${date}" } +final JAVA_VERSION = JavaVersion.VERSION_1_7 +if (JavaVersion.current() != JAVA_VERSION) { + throw new IllegalStateException("Incorrect Java Development Kit version; expected " + + JAVA_VERSION + " but found " + JavaVersion.current()) +} + android { compileSdkVersion 22 buildToolsVersion '22.0.1' + compileOptions { + sourceCompatibility = JAVA_VERSION + targetCompatibility = JAVA_VERSION + } defaultConfig { applicationId 'org.wikipedia' minSdkVersion 10 @@ -88,7 +98,17 @@ } } +def compileSubprojectOrModule = { String projectName, + String moduleName, + String excludeGroup = null, + String excludeModule = null -> + def dependency = project.findProject(projectName) ?: moduleName + project.dependencies.add('compile', dependency, {exclude group: excludeGroup, module: excludeModule }) +} + dependencies { + compileSubprojectOrModule ':java-mwapi:json', 'org.mediawiki.api:json:1.3.2-SNAPSHOT', 'org.json', 'json' + // To keep the Maven Central dependencies up-to-date // use http://gradleplease.appspot.com/ or http://search.maven.org/. // Debug with ./gradlew -q wikipedia:dependencies --configuration compile @@ -96,9 +116,6 @@ compile 'com.android.support:appcompat-v7:22.2.0' // includes support-v4 compile 'com.android.support:design:22.2.0' compile 'com.android.support:percent:22.2.0' - compile('org.mediawiki.api:json:1.3.2-SNAPSHOT') { - exclude group: 'org.json', module: 'json' - } compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0' compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'com.squareup:otto:1.3.6' @@ -140,4 +157,4 @@ } else { System.err.println propFile.toString() + ' not found' android.buildTypes.release.signingConfig = null -} +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/223720 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1ea910bfb1200f37980c46b2d8ae8b51b4cfed90 Gerrit-PatchSet: 16 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Niedzielski <[email protected]> Gerrit-Reviewer: BearND <[email protected]> Gerrit-Reviewer: Dbrant <[email protected]> Gerrit-Reviewer: Mholloway <[email protected]> Gerrit-Reviewer: Niedzielski <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
