Skip to content

Commit 206c2e6

Browse files
committed
more build tweaks
1 parent 959db87 commit 206c2e6

File tree

5 files changed

+51
-60
lines changed

5 files changed

+51
-60
lines changed

build.gradle

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,41 @@ buildscript {
1818
}
1919

2020
allprojects {
21-
apply plugin: 'java'
21+
apply plugin: 'java'
2222
apply plugin: 'java-library'
2323

24+
// Versions of all dependencies
25+
ext.targetSdkVersion = '26'
26+
ext.supportLibsVersion = '26.0.2'
27+
ext.wearVersion = '2.1.0'
28+
ext.gvrVersion = '1.150.0'
29+
ext.processingVersion = '3.3.7'
30+
ext.toolingVersion = '4.3'
31+
ext.gradlewVersion = '4.4.1'
32+
ext.toolsLibVersion = '26.0.0-dev'
33+
2434
Properties modeProperties = new Properties()
2535
modeProperties.load(project.rootProject.file('mode/mode.properties').newDataInputStream())
2636
ext.modeVersion = modeProperties.getProperty('prettyVersion')
2737

2838
Properties vrProperties = new Properties()
2939
vrProperties.load(project.rootProject.file('mode/libraries/vr/library.properties').newDataInputStream())
30-
ext.vrVersion = vrProperties.getProperty('prettyVersion')
40+
ext.vrLibVersion = vrProperties.getProperty('prettyVersion')
3141

32-
def targetSdkVersion = 26
3342
Properties localProperties = new Properties()
3443
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())
3544
def sdkDir = localProperties.getProperty('sdk.dir')
3645
ext.androidPlatformPath = "${sdkDir}/platforms/android-${targetSdkVersion}"
3746
ext.androidToolsLibPath = "${sdkDir}/tools/lib"
3847

39-
ext.coreZipPath = "$rootDir/mode/processing-core.zip"
40-
48+
ext.coreZipPath = "${rootDir}/mode/processing-core.zip"
49+
4150
repositories {
4251
google()
4352
jcenter()
4453
flatDir dirs: androidPlatformPath
4554
flatDir dirs: androidToolsLibPath
46-
flatDir dirs: "$rootDir/core/dist"
55+
flatDir dirs: "${rootDir}/core/dist"
4756
}
4857

4958
sourceCompatibility = 1.7

core/build.gradle

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ configurations {
2828
sourceSets.main.compileClasspath += it
2929

3030
// Put our custom dependencies onto IDEA's PROVIDED scope
31-
apply plugin: 'idea'
31+
apply plugin: "idea"
3232
idea.module.scopes.PROVIDED.plus += [it]
3333
}
3434
}
@@ -56,10 +56,8 @@ dependencies {
5656

5757
compileOnly name: "android"
5858

59-
def SUPPORT_LIBS_VERSION = '26.0.2'
60-
def WEAR_VERSION = '2.1.0'
61-
aar "com.android.support:support-v4:$SUPPORT_LIBS_VERSION"
62-
aar "com.google.android.support:wearable:$WEAR_VERSION"
59+
aar "com.android.support:support-v4:${supportLibsVersion}"
60+
aar "com.google.android.support:wearable:${wearVersion}"
6361
}
6462

