aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/bin/build.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/bin/build.php')
-rwxr-xr-x[-rw-r--r--]vendor/sabre/dav/bin/build.php60
1 files changed, 50 insertions, 10 deletions
diff --git a/vendor/sabre/dav/bin/build.php b/vendor/sabre/dav/bin/build.php
index 11cca1e61..82b1e7530 100644..100755
--- a/vendor/sabre/dav/bin/build.php
+++ b/vendor/sabre/dav/bin/build.php
@@ -1,3 +1,4 @@
+#!/usr/bin/env php
<?php
$tasks = [
@@ -9,10 +10,10 @@ $tasks = [
'init', 'test', 'clean',
],
'clean' => [],
- 'test' => [
+ 'test' => [
'composerupdate',
],
- 'init' => [],
+ 'init' => [],
'composerupdate' => [],
];
@@ -35,9 +36,9 @@ if (!isset($tasks[$currentTask])) {
$newTaskList = [];
$oldTaskList = [$currentTask => true];
-while(count($oldTaskList)>0) {
+while (count($oldTaskList) > 0) {
- foreach($oldTaskList as $task=>$foo) {
+ foreach ($oldTaskList as $task => $foo) {
if (!isset($tasks[$task])) {
echo "Dependency not found: " . $task, "\n";
@@ -46,7 +47,7 @@ while(count($oldTaskList)>0) {
$dependencies = $tasks[$task];
$fullFilled = true;
- foreach($dependencies as $dependency) {
+ foreach ($dependencies as $dependency) {
if (isset($newTaskList[$dependency])) {
// Already in the fulfilled task list.
continue;
@@ -65,7 +66,7 @@ while(count($oldTaskList)>0) {
}
-foreach(array_keys($newTaskList) as $task) {
+foreach (array_keys($newTaskList) as $task) {
echo "task: " . $task, "\n";
call_user_func($task);
@@ -100,7 +101,7 @@ function composerupdate() {
global $baseDir;
echo " Updating composer packages to latest version\n\n";
- system('cd ' . $baseDir . '; composer update --dev');
+ system('cd ' . $baseDir . '; composer update');
}
function test() {
@@ -120,12 +121,51 @@ function test() {
function buildzip() {
global $baseDir, $version;
- echo " Asking composer to download sabre/dav $version\n\n";
- system("composer create-project --no-dev sabre/dav build/SabreDAV $version", $code);
- if ($code!==0) {
+ echo " Generating composer.json\n";
+
+ $input = json_decode(file_get_contents(__DIR__ . '/../composer.json'), true);
+ $newComposer = [
+ "require" => $input['require'],
+ "config" => [
+ "bin-dir" => "./bin",
+ ],
+ "prefer-stable" => true,
+ "minimum-stability" => "alpha",
+ ];
+ unset(
+ $newComposer['require']['sabre/vobject'],
+ $newComposer['require']['sabre/http'],
+ $newComposer['require']['sabre/uri'],
+ $newComposer['require']['sabre/event']
+ );
+ $newComposer['require']['sabre/dav'] = $version;
+ mkdir('build/SabreDAV');
+ file_put_contents('build/SabreDAV/composer.json', json_encode($newComposer, JSON_PRETTY_PRINT));
+
+ echo " Downloading dependencies\n";
+ system("cd build/SabreDAV; composer install -n", $code);
+ if ($code !== 0) {
echo "Composer reported error code $code\n";
die(1);
}
+
+ echo " Removing pointless files\n";
+ unlink('build/SabreDAV/composer.json');
+ unlink('build/SabreDAV/composer.lock');
+
+ echo " Moving important files to the root of the project\n";
+
+ $fileNames = [
+ 'CHANGELOG.md',
+ 'LICENSE',
+ 'README.md',
+ 'examples',
+ ];
+ foreach ($fileNames as $fileName) {
+ echo " $fileName\n";
+ rename('build/SabreDAV/vendor/sabre/dav/' . $fileName, 'build/SabreDAV/' . $fileName);
+ }
+
// <zip destfile="build/SabreDAV-${sabredav.version}.zip" basedir="build/SabreDAV" prefix="SabreDAV/" />
echo "\n";