Skip to content

Commit db3d722

Browse files
author
Stewart Miles
committed
Merge remote-tracking branch 'origin/master' into ghmaster
2 parents 0ab833b + 345bc7c commit db3d722

35 files changed

+658
-266
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# Version 1.2.6 - Nov 15, 2016
2+
## Bug Fixes
3+
* Fixed IOSResolver errors when iOS support is not installed.
4+
* Added fallback to "pod" executable search which queries the Ruby Gems
5+
package manager for the binary install location.
6+
7+
# Version 1.2.5 - Nov 3, 2016
8+
## Bug Fixes
9+
* Added crude support for source only Cocoapods to the IOSResolver.
10+
11+
# Version 1.2.4 - Oct 27, 2016
12+
## Bug Fixes
13+
* Automated resolution of out of date pod repositories.
14+
15+
# Version 1.2.3 - Oct 25, 2016
16+
## Bug Fixes
17+
* Fixed exception when reporting conflicting depedencies.
18+
19+
# Version 1.2.2 - Oct 17, 2016
20+
## Bug Fixes
21+
* Fixed issue working with Unity 5.5
22+
* Fixed issue with PlayServicesResolver corrupting other iOS dependencies.
23+
* Updated build script to use Unity distributed tools for building.
124
# Version 1.2.1 - Jul 25, 2016
225
## Bug Fixes
326
* Removed 1.2 Resolver and hardcoded whitelist of AARs to expand.

Dockerfile

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ This library only works with Unity version 4.6.8 or higher.
5252
The library relies on the installation of the Android Support Repository and
5353
the Google Repository SDK components. These are found in the "extras" section.
5454

55+
Building using Ubuntu
56+
57+
sudo apt-get install monodevelop nunit-console
58+
5559
# Packaging
5660

5761
The plugin consists of several C# DLLs that contain

build.gradle

Lines changed: 145 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -45,92 +45,100 @@ project.ext {
4545
'may fail.')
4646
}
4747

48-
// Get the path to the Unity DLLs.
49-
// Unity DLLs are referenced by the plug-in and therefore required by the
50-
// build process.
51-
unity_dll_path = System.getProperty("UNITY_DLL_PATH")
52-
unity_dll_path_file = (unity_dll_path == null ||
53-
unity_dll_path.isEmpty()) ?
54-
null : new File(unity_dll_path);
55-
if ((unity_dll_path_file == null || !unity_dll_path_file.exists()) &&
56-
unity_exe_found) {
57-
if (os_osx) {
58-
// Search paths relative to the Unity binary for the Managed
59-
// directory.
60-
for (path in ['../Frameworks/Managed', '../Managed']) {
61-
unity_dll_path_file = new File(new File(unity_exe).getParentFile(),
62-
path)
63-
if (unity_dll_path_file.exists()) break;
48+
// find the unity root directory by working up from the executable.
49+
// not, perfect, but pretty close, work up the tree until the
50+
// name starts with unity.
51+
unity_root = (new File(unity_exe)).getParentFile().getParentFile();
52+
while (!unity_root.name.toLowerCase().startsWith("unity")) {
53+
if (unity_root.getParentFile() != null) {
54+
unity_root = unity_root.getParentFile();
55+
} else {
56+
break;
6457
}
65-
} else if (os_windows || os_linux) {
66-
// ${unity_exe}/../Data/Managed/Unity{Engine,Editor}.dll
67-
unity_dll_path_file = new File(
68-
(new File(unity_exe)).getParentFile(),
69-
'Data' + File.separator + 'Managed')
70-
}
71-
if (unity_dll_path_file != null && unity_dll_path_file.exists()) {
72-
unity_dll_path = unity_dll_path_file.getPath()
73-
}
7458
}
75-
if (unity_dll_path_file == null || !unity_dll_path_file.exists()) {
76-
logger.error('Unity DLLs not found, plug-in build will fail.')
59+
60+
logger.info( "Unity root is $unity_root")
61+
62+
// find unity engine dll
63+
unity_dll_path = findUnityPath("UNITY_DLL_PATH", true,
64+
fileTree(dir: unity_root).matching {
65+
include '**/Managed/UnityEngine.dll'});
66+
67+
if (unity_dll_path == null || !unity_dll_path.exists()) {
68+
logger.warn('Unity Editor and Runtime DLLs not found, compilation may fail!')
69+
} else {
70+
logger.info("Unity Engine DLL path is $unity_dll_path")
7771
}
7872

79-
unity_playback_engines_dll_path = System.getProperty(
80-
"UNITY_PLAYBACK_ENGINES_DLL_PATH")
81-
unity_playback_engines_dll_path_file = (
82-
unity_playback_engines_dll_path == null ||
83-
unity_playback_engines_dll_path.isEmpty()) ? null : (
84-
new File(unity_playback_engines_dll_path))
85-
if ((unity_playback_engines_dll_path_file == null ||
86-
!unity_playback_engines_dll_path_file.exists()) &&
87-
unity_exe_found) {
88-
if (os_osx) {
89-
// ${unity_exe}/../../../../PlaybackEngines
90-
unity_playback_engines_dll_path_file = new File(
91-
(new File(unity_exe))
92-
.getParentFile()
93-
.getParentFile()
94-
.getParentFile()
95-
.getParentFile(),
96-
'PlaybackEngines')
97-
println unity_playback_engines_dll_path_file.getPath()
98-
} else if (os_windows) {
99-
// ${unity_exe}/../Data/PlaybackEngines
100-
unity_playback_engines_dll_path_file = new File(
101-
(new File(unity_exe)).getParentFile(),
102-
'Data' + File.separator + 'PlaybackEngines')
103-
}
104-
if (unity_playback_engines_dll_path_file != null &&
105-
unity_playback_engines_dll_path_file.exists()) {
106-
unity_playback_engines_dll_path =
107-
unity_playback_engines_dll_path_file.getPath()
108-
}
73+
// ios runtime dll. This is with the playback engine, so the
74+
// structure is different for MacOS and the others.
75+
unity_ios_dll_path = findUnityPath("UNITY_IOS_PLAYBACK_PATH", true,
76+
os_osx ?
77+
fileTree(dir: unity_root.parentFile).matching {
78+
include '**/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.dll'
79+
} :
80+
fileTree(dir: unity_root).matching {
81+
include '**/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.dll'
82+
})
83+
84+
if (unity_ios_dll_path == null || !unity_ios_dll_path.exists()) {
85+
logger.warn('Unity iOS Playback engine not found, compilation may fail!')
86+
} else {
87+
logger.info("Unity iOS Playback engine is $unity_ios_dll_path")
10988
}
110-
if (unity_playback_engines_dll_path_file == null ||
111-
!unity_playback_engines_dll_path_file.exists()) {
112-
logger.error('Unity Playback Engine DLLs not found, iOS plug-in build ' +
113-
'will fail.')
89+
90+
91+
// find the NUnit framework dll.
92+
unity_nunit_dll_path = findUnityPath("UNITY_NUNIT_PATH", true,
93+
fileTree(dir: unity_root).matching {
94+
include '**/nunit.framework.dll'
95+
})
96+
97+
if (unity_nunit_dll_path == null || !unity_nunit_dll_path.exists()) {
98+
logger.warn('Unity NUnit framework not found, compilation may fail!')
99+
} else {
100+
logger.info("Unity NUnity framework found in $unity_nunit_dll_path")
114101
}
115102

116-
// Mono's xbuild tool is required to build the managed DLLs in the plug-in.
117-
xbuild_exe = System.getProperty("XBUILD_EXE")
118-
if (xbuild_exe == null || xbuild_exe.isEmpty()) {
119-
xbuild_exe = System.getenv("XBUILD_EXE")
103+
// xbuild is used to build the dlls.
104+
if (os_windows) {
105+
xbuild_exe = findUnityPath("XBUILD_EXE", false,
106+
fileTree(dir: unity_root).matching { include '**/Mono/bin/xbuild.bat'})
107+
} else if (os_osx || os_linux) {
108+
xbuild_exe = findUnityPath("XBUILD_EXE", false,
109+
fileTree(dir: unity_root).matching { include '**/xbuild'})
120110
}
121-
if (xbuild_exe == null || xbuild_exe.isEmpty()) {
122-
xbuild_exe = 'xbuild'
111+
if (xbuild_exe == null || !xbuild_exe.exists()) {
112+
logger.warn("xbuild command not found, compilation may fail.")
113+
xbuild_exe = null
114+
} else {
115+
logger.info("xbuild found at $xbuild_exe")
116+
}
117+
118+
// nunit-console is used to run tests.
119+
if (os_windows) {
120+
nunit_console_exe = findUnityPath("NUNIT_CONSOLE_EXE", false,
121+
fileTree(dir: unity_root).matching { include '**/Mono/bin/nunut-console2.bat'})
122+
} else if (os_osx) {
123+
nunit_console_exe = findUnityPath("NUNIT_CONSOLE_EXE", false,
124+
fileTree(dir: unity_root).matching { include '**/nunit-console2'})
125+
} else if (os_linux) {
126+
nunit_console_exe = findUnityPath("NUNIT_CONSOLE_EXE", false,
127+
fileTree(dir: unity_root).matching { include '**/nunit-console'})
123128
}
124-
if (!(new File(xbuild_exe)).exists()) {
125-
logger.warn('xbuild not found, plug-in build may fail.')
129+
if (nunit_console_exe == null || !nunit_console_exe.exists()) {
130+
logger.warn("nunit_console command not found, compilation may fail.")
131+
nunit_console_exe = null
132+
} else {
133+
logger.info("nunit_console found at $nunit_console_exe")
126134
}
127135

128136
pluginSrc = file('plugin').absolutePath
129137
pluginProj = file('build/PluginSrc').absolutePath
130138
buildPath = file('build').absolutePath
131139
exportPath = file('build/plugin.unitypackage').absolutePath
132140
dllDir = 'Assets/PlayServicesResolver/Editor'
133-
pluginVersion = '1.2.1.0'
141+
pluginVersion = '1.2.6.0'
134142
currentPluginPath = file('.').absolutePath
135143
currentPluginBasename = 'play-services-resolver'
136144
currentPluginName = (currentPluginBasename + '-' + pluginVersion +
@@ -140,27 +148,52 @@ project.ext {
140148
task compile_resolverTests(type: Exec) {
141149
description 'Compile the tests for the Mono framework component.'
142150
workingDir 'source'
143-
commandLine "${xbuild_exe}", '/target:JarResolverTests'
144-
ext.remoteTaskPhase = 'prebuild'
151+
commandLine "${xbuild_exe}", '/target:JarResolverTests',
152+
"/property:NUnityHintPath=$unity_nunit_dll_path.absolutePath"
153+
ext.remoteTaskPhase = 'build'
145154
}
146155

147156
task test_resolverLib(type: Exec, dependsOn: compile_resolverTests) {
148157
description 'Runs the tests.'
149158
workingDir 'source'
150-
commandLine "nunit-console",
159+
commandLine "$nunit_console_exe",
151160
"JarResolverTests/bin/Debug/JarResolverTests.dll"
152-
ext.remoteTaskPhase = 'prebuild'
161+
ext.remoteTaskPhase = 'build'
153162
}
154163

155-
task copy_unityDlls(type: Copy) {
156-
description 'Copy Unity DLLs required to build managed DLLs in the plugin.'
157-
from files(new File(project.ext.unity_dll_path_file, 'UnityEngine.dll'),
158-
new File(project.ext.unity_dll_path_file, 'UnityEditor.dll'),
159-
new File((File)project.ext.unity_playback_engines_dll_path_file,
160-
'iOSSupport' + File.separator +
161-
'UnityEditor.iOS.Extensions.Xcode.dll'))
162-
into 'unity_dlls'
163-
ext.remoteTaskPhase = 'prebuild'
164+
/// find paths within the Unity file tree used for building.
165+
def findUnityPath(propertyKey, wantDirectory, fileTree) {
166+
167+
def propValue;
168+
def fileValue;
169+
170+
propValue = System.getProperty(propertyKey)
171+
if (propValue == null || propValue.isEmpty()) {
172+
propValue = System.getenv(propertyKey)
173+
}
174+
// convert string to file object
175+
if (propValue != null) {
176+
fileValue = file(propValue)
177+
} else {
178+
fileValue = null
179+
}
180+
181+
if (fileValue == null || !fileValue.exists()) {
182+
// take the shortest path location.
183+
fileValue = null
184+
fileTree.files.each { p ->
185+
if (fileValue == null ||
186+
fileValue.absolutePath.length() > p.absolutePath.length()) {
187+
fileValue = p;
188+
}
189+
}
190+
}
191+
192+
if (wantDirectory) {
193+
return fileValue != null ? fileValue.parentFile : null;
194+
} else {
195+
return fileValue
196+
}
164197
}
165198

166199
// Construct the name of a versioned asset from the source filename and version
@@ -190,11 +223,15 @@ def build_pluginDll(projectName, assemblyDllBasename) {
190223

191224
def compileTask = tasks.create(name: "compile_" + projectName,
192225
type: Exec,
193-
description: 'Compile ' + projectName,
194-
dependsOn: [copy_unityDlls])
226+
description: 'Compile ' + projectName
227+
)
195228
compileTask.workingDir('source')
196-
compileTask.commandLine(["${xbuild_exe}", "/target:" + projectName])
197-
compileTask.ext.remoteTaskPhase = "prebuild"
229+
compileTask.commandLine(["${xbuild_exe}", "/target:" + projectName,
230+
"/property:UnityHintPath=$unity_dll_path.absolutePath",
231+
"/property:UnityIosPath=$unity_ios_dll_path.absolutePath"
232+
])
233+
234+
compileTask.ext.remoteTaskPhase = "build"
198235
def assemblyDllSource = file("source/" + projectName + "/bin/Debug/" +
199236
assemblyDllBasename)
200237

@@ -218,7 +255,7 @@ def build_pluginDll(projectName, assemblyDllBasename) {
218255
}
219256
return fn
220257
})
221-
copyTask.ext.remoteTaskPhase = "prebuild"
258+
copyTask.ext.remoteTaskPhase = "build"
222259
}
223260

224261
build_pluginDll("PlayServicesResolver", "Google.JarResolver.dll")
@@ -249,15 +286,15 @@ task copy_pluginTemplate(type: Copy, dependsOn: update_metadataForVersion) {
249286
into "${pluginProj}"
250287
exclude '**/*.dll.*', '**/*.txt.meta'
251288
duplicatesStrategy 'include'
252-
ext.remoteTaskPhase = 'prebuild'
289+
ext.remoteTaskPhase = 'build'
253290
}
254291

255292
task inject_versionIntoMetaFiles(dependsOn: [copy_pluginTemplate,
256293
'copy_PlayServicesResolver',
257294
'copy_VersionHandler',
258295
'copy_IOSResolver']) {
259296
description 'Inject the version number into the plugin\'s meta files.'
260-
ext.remoteTaskPhase = 'prebuild'
297+
ext.remoteTaskPhase = 'build'
261298
doLast {
262299
for (fileobj in fileTree("${pluginProj}")) {
263300
if (fileobj.path.endsWith('.meta')) {
@@ -309,7 +346,7 @@ task generate_manifest(dependsOn: ['copy_manifestMetadata',
309346
"${pluginVersion}"))
310347
manifest.write(list.join('\n') + '\n')
311348
}
312-
ext.remoteTaskPhase = 'prebuild'
349+
ext.remoteTaskPhase = 'build'
313350
}
314351

315352
task export_package(dependsOn: 'generate_manifest') {
@@ -333,9 +370,11 @@ task export_package(dependsOn: 'generate_manifest') {
333370
}
334371
}
335372
ext.remoteTaskPhase = 'build'
373+
374+
dependsOn test_resolverLib
336375
}
337376

338-
task copy_plugin(dependsOn: 'export_package') {
377+
task copy_plugin() {
339378
description 'Copy plugin to the current-build directory'
340379
doFirst {
341380
// If the version number has been bumped delete the exploded directory.
@@ -368,6 +407,20 @@ task build_unityPackage(dependsOn: 'copy_plugin') {
368407
}
369408
}
370409

410+
task clean() {
411+
doFirst {
412+
delete 'build'
413+
file("source").listFiles().each { f ->
414+
if (file("$f/obj").exists()) {
415+
delete "$f/obj"
416+
}
417+
if (file("$f/bin").exists()) {
418+
delete "$f/bin"
419+
}
420+
}
421+
}
422+
}
423+
371424
defaultTasks = ['prebuild', 'build', 'postbuild']
372425
for (phase in defaultTasks) {
373426
if (!tasks.findByName(phase)) {

exploded/Assets/PlayServicesResolver/Editor.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)