This commit is contained in:
SotoiGhost 2018-08-13 23:32:24 -05:00
Родитель c4475eeff9
Коммит 80b555c82c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 72EA2B8D62E38FAB
5 изменённых файлов: 88 добавлений и 75 удалений

Просмотреть файл

@ -1,14 +1,17 @@
#addin nuget:?package=Cake.Xamarin.Build&version=2.0.18
#addin nuget:?package=Cake.FileHelpers&version=1.0.3.2
#addin nuget:?package=Cake.Yaml&version=1.0.3
#addin nuget:?package=Cake.Json&version=1.0.2
#addin nuget:?package=Cake.XCode&version=2.0.9
#addin nuget:?package=Cake.Xamarin.Build&version=4.0.1
#addin nuget:?package=Cake.FileHelpers&version=3.0.0
#addin nuget:?package=Cake.Yaml&version=2.1.0
#addin nuget:?package=Cake.Json&version=3.0.1
#addin nuget:?package=Cake.XCode&version=4.0.0
#addin nuget:?package=Newtonsoft.Json&version=9.0.1
#addin nuget:?package=YamlDotNet&version=4.2.1
var TARGET = Argument ("target", Argument ("t", Argument ("Target", "build")));
var GIT_PREVIOUS_COMMIT = EnvironmentVariable ("GIT_PREVIOUS_SUCCESSFUL_COMMIT") ?? Argument ("gitpreviouscommit", "");
var GIT_COMMIT = EnvironmentVariable ("GIT_COMMIT") ?? Argument("gitcommit", "");
var GIT_BRANCH = EnvironmentVariable ("GIT_BRANCH") ?? "origin/master";
var GIT_COMMIT = EnvironmentVariable ("GIT_COMMIT") ?? EnvironmentVariable ("GIT_CLONE_COMMIT_HASH") ?? Argument("gitcommit", "");
var GIT_BRANCH = EnvironmentVariable ("GIT_BRANCH") ?? EnvironmentVariable ("BITRISE_GIT_BRANCH") ?? "origin/master";
var GIT_PATH = EnvironmentVariable ("GIT_EXE") ?? (IsRunningOnWindows () ? "C:\\Program Files (x86)\\Git\\bin\\git.exe" : "git");
var BUILD_GROUPS = DeserializeYamlFromFile<List<BuildGroup>> ("./manifest.yaml");

98
build.sh Normal file → Executable file
Просмотреть файл

@ -1,35 +1,41 @@
#!/usr/bin/env bash
###############################################################
# This is the Cake bootstrapper script that is responsible for
# downloading Cake and all specified tools from NuGet.
###############################################################
##########################################################################
# This is the Cake bootstrapper script for Linux and OS X.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
# Define directories.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$SCRIPT_DIR/tools
export NUGET_EXE=$TOOLS_DIR/nuget.exe
ADDINS_DIR=$TOOLS_DIR/Addins
MODULES_DIR=$TOOLS_DIR/Modules
NUGET_EXE=$TOOLS_DIR/nuget.exe
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
PACKAGES_CONFIG=$TOOLS_DIR/packages.config
PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum
ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config
MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config
# Define md5sum or md5 depending on Linux/OSX
MD5_EXE=
if [[ "$(uname -s)" == "Darwin" ]]; then
MD5_EXE="md5 -r"
else
MD5_EXE="md5sum"
fi
# Define default arguments.
SCRIPT="build.cake"
TARGET="Default"
CONFIGURATION="Release"
VERBOSITY="verbose"
DRYRUN=
SHOW_VERSION=false
SCRIPT_ARGUMENTS=()
CAKE_ARGUMENTS=()
# Parse arguments.
for i in "$@"; do
case $1 in
-s|--script) SCRIPT="$2"; shift ;;
-t|--target) TARGET="$2"; shift ;;
-c|--configuration) CONFIGURATION="$2"; shift ;;
-v|--verbosity) VERBOSITY="$2"; shift ;;
-d|--dryrun) DRYRUN="-dryrun" ;;
--version) SHOW_VERSION=true ;;
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
*) SCRIPT_ARGUMENTS+=("$1") ;;
--) shift; CAKE_ARGUMENTS+=("$@"); break ;;
*) CAKE_ARGUMENTS+=("$1") ;;
esac
shift
done
@ -42,11 +48,11 @@ fi
# Make sure that packages.config exist.
if [ ! -f "$TOOLS_DIR/packages.config" ]; then
if [ ! -f "$SCRIPT_DIR/cake.packages.config" ]; then
echo "Downloading packages.config..."
curl -Lsfo "$TOOLS_DIR/packages.config" http://cakebuild.net/bootstrapper/packages
if [ $? -ne 0 ]; then
echo "An error occured while downloading packages.config."
exit 1
echo "Downloading packages.config..."
curl -Lsfo "$TOOLS_DIR/packages.config" http://cakebuild.net/bootstrapper/packages
if [ $? -ne 0 ]; then
echo "An error occured while downloading packages.config."
exit 1
fi
else
echo "using local cake.packages.config..."
@ -57,23 +63,55 @@ fi
# Download NuGet if it does not exist.
if [ ! -f "$NUGET_EXE" ]; then
echo "Downloading NuGet..."
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/v3.4.4/NuGet.exe
# v3/Latest URL: https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
if [ $? -ne 0 ]; then
echo "An error occured while downloading nuget.exe."
echo "An error occurred while downloading nuget.exe."
exit 1
fi
fi
# Restore tools from NuGet.
pushd "$TOOLS_DIR" >/dev/null
if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then
find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf
fi
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet packages."
echo "Could not restore NuGet tools."
exit 1
fi
$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5"
popd >/dev/null
# Restore addins from NuGet.
if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then
pushd "$ADDINS_DIR" >/dev/null
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet addins."
exit 1
fi
popd >/dev/null
fi
# Restore modules from NuGet.
if [ -f "$MODULES_PACKAGES_CONFIG" ]; then
pushd "$MODULES_DIR" >/dev/null
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet modules."
exit 1
fi
popd >/dev/null
fi
# Make sure that Cake has been installed.
if [ ! -f "$CAKE_EXE" ]; then
echo "Could not find Cake.exe at '$CAKE_EXE'."
@ -81,8 +119,4 @@ if [ ! -f "$CAKE_EXE" ]; then
fi
# Start Cake
if $SHOW_VERSION; then
exec mono "$CAKE_EXE" -version
else
exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
fi
exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}"

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.16.2" />
<package id="Cake" version="0.27.0" />
</packages>

Просмотреть файл

@ -1,10 +1,9 @@
#tool nuget:?package=XamarinComponent&version=1.1.0.65
#tool nuget:?package=XamarinComponent&version=1.1.0.42
#addin nuget:?package=Cake.XCode&version=2.0.9
#addin nuget:?package=Cake.Xamarin.Build&version=2.0.18
#addin nuget:?package=Cake.Xamarin&version=1.3.0.3
#addin nuget:?package=Cake.FileHelpers&version=1.0.3.2
#addin nuget:?package=Cake.XCode&version=4.0.0
#addin nuget:?package=Cake.Xamarin.Build&version=4.0.1
#addin nuget:?package=Cake.Xamarin&version=3.0.0
#addin nuget:?package=Cake.FileHelpers&version=3.0.0
BuildSpec buildSpec = null;

Просмотреть файл

@ -1,6 +1,8 @@
#addin nuget:?package=Cake.Incubator&version=1.2.0
#addin nuget:?package=Cake.Yaml&version=1.0.3
#addin nuget:?package=Cake.Json&version=1.0.2
#addin nuget:?package=Cake.Incubator&version=3.0.0
#addin nuget:?package=Cake.Yaml&version=2.1.0
#addin nuget:?package=Cake.Json&version=3.0.1
#addin nuget:?package=Newtonsoft.Json&version=9.0.1
#addin nuget:?package=YamlDotNet&version=4.2.1
#load "poco.cake"
#load "poco.yaml.cake"
@ -84,26 +86,6 @@ public T GetComponent<T> () where T : GoogleBase, new ()
return component;
}
// Temporary Workaround
// Converts a yaml file into a string with Json format.
public string ConvertYamlToJsonFromFile (FilePath filename)
{
object yaml = null;
var deserializer = new Deserializer ();
var serializer = new Serializer (SerializationOptions.JsonCompatible);
using (var textReader = System.IO.File.OpenText (filename.FullPath)) {
var eventReader = new EventReader (new MergingParser (new Parser (textReader)));
yaml = deserializer.Deserialize (eventReader);
}
var stringBuilder = new StringBuilder ();
using (var textWriter = new StringWriter (stringBuilder))
serializer.Serialize (textWriter, yaml);
return stringBuilder.ToString ();
}
// Updates versions inside of the component.yaml of the desired component
public void UpdateYamlVersions (GoogleBase component)
{
@ -116,12 +98,7 @@ public void UpdateYamlVersions (GoogleBase component)
Information ($"Updating version in component.yaml file of {component.Name} component.");
// Deserialize the component.yaml into an object
// var componentData = DeserializeYamlFromFile<Component> (yamlPath);
// Temporary Workaround. Seems that YamlDotNet cannot deserialize an object within an object in version 3.8.0
// This doesn't happen in version 4.x
var jsonString = ConvertYamlToJsonFromFile (yamlPath);
var componentData = DeserializeJson<Component> (jsonString);
var componentData = DeserializeYamlFromFile<Component> (yamlPath);
// Update the main version of component.yaml
componentData.Version = component.NewVersion;