CB-7512 Use a standard build.gradle for all plugins Plugins can extend it by providing a "build-extras.gradle"
Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/f9cd9a17 Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/f9cd9a17 Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/f9cd9a17 Branch: refs/heads/master Commit: f9cd9a17adfc584a4f8c085cd89f8ae5275d291e Parents: 304df34 Author: Andrew Grieve <[email protected]> Authored: Mon Sep 22 21:35:39 2014 -0400 Committer: Prabhjot Singh <[email protected]> Committed: Mon Oct 6 16:12:12 2014 +0530 ---------------------------------------------------------------------- bin/templates/cordova/lib/build.js | 7 +++ bin/templates/cordova/lib/plugin-build.gradle | 63 ++++++++++++++++++++++ framework/build.gradle | 38 ++++++------- 3 files changed, 90 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/f9cd9a17/bin/templates/cordova/lib/build.js ---------------------------------------------------------------------- diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js index 18a2f3b..5fc378c 100644 --- a/bin/templates/cordova/lib/build.js +++ b/bin/templates/cordova/lib/build.js @@ -222,6 +222,13 @@ var builders = { shell.rm('-rf', path.join(projectPath, 'gradle', 'wrapper')); shell.mkdir('-p', path.join(projectPath, 'gradle')); shell.cp('-r', path.join(wrapperDir, 'gradle', 'wrapper'), path.join(projectPath, 'gradle')); + + // Update the version of build.gradle in each dependent library. + var pluginBuildGradle = path.join(projectPath, 'cordova', 'lib', 'plugin-build.gradle'); + var subProjects = extractSubProjectPaths(); + for (var i = 0; i < subProjects.length; ++i) { + shell.cp('-f', pluginBuildGradle, path.join(ROOT, subProjects[i], 'build.gradle')); + } }); }, http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/f9cd9a17/bin/templates/cordova/lib/plugin-build.gradle ---------------------------------------------------------------------- diff --git a/bin/templates/cordova/lib/plugin-build.gradle b/bin/templates/cordova/lib/plugin-build.gradle new file mode 100644 index 0000000..bf706c4 --- /dev/null +++ b/bin/templates/cordova/lib/plugin-build.gradle @@ -0,0 +1,63 @@ +/* Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +// GENERATED FILE! DO NOT EDIT! + +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:0.12.+' + } +} + +apply plugin: 'android-library' + +dependencies { + compile fileTree(dir: 'libs', include: '*.jar') +} + +android { + compileSdkVersion cordova.cordovaSdkVersion + buildToolsVersion cordova.cordovaBuildToolsVersion + publishNonDefault true + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + resources.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } +} + +if (file('build-extras.gradle').exists()) { + apply from: 'build-extras.gradle' +} http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/f9cd9a17/framework/build.gradle ---------------------------------------------------------------------- diff --git a/framework/build.gradle b/framework/build.gradle index 85295f8..e9d06ea 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -1,20 +1,19 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. +/* Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. */ @@ -29,7 +28,10 @@ buildscript { // It can affect things like where the .apk is generated. // It also dictates what the minimum android build-tools version // that you need (Set in bin/templates/project/cordova.gradle). - // Be sure to also update the value in bin/templates/project. + // Make sure the value is the same in all locations: + // * framework/build.gradle + // * bin/templates/project/cordova.gradle + // * bin/templates/cordova/lib/plugin-build.gradle classpath 'com.android.tools.build:gradle:0.12.+' } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