6563
/**
@@ -77,9 +75,6 @@ class ClassesJarArtifactTransform extends ArtifactTransform {
7775
}
7876

7977
task createPom {
80-
def SUPPORT_LIBS_VERSION = '26.0.2'
81-
def WEAR_VERSION = '2.1.0'
82-
8378
pom {
8479
project {
8580
groupId "org.p5android"
@@ -97,13 +92,13 @@ task createPom {
9792
dependency {
9893
groupId "com.android.support"
9994
artifactId "support-v4"
100-
version "$SUPPORT_LIBS_VERSION"
95+
version "${supportLibsVersion}"
10196
scope "compile"
10297
}
10398
dependency {
10499
groupId "com.google.android.support"
105100
artifactId "wearable"
106-
version "$WEAR_VERSION"
101+
version "${wearVersion}"
107102
scope "compile"
108103
}
109104
}
@@ -114,22 +109,22 @@ task createPom {
114109
sourceSets {
115110
main {
116111
java {
117-
srcDirs = ['src/']
112+
srcDirs = ["src/"]
118113
}
119114
resources {
120-
srcDirs = ['src/']
115+
srcDirs = ["src/"]
121116
}
122117
}
123118
}
124119

125120
task sourcesJar(type: Jar, dependsOn: classes) {
126-
classifier = 'sources'
121+
classifier = "sources"
127122
from sourceSets.main.allSource
128123
}
129124

130125
// Does not work because of Processing-specific tags in source code, such as @webref
131126
task javadocJar(type: Jar, dependsOn: javadoc) {
132-
classifier = 'javadoc'
127+
classifier = "javadoc"
133128
from javadoc.destinationDir
134129
}
135130

mode/build.gradle

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@ import org.zeroturnaround.zip.ZipUtil
33
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
44

55
dependencies {
6+
compile group: "org.processing", name: "core", version: "${processingVersion}"
7+
compile group: "org.processing", name: "pde", version: "${processingVersion}"
8+
compile group: "org.processing", name: "java-mode", version: "${processingVersion}"
69

7-
def PROCESSING_VERSION = '3.3.7'
8-
compile group: 'org.processing', name: 'core', version: "$PROCESSING_VERSION"
9-
compile group: 'org.processing', name: 'pde', version: "$PROCESSING_VERSION"
10-
compile group: 'org.processing', name: 'java-mode', version: "$PROCESSING_VERSION"
11-
12-
13-
def TOOLING_VERSION = '4.3'
14-
compileOnly "org.gradle:gradle-tooling-api:$TOOLING_VERSION"
10+
compileOnly "org.gradle:gradle-tooling-api:${toolingVersion}"
1511
}
1612

1713
// This task copies the gradle tooling jar into the mode folder
@@ -24,20 +20,20 @@ build.dependsOn(copyToLib)
2420
sourceSets {
2521
main {
2622
java {
27-
srcDirs = ['src/']
23+
srcDirs = ["src/"]
2824
}
2925
}
3026
}
3127

3228
task permissions(type:Exec) {
3329
// This task retrieves the latest list of Android permissions and adds them
3430
// to the Permissions.java file. The python scripts requries BeautifulSoup
35-
workingDir 'scripts'
36-
commandLine 'python', 'permissions.py'
31+
workingDir "scripts"
32+
commandLine "python", "permissions.py"
3733
}
3834

3935
task wrapper(type: Wrapper) {
40-
gradleVersion = '4.4.1' //version required for gradle wrapper
36+
gradleVersion = "${gradlewVersion}" //version required for gradle wrapper
4137
}
4238
wrapper.doLast {
4339
File wrapperFolder = file("mode/gradlew");
@@ -51,7 +47,7 @@ wrapper.doLast {
5147

5248
clean.doFirst {
5349
delete fileTree("mode") {
54-
include '**/*.jar'
50+
include "**/*.jar"
5551
}
5652
}
5753

mode/libraries/vr/build.gradle

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ configurations {
2828
sourceSets.main.compileClasspath += it
2929

3030
// Put our custom dependencies onto IDEA's PROVIDED scope
31-
apply plugin: 'idea'
31+
apply plugin: "idea"
3232
idea.module.scopes.PROVIDED.plus += [it]
3333
}
3434
}
@@ -58,10 +58,8 @@ dependencies {
5858

5959
compileOnly "org.p5android:processing-core:${modeVersion}"
6060

61-
def GVR_VERSION = '1.150.0'
62-
63-
aar "com.google.vr:sdk-audio:$GVR_VERSION"
64-
aar "com.google.vr:sdk-base:$GVR_VERSION"
61+
aar "com.google.vr:sdk-audio:${gvrVersion}"
62+
aar "com.google.vr:sdk-base:${gvrVersion}"
6563
}
6664

6765
/**
@@ -77,22 +75,17 @@ class ClassesJarArtifactTransform extends ArtifactTransform {
7775
File libraryFolder = new File(System.getProperty("user.dir"), "mode/libraries/vr/library")
7876
libraryFolder.mkdirs();
7977
final File libraryJar = new File(libraryFolder, aarName + ".jar")
80-
// println("******************")
81-
// println(renamedJar.toPath())
82-
// println(libraryJar.toPath())
8378
Files.copy(renamedJar.toPath(), libraryJar.toPath(), REPLACE_EXISTING);
8479
return ImmutableList.of(renamedJar)
8580
}
8681
}
8782

8883
task createPom {
89-
def GVR_VERSION = '1.150.0'
90-
9184
pom {
9285
project {
9386
groupId "org.p5android"
9487
artifactId "processing-vr"
95-
version "${vrVersion}"
88+
version "${vrLibVersion}"
9689
packaging "jar"
9790
licenses {
9891
license {
@@ -112,36 +105,36 @@ task createPom {
112105
dependency {
113106
groupId "com.google.vr"
114107
artifactId "sdk-base"
115-
version "$GVR_VERSION"
108+
version "${gvrVersion}"
116109
scope "compile"
117110
}
118111
dependency {
119112
groupId "com.google.vr"
120113
artifactId "sdk-audio"
121-
version "$GVR_VERSION"
114+
version "${gvrVersion}"
122115
scope "compile"
123116
}
124117
}
125118
}
126-
}.writeTo("dist/processing-vr-${vrVersion}.pom")
119+
}.writeTo("dist/processing-vr-${vrLibVersion}.pom")
127120
}
128121

129122
sourceSets {
130123
main {
131124
java {
132-
srcDirs = ['src/']
125+
srcDirs = ["src/"]
133126
}
134127
}
135128
}
136129

137130
task sourcesJar(type: Jar, dependsOn: classes) {
138-
classifier = 'sources'
131+
classifier = "sources"
139132
from sourceSets.main.allSource
140133
}
141134

142135
// Does not work because of Processing-specific tags in source code, such as @webref
143136
task javadocJar(type: Jar, dependsOn: javadoc) {
144-
classifier = 'javadoc'
137+
classifier = "javadoc"
145138
from javadoc.destinationDir
146139
}
147140

@@ -156,7 +149,7 @@ jar.doLast { task ->
156149

157150
clean.doFirst {
158151
delete "dist"
159-
delete "library"
152+
delete "library/vr.jar"
160153
}
161154

162155
build.doLast {
@@ -170,9 +163,9 @@ build.doLast {
170163
File distFolder = file("dist");
171164
distFolder.mkdirs();
172165
Files.copy(file("$buildDir/libs/vr.jar").toPath(),
173-
file("dist/processing-vr-${vrVersion}.jar").toPath(), REPLACE_EXISTING);
166+
file("dist/processing-vr-${vrLibVersion}.jar").toPath(), REPLACE_EXISTING);
174167
Files.copy(file("$buildDir/libs/vr-sources.jar").toPath(),
175-
file("dist/processing-vr-${vrVersion}-sources.jar").toPath(), REPLACE_EXISTING);
168+
file("dist/processing-vr-${vrLibVersion}-sources.jar").toPath(), REPLACE_EXISTING);
176169
Files.copy(file("$buildDir/libs/vr.jar.MD5").toPath(),
177-
file("dist/processing-vr-${vrVersion}.jar.md5").toPath(), REPLACE_EXISTING);
170+
file("dist/processing-vr-${vrLibVersion}.jar.md5").toPath(), REPLACE_EXISTING);
178171
}

mode/tools/SDKUpdater/build.gradle

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@ import java.nio.file.Files
22
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
33

44
dependencies {
5-
def PROCESSING_VERSION = '3.3.7'
6-
compile group: 'org.processing', name: 'pde', version: "$PROCESSING_VERSION"
5+
compile group: "org.processing", name: "pde", version: "${processingVersion}"
76

8-
def TOOLS_LIB_VERSION = '26.0.0-dev'
9-
compile name: "sdklib-$TOOLS_LIB_VERSION"
10-
compile name: "repository-$TOOLS_LIB_VERSION"
7+
compile name: "sdklib-${toolsLibVersion}"
8+
compile name: "repository-${toolsLibVersion}"
119
}
1210

1311
sourceSets {
1412
main {
1513
java {
16-
srcDirs = ['src/']
14+
srcDirs = ["src/"]
1715
}
1816
}
1917
}

0 commit comments

Comments
 (0)