Skip to content

Instantly share code, notes, and snippets.

View Red-Folder's full-sized avatar

Mark Taylor Red-Folder

View GitHub Profile
# Rename the plugin interface versions from .txt to .java
# In my SVN I store as .txt, but in Github I want them to be .java
$path = $env:SOURCEPATH + "\src\com\red_folder\phonegap\plugin\backgroundservice\*.txt"
Dir $path | rename-item -newname { $_.name -replace '\.txt$','.java' }
function filesDifferent($sourceFilename, $targetFilename) {
$targetFileExists = fileExists $targetFilename
if (!($targetFileExists)) {
return $TRUE
}
if ($sourceFilename.Contains(".jar")) {
removeFolder "c:\tmp\jartest\source"
removeFolder "c:\tmp\jartest\target"
pluginpath = "c:\\tmp\\backgroundserviceplugin\\plugin"
sourcepath = "c:\\tmp\\backgroundserviceplugin\\source"
build("BackgroundServicePlugin Build", PLUGINVERSION: "2.2.0", CORDOVAVERSION: "2.2.0", BUILDOUTPUTPATH: pluginpath, SOURCEPATH: sourcepath)
build("BackgroundServicePlugin Build", PLUGINVERSION: "2.3.0", CORDOVAVERSION: "2.3.0", BUILDOUTPUTPATH: pluginpath, SOURCEPATH: sourcepath)
build("BackgroundServicePlugin Build", PLUGINVERSION: "2.4.0", CORDOVAVERSION: "2.4.0", BUILDOUTPUTPATH: pluginpath, SOURCEPATH: sourcepath)
build("BackgroundServicePlugin Build", PLUGINVERSION: "2.5.0", CORDOVAVERSION: "2.5.0", BUILDOUTPUTPATH: pluginpath, SOURCEPATH: sourcepath)
build("BackgroundServicePlugin Build", PLUGINVERSION: "2.6.0", CORDOVAVERSION: "2.6.0", BUILDOUTPUTPATH: pluginpath, SOURCEPATH: sourcepath)
build("BackgroundServicePlugin Build", PLUGINVERSION: "2.7.0", CORDOVAVERSION: "2.7.0", BUILDOUTPUTPATH: pluginpath, SOURCEPATH: sourcepath)
build("BackgroundServicePlugin Build", PLUGINVERSION: "2.8.0", CO
Write-Host "Checking if this is version specific config.xml"
$versionSpecificConfig = $env:workspace + "\res\xml\" + $env:pluginversion + "\config.xml"
if ((Test-Path $versionSpecificConfig -PathType Leaf)) {
Write-Host "Version specific config found: " + $versionSpecificConfig
Remove-Item ($env:workspace + "\res\xml\config.xml")
Copy-Item ($versionSpecificConfig) -Destination ($env:workspace + "\res\xml\")
} else {
Write-Host "No specific config.xml version. Will use standard."
}
$classpathfile = ".classpath"
$pluginversion = (get-item env:"PLUGINVERSION").Value
$cordovaversion = (get-item env:"CORDOVAVERSION").Value
$pluginlibrarypath = "libs/backgroundserviceplugin-" + $pluginversion + ".jar"
$cordovalibrarypath = "libs/cordova-" + $cordovaversion + ".jar"
Write-Host("Plugin Version: {0}" -f $pluginversion)
Write-Host("Cordova Version: {0}" -f $cordovaversion)
Write-Host("Library Path: {0}" -f $librarypath)
mkdir "%SOURCEPATH%\src"
xcopy "%WORKSPACE%\src\*.*" "%SOURCEPATH%\src" /S /R /Y
mkdir "%SOURCEPATH%\aidl"
xcopy "%WORKSPACE%\aidl\*.*" "%SOURCEPATH%\aidl" /S /R /Y
xcopy "%WORKSPACE%\aidl\*.*" "%WORKSPACE%\src\" /S /R /Y
rmdir /S /Q "%WORKSPACE%\aidl"
mkdir "%BUILDOUTPUTPATH%\%PLUGINVERSION%"
copy /b "%BUILDOUTPUTPATH%\backgroundserviceplugin-%PLUGINVERSION%.jar" "%BUILDOUTPUTPATH%\%PLUGINVERSION%"
copy /b "%workspace%\assets\www\%PLUGINVERSION%\backgroundService*.js" "%BUILDOUTPUTPATH%\%PLUGINVERSION%"
copy /b "%workspace%\assets\www\%PLUGINVERSION%\myService*.js" "%BUILDOUTPUTPATH%\%PLUGINVERSION%"
copy /b "%workspace%\assets\www\%PLUGINVERSION%\index*.html" "%BUILDOUTPUTPATH%\%PLUGINVERSION%"
Write-Output "Checking if the app has finished"
$resultCode = 0
& adb shell ps 2>&1 | % {if($_.contains("com.red_folder.phonegap.plugin.backgroundservice.sample")) { Write-Output "App is still running"; $resultCode = -1 } }
exit $resultCode
adb shell pm uninstall com.red_folder.phonegap.plugin.backgroundservice.sample
C:\CSharpWorkspace\JasmineReceiver\JasmineReceiver\bin\Debug\JasmineReceiver.exe