This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
forked from ftctechnh/ftc_app
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build.common.gradle: centralize build.gradle management for YourCodeH…
…ere apps Former-commit-id: d727aefa998e53436835bab3942d9ae8677ed0c4 Former-commit-id: 53f1c5b
- Loading branch information
1 parent
3edbe4c
commit a04d097
Showing
2 changed files
with
78 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1 @@ | ||
import java.util.regex.Pattern | ||
|
||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 19 | ||
buildToolsVersion "22.0.1" | ||
|
||
defaultConfig { | ||
applicationId 'com.qualcomm.ftcrobotcontroller' | ||
minSdkVersion 16 | ||
targetSdkVersion 19 | ||
|
||
// Note: this versionCode must be kept in sync with the | ||
// android:versionCode="nn" | ||
// attribute that is found in the AndroidManifest.xml file of the FtcRobotController | ||
// module from FTC HQ. If this is not done, the robot controller may potentially have | ||
// multiple versions of the app simultaneously installed, which can lead to confusion. | ||
// | ||
// Here, we have a funky little Groovy script to maintain that correspondence automatically | ||
// See also: http://developer.android.com/tools/building/configuring-gradle.html | ||
|
||
def manifestFile = file('../FtcRobotController/src/main/AndroidManifest.xml'); | ||
def pattern = Pattern.compile("versionCode=\"(\\d+)\"") | ||
def manifestText = manifestFile.getText() | ||
def matcher = pattern.matcher(manifestText) | ||
matcher.find() | ||
def code = Integer.parseInt(matcher.group(1)) | ||
|
||
versionCode code // http://developer.android.com/tools/publishing/versioning.html | ||
versionName '@string/version_name' // http://developer.android.com/tools/publishing/versioning.html | ||
} | ||
buildTypes { | ||
release { | ||
debuggable true | ||
} | ||
debug { | ||
debuggable true | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_7 | ||
targetCompatibility JavaVersion.VERSION_1_7 | ||
} | ||
} | ||
|
||
repositories { | ||
flatDir { | ||
dirs '../FtcRobotController/libs' | ||
} | ||
} | ||
|
||
dependencies { | ||
compile files('libs/android-support-v4.jar') | ||
compile (name:'RobotCore-release', ext:'aar') | ||
compile (name:'Hardware-release', ext:'aar') | ||
compile (name:'FtcCommon-release', ext:'aar') | ||
compile (name:'ModernRobotics-release', ext:'aar') | ||
compile (name:'Analytics-release', ext:'aar') | ||
compile (name:'WirelessP2p-release', ext:'aar') | ||
compile project(':SwerveRoboticsLibrary') | ||
compile project(':FtcRobotController') | ||
} | ||
apply from: '../build.common.gradle' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// | ||
// build.common.gradle | ||
// | ||
// This contains the content of the 'build.gradle' files for all YourCodeHere applications | ||
// built using the Swerve Library. Each individual 'build.gradle' in those applications can | ||
// simply contain the one line: | ||
// | ||
// apply from: '../build.common.gradle' | ||
// | ||
// That will pick up this file here. This approach allows the maintenance of individual | ||
// build.gradle files to be carried out automatically on behalf of individual YourCodeHere | ||
// applications. | ||
|
||
import java.util.regex.Pattern | ||
|
||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 19 | ||
buildToolsVersion "22.0.1" | ||
|
||
defaultConfig { | ||
applicationId 'com.qualcomm.ftcrobotcontroller' | ||
minSdkVersion 16 | ||
targetSdkVersion 19 | ||
|
||
// Note: this versionCode must be kept in sync with the | ||
// android:versionCode="nn" | ||
// attribute that is found in the AndroidManifest.xml file of the FtcRobotController | ||
// module from FTC HQ. If this is not done, the robot controller may potentially have | ||
// multiple versions of the app simultaneously installed, which can lead to confusion. | ||
// | ||
// Here, we have a funky little Groovy script to maintain that correspondence automatically | ||
// See also: http://developer.android.com/tools/building/configuring-gradle.html | ||
|
||
def manifestFile = file('../FtcRobotController/src/main/AndroidManifest.xml'); | ||
def pattern = Pattern.compile("versionCode=\"(\\d+)\"") | ||
def manifestText = manifestFile.getText() | ||
def matcher = pattern.matcher(manifestText) | ||
matcher.find() | ||
def code = Integer.parseInt(matcher.group(1)) | ||
|
||
versionCode code // http://developer.android.com/tools/publishing/versioning.html | ||
versionName '@string/version_name' // http://developer.android.com/tools/publishing/versioning.html | ||
} | ||
buildTypes { | ||
release { | ||
debuggable true | ||
} | ||
debug { | ||
debuggable true | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_7 | ||
targetCompatibility JavaVersion.VERSION_1_7 | ||
} | ||
} | ||
|
||
repositories { | ||
flatDir { | ||
dirs '../FtcRobotController/libs' | ||
} | ||
} | ||
|
||
dependencies { | ||
compile files('libs/android-support-v4.jar') | ||
compile (name:'RobotCore-release', ext:'aar') | ||
compile (name:'Hardware-release', ext:'aar') | ||
compile (name:'FtcCommon-release', ext:'aar') | ||
compile (name:'ModernRobotics-release', ext:'aar') | ||
compile (name:'Analytics-release', ext:'aar') | ||
compile (name:'WirelessP2p-release', ext:'aar') | ||
compile project(':SwerveRoboticsLibrary') | ||
compile project(':FtcRobotController') | ||
} |