Skip to content
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

Added MSBuild properties to AndroidPackageParams #863

Merged
merged 1 commit into from
Jul 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions help/androidpublisher.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://developers.google.com/android-publisher/getting_started
ProjectPath = "Path to my project Droid.csproj"
Configuration = "Release"
OutputPath = androidBuildDir
Properties = ["MSBuild property", "MSBuild property value"]
})

|> AndroidSignAndAlign (fun defaults ->
Expand Down
10 changes: 9 additions & 1 deletion src/app/FakeLib/XamarinHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,16 @@ type AndroidPackageParams = {
Configuration: string
/// Output path for build, defaults to 'bin/Release'
OutputPath: string
/// Additional MSBuild properties, defaults to empty list
Properties: (string * string) list
}

/// The default Android packaging parameters
let AndroidPackageDefaults = {
ProjectPath = ""
Configuration = "Release"
OutputPath = "bin/Release"
Properties = []
}

/// Packages a Xamarin.Android app, returning a FileInfo object for the unsigned APK file
Expand All @@ -92,11 +95,16 @@ let AndroidPackageDefaults = {
let AndroidPackage setParams =
let validateParams param =
if param.ProjectPath = "" then failwith "You must specify a project to package"
if param.Properties
|> List.exists (fun (key, _) -> key.Equals("Configuration", StringComparison.OrdinalIgnoreCase))
then failwith "Cannot specify build configuration via additional parameters. Use Configuration field instead."

param

let createPackage param =
MSBuild param.OutputPath "PackageForAndroid" [ "Configuration", param.Configuration ] [ param.ProjectPath ] |> ignore
let effectiveProperties = [ "Configuration", param.Configuration ] @ param.Properties

MSBuild param.OutputPath "PackageForAndroid" effectiveProperties [ param.ProjectPath ] |> ignore

directoryInfo param.OutputPath
|> filesInDirMatching "*.apk"
Expand Down