-
Notifications
You must be signed in to change notification settings - Fork 564
Fix monodroid SDK detection that depended on non-existent file. #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
|
||
| <PropertyGroup> | ||
| <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> | ||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| <ItemType>GenericProject</ItemType> | ||
| <ProjectGuid>{2CF172E5-BDAE-4ABA-8BC8-08040ED3E77A}</ProjectGuid> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(Configuration)'=='Debug'"> | ||
| <OutputPath>..\..\bin\Debug\</OutputPath> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(Configuration)'=='Release'"> | ||
| <OutputPath>..\..\bin\Release\</OutputPath> | ||
| </PropertyGroup> | ||
|
|
||
| <Import Project="..\..\Configuration.props" /> | ||
|
|
||
| <Target Name="Build"> | ||
| <Copy SourceFiles="..\..\tools\scripts\generator" DestinationFiles="$(OutputPath)bin\generator" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should likely also
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't git preserve executable bits? We cannot be super responsible to users messing up local checkouts by using bad clients.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. git should, yes, but this might not just be a matter of "using bad clients". An alternate scenario: Dropbox-based git checkout, originally checked out on Windows (i.e. no Yes, we could say that's not a support scenario, but (1) that's a really convenient scenario (easy source sharing), and (2) it's not that hard to support by having an explicit
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW chmod is already there ;-)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I missed it. |
||
| <Exec | ||
| Condition=" '$(HostOS)' != 'Windows' " | ||
| Command="chmod +x $(OutputPath)bin\generator" /> | ||
| </Target> | ||
|
|
||
| <Target Name="Clean"> | ||
| <Delete Files="$(OutputPath)bin\generator" /> | ||
| </Target> | ||
| </Project> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,8 @@ namespace Xamarin.Android.Build.Utilities | |
| abstract class MonoDroidSdkBase | ||
| { | ||
| protected readonly static string DebugRuntime = "Mono.Android.DebugRuntime-debug.apk"; | ||
| protected readonly static string GeneratorExe = "generator.exe"; | ||
| protected readonly static string GeneratorScript = "generator"; | ||
|
|
||
| // I can never remember the difference between SdkPath and anything else... | ||
| [Obsolete ("Do not use.")] | ||
|
|
@@ -31,16 +33,18 @@ abstract class MonoDroidSdkBase | |
|
|
||
| public int SharedRuntimeVersion { get; private set; } | ||
|
|
||
| // runtimePath: contains Mono.Android.DebugRuntime-*.apk | ||
| // expectedRuntimePath: contains Mono.Android.DebugRuntime-*.apk | ||
| // binPath: contains mandroid | ||
| // mscorlibDir: contains mscorlib.dll | ||
| public void Initialize (string runtimePath = null, string binPath = null, string bclPath = null) | ||
| public void Initialize (string expectedRuntimePath = null, string binPath = null, string bclPath = null) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why rename this parameter? If it is a good idea, then the comment ~3 lines above should also be corrected.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not just renaming, it is preserving the actual value that was passed to the method to report later as a warning. |
||
| { | ||
| runtimePath = GetValidPath ("MonoAndroidToolsPath", runtimePath, ValidateRuntime, () => FindRuntime ()); | ||
| var runtimePath = GetValidPath ("MonoAndroidToolsPath", expectedRuntimePath, ValidateRuntime, () => FindRuntime ()); | ||
| if (runtimePath != null) { | ||
| binPath = GetValidPath ("MonoAndroidBinPath", binPath, ValidateBin, () => FindBin (runtimePath)); | ||
| bclPath = GetValidPath ("mscorlib.dll", bclPath, ValidateFramework, () => FindFramework (runtimePath)); | ||
| } else { | ||
| if (expectedRuntimePath != null) | ||
| AndroidLogger.LogWarning (null, "Runtime was not found at {0}", expectedRuntimePath); | ||
| binPath = bclPath = null; | ||
| } | ||
|
|
||
|
|
@@ -67,14 +71,21 @@ public void Initialize (string runtimePath = null, string binPath = null, string | |
|
|
||
| static string GetValidPath (string description, string path, Func<string, bool> validator, Func<string> defaultPath) | ||
| { | ||
| if (!string.IsNullOrEmpty (path) && Directory.Exists (path)) { | ||
| if (validator (path)) | ||
| return path; | ||
| AndroidLogger.LogWarning ("{0} path {1} is not valid; skipping.", description, path); | ||
| if (!string.IsNullOrEmpty (path)) { | ||
| if (Directory.Exists (path)) { | ||
| if (validator (path)) | ||
| return path; | ||
| AndroidLogger.LogWarning (null, "{0} path '{1}' is explicitly specified, but it was not valid; skipping.", description, path); | ||
| } else | ||
| AndroidLogger.LogWarning (null, "{0} path '{1}' is explicitly specified, but it was not found; skipping.", description, path); | ||
| } | ||
| path = defaultPath (); | ||
| if (path != null && validator (path)) | ||
| return path; | ||
| if (path != null) | ||
| AndroidLogger.LogWarning (null, "{0} path is defaulted to '{1}', but it was not valid; skipping", description, path); | ||
| else | ||
| AndroidLogger.LogWarning (null, "{0} path is not found and no default location is provided; skipping", description); | ||
| return null; | ||
| } | ||
|
|
||
|
|
@@ -96,6 +107,7 @@ protected static bool ValidateRuntime (string loc) | |
| { | ||
| return !string.IsNullOrWhiteSpace (loc) && | ||
| (File.Exists (Path.Combine (loc, DebugRuntime)) || // Normal/expected | ||
| File.Exists (Path.Combine (loc, GeneratorExe)) || // Normal/expected | ||
| File.Exists (Path.Combine (loc, "Ionic.Zip.dll"))); // Wrench builds | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/bin/sh | ||
| BINDIR=`dirname "$0"` | ||
| MANDROID_DIR="$BINDIR/../lib/mandroid" | ||
|
|
||
| unset MONO_PATH | ||
| exec mono $MONO_OPTIONS "$MANDROID_DIR/generator.exe" "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid syntax here. The syntax is:
You have:
You need to place an
EndProjectbefore this line.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, I removed it during the merge with master...!