Skip to content

Instantly share code, notes, and snippets.

@topgenorth
Created March 5, 2013 20:51
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save topgenorth/5094153 to your computer and use it in GitHub Desktop.
Save topgenorth/5094153 to your computer and use it in GitHub Desktop.
Rakefile for packaging release APK's for Xamarin.Android
require 'albacore'
@file_version = "2.0.0.0"
@keystore = "../keystores/opgenorth-release-key.keystore"
@alias_name = "mytrips"
@input_apk = "EmploymentStandardsJudgments.Android/bin/Release/net.opgenorth.esj.apk"
@signed_apk = "EmploymentStandardsJudgments.Android/bin/Release/net.opgenorth.esj-signed.apk"
@final_apk = "deploy/AlbertaEmploymentJudgments.apk"
task :default => [:clean, :versioning, :build, :sign]
desc "Remove the bin and obj directories."
task :clean do
rm_rf "EmploymentStandardsJudgments.Android/bin"
rm_rf "EmploymentStandardsJudgments.Android/obj"
end
desc "Update the build number before compiling."
assemblyinfo :versioning do |asm|
asm.input_file = "EmploymentStandardsJudgments.Android/Properties/AssemblyInfo.cs"
asm.output_file = "EmploymentStandardsJudgments.Android/Properties/AssemblyInfo.cs"
asm.version = @file_version
asm.file_version = @_file_version
end
desc "Compiles the project."
xbuild :build do |msb|
msb.solution = "EmploymentStandardsJudgments.Android/EmploymentStandardsJudgments.Android.csproj"
msb.properties = { :configuration => :release }
msb.targets [ :Clean, :Build, :SignAndroidPackage ]
end
desc "Signs and zip aligns the APK."
task :sign do
sh "jarsigner", "-verbose", "-sigalg", "MD5withRSA", "-digestalg", "SHA1", "-keystore", @keystore, "-signedjar", @signed_apk, @input_apk, @alias_name
sh "zipalign", "-f", "-v", "4", @signed_apk, @final_apk
end
desc "Install the APK on a device."
task :install do
%x[adb shell pm uninstall -k net.opgenorth.esj.android]
%x[adb install deploy/AlbertaEmploymentJudgments.apk]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment