Skip to content

Commit 730de21

Browse files
committed
add cardboard to gradle dependencies
1 parent f1a6436 commit 730de21

File tree

2 files changed

+33
-39
lines changed

2 files changed

+33
-39
lines changed

src/processing/mode/android/AndroidBuild.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,9 +1529,11 @@ protected void createGradleProject(File projectFolder, File exportFolder)
15291529
} else {
15301530
createTopModule(projectFolder, exportFolder, "':app'");
15311531
if (appComponent == CARDBOARD) {
1532-
createAppModule(projectFolder, exportFolder, CARDBOARD_GRADLE_BUILD_TEMPLATE, "24.0.1");
1532+
createAppModule(projectFolder, exportFolder, min_sdk_cardboard,
1533+
CARDBOARD_GRADLE_BUILD_TEMPLATE, "24.0.1");
15331534
} else {
1534-
createAppModule(projectFolder, exportFolder, APP_GRADLE_BUILD_TEMPLATE, "24.0.1");
1535+
createAppModule(projectFolder, exportFolder, min_sdk_fragment,
1536+
APP_GRADLE_BUILD_TEMPLATE, "24.0.1");
15351537
}
15361538
}
15371539
}
@@ -1560,15 +1562,15 @@ private void createTopModule(File projectFolder, File exportFolder,
15601562
}
15611563

15621564
private void createAppModule(File projectFolder, File exportFolder,
1563-
String tmplFile, String buildToolsVer) throws SketchException, IOException {
1565+
String min_sdk, String tmplFile, String buildToolsVer) throws SketchException, IOException {
15641566
File moduleFolder = mkdirs(exportFolder, "app");
15651567

15661568
File appBuildTemplate = mode.getContentFile("templates/" + tmplFile);
15671569
File appBuildFile = new File(moduleFolder, "build.gradle");
15681570
HashMap<String, String> replaceMap = new HashMap<String, String>();
15691571
replaceMap.put("@@build_tools@@", buildToolsVer);
15701572
replaceMap.put("@@package_name@@", getPackageName());
1571-
replaceMap.put("@@min_sdk@@", AndroidBuild.min_sdk_fragment);
1573+
replaceMap.put("@@min_sdk@@", min_sdk);
15721574
replaceMap.put("@@target_sdk@@", AndroidBuild.target_sdk);
15731575
replaceMap.put("@@wear_version@@", wear_version);
15741576
replaceMap.put("@@gvr_version@@", gvr_sdk_version);
@@ -1582,7 +1584,10 @@ private void createAppModule(File projectFolder, File exportFolder,
15821584
File coreFile = new File(projectFolder, "libs/processing-core.jar");
15831585
File libsFolder = mkdirs(moduleFolder, "libs");
15841586
Util.copyFile(coreFile, new File(libsFolder, "processing-core.jar"));
1585-
1587+
1588+
File cardboardFile = new File(projectFolder, "libs/cardboard.jar");
1589+
Util.copyFile(cardboardFile, new File(libsFolder, "cardboard.jar"));
1590+
15861591
File mainFolder = mkdirs(moduleFolder, "src/main");
15871592
File javaFolder = mkdirs(mainFolder, "java");
15881593
File resFolder = mkdirs(mainFolder, "res");

templates/CardboardBuild.gradle.tmpl

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,33 @@
1-
/*
2-
* Copyright 2017 Google Inc. All rights reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
apply plugin: 'com.android.model.application'
1+
apply plugin: 'com.android.application'
172

18-
model {
19-
android {
20-
compileSdkVersion @@target_sdk@@
21-
buildToolsVersion "@@build_tools@@"
22-
23-
defaultConfig {
24-
applicationId "@@package_name@@"
25-
minSdkVersion.apiLevel @@min_sdk@@
26-
targetSdkVersion.apiLevel @@target_sdk@@
27-
versionCode @@version_code@@
28-
versionName "@@version_name@@"
29-
}
30-
31-
buildTypes {
32-
release {
33-
minifyEnabled true
34-
proguardFiles.add(file('../../proguard-gvr.txt'))
35-
}
3+
android {
4+
compileSdkVersion @@target_sdk@@
5+
buildToolsVersion "@@build_tools@@"
6+
defaultConfig {
7+
applicationId "@@package_name@@"
8+
minSdkVersion @@min_sdk@@
9+
targetSdkVersion @@target_sdk@@
10+
versionCode @@version_code@@
11+
versionName "@@version_name@@"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3617
}
3718
}
3819
}
3920

4021
dependencies {
22+
compile fileTree(include: ['*.jar'], dir: 'libs')
23+
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
24+
exclude group: 'com.android.support', module: 'support-annotations'
25+
})
26+
compile 'com.android.support:appcompat-v7:23.4.0'
27+
compile 'com.android.support:design:23.4.0'
4128
compile 'com.google.vr:sdk-audio:@@gvr_version@@'
4229
compile 'com.google.vr:sdk-base:@@gvr_version@@'
30+
testCompile 'junit:junit:4.12'
4331
compile files('libs/processing-core.jar')
32+
compile files('libs/cardboard.jar')
4433
}

0 commit comments

Comments
 (0)