Merge pull request #3594 from jbrazio/feature/rework-versioning

Rework Marlin's versioning system
This commit is contained in:
Scott Lahteine 2016-04-24 17:42:45 -07:00
commit 266ae90861
30 changed files with 193 additions and 123 deletions

View file

@ -3,16 +3,29 @@
DIR="$1" export DIR DIR="$1" export DIR
OUTFILE="$2" export OUTFILE OUTFILE="$2" export OUTFILE
echo "/* This file is automatically generated by an Arduino hook" >"$OUTFILE"
echo " * Do not manually edit it" >>"$OUTFILE"
echo " * It does not get committed to the repository" >>"$OUTFILE"
echo " */" >>"$OUTFILE"
echo "" >>"$OUTFILE"
echo "#define BUILD_UNIX_DATETIME" `date +%s` >>"$OUTFILE" BUILDATE=$(date '+"%s"')
echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>"$OUTFILE" DISTDATE=$(date '+"%Y-%m-%d %H:%M"')
cat > "$OUTFILE" <<EOF
/**
* THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
* IT DOES NOT GET COMMITTED TO THE REPOSITORY.
*/
#define BUILD_UNIX_DATETIME ${BUILDATE}
#define STRING_DISTRIBUTION_DATE ${DISTDATE}
#define PROTOCOL_VERSION "1.0"
#define MACHINE_NAME "Travis CI"
#define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin"
#define DEFAULT_MACHINE_UUID "3442baa1-08ee-435b-8a10-99d185bd43b8"
#define WEBSITE_URL "http://marlinfw.org"
EOF
( set +e ( set +e
cd "$DIR" cd "$DIR"
BRANCH=`git symbolic-ref -q --short HEAD` BRANCH=`git symbolic-ref -q --short HEAD`
if [ "x$BRANCH" == "x" ] ; then if [ "x$BRANCH" == "x" ] ; then
BRANCH="" BRANCH=""
@ -21,6 +34,7 @@ echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>"$OUTFILE"
else else
BRANCH=" $BRANCH" BRANCH=" $BRANCH"
fi fi
VERSION=`git describe --tags --first-parent 2>/dev/null` VERSION=`git describe --tags --first-parent 2>/dev/null`
if [ "x$VERSION" != "x" ] ; then if [ "x$VERSION" != "x" ] ; then
echo "#define SHORT_BUILD_VERSION \"$VERSION\"" | sed "s/-.*/$BRANCH\"/" >>"$OUTFILE" echo "#define SHORT_BUILD_VERSION \"$VERSION\"" | sed "s/-.*/$BRANCH\"/" >>"$OUTFILE"
@ -30,10 +44,4 @@ echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>"$OUTFILE"
echo "#define SHORT_BUILD_VERSION \"$BRANCH\"" >>"$OUTFILE" echo "#define SHORT_BUILD_VERSION \"$BRANCH\"" >>"$OUTFILE"
echo "#define DETAILED_BUILD_VERSION \"${BRANCH}-$VERSION\"" >>"$OUTFILE" echo "#define DETAILED_BUILD_VERSION \"${BRANCH}-$VERSION\"" >>"$OUTFILE"
fi fi
URL=`git config --local --get remote.origin.url | sed "sx.*github.com.xhttps://github.com/x" | sed "sx\.gitx/x"`
if [ "x$URL" != "x" ] ; then
echo "#define SOURCE_CODE_URL \""$URL"\"" >>"$OUTFILE"
echo "// Deprecated URL definition" >>"$OUTFILE"
echo "#define FIRMWARE_URL \""$URL"\"" >>"$OUTFILE"
fi
) )

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -1,36 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* This file is a placeholder for a file which could be distributed in an archive
* It takes the place of an automatically created "_Version.h" which is generated during the build process
*/
// #error "You must specify the following parameters related to your distribution"
#if true
#define SHORT_BUILD_VERSION "1.1.0-RCBugFix"
#define DETAILED_BUILD_VERSION "1.1.0-RCBugFix From Archive"
#define STRING_DISTRIBUTION_DATE "2016-04-16 12:00"
// It might also be appropriate to define a location where additional information can be found
// #define SOURCE_CODE_URL "http:// ..."
#endif

View file

@ -38,6 +38,41 @@
#error Versions of Arduino IDE prior to 1.6.0 are no longer supported, please update your toolkit. #error Versions of Arduino IDE prior to 1.6.0 are no longer supported, please update your toolkit.
#endif #endif
/**
* Marlin release, version and default string
*/
#ifndef SHORT_BUILD_VERSION
#error SHORT_BUILD_VERSION Information must be specified
#endif
#ifndef DETAILED_BUILD_VERSION
#error BUILD_VERSION Information must be specified
#endif
#ifndef STRING_DISTRIBUTION_DATE
#error STRING_DISTRIBUTION_DATE Information must be specified
#endif
#ifndef PROTOCOL_VERSION
#error PROTOCOL_VERSION Information must be specified
#endif
#ifndef MACHINE_NAME
#error MACHINE_NAME Information must be specified
#endif
#ifndef SOURCE_CODE_URL
#error SOURCE_CODE_URL Information must be specified
#endif
#ifndef DEFAULT_MACHINE_UUID
#error DEFAULT_MACHINE_UUID Information must be specified
#endif
#ifndef WEBSITE_URL
#error WEBSITE_URL Information must be specified
#endif
/** /**
* Dual Stepper Drivers * Dual Stepper Drivers
*/ */

74
Marlin/Version.h Normal file
View file

@ -0,0 +1,74 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* This file is the standard Marlin version identifier file, all fields can be
* overriden by the ones defined on _Version.h by using the Configuration.h
* directive USE_AUTOMATIC_VERSIONING.
*/
/**
* Marlin release version identifier
*/
#define SHORT_BUILD_VERSION "1.1.0-RCBugFix"
/**
* Verbose version identifier which should contain a reference to the location
* from where the binary was downloaded or the source code was compiled.
*/
#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (Github)"
/**
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
* here we define this default string as the date where the latest release
* version was tagged.
*/
#define STRING_DISTRIBUTION_DATE "2016-04-16 12:00"
/**
* @todo: Missing documentation block
*/
#define PROTOCOL_VERSION "1.0"
/**
* Defines a generic printer name to be output to the LCD after booting Marlin.
*/
#define MACHINE_NAME "3D Printer"
/**
* The SOURCE_CODE_URL is the location where users will find the Marlin Source
* Code which is installed on the device. In most cases unless the manufacturer
* has a distinct Github fork the Source Code URL should just be the main
* Marlin repository.
*/
#define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin"
/**
* Default generic printer UUID.
*/
#define DEFAULT_MACHINE_UUID "cede2a2f-41a2-4748-9b12-c55c62f367ff"
/**
* The WEBSITE_URL is the location where users can get more information such as
* documentation about a specific Marlin release.
*/
#define WEBSITE_URL "http://marlinfw.org"

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -83,7 +83,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -101,7 +101,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -82,7 +82,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -69,7 +69,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -76,7 +76,7 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during

View file

@ -66,43 +66,32 @@
#if ENABLED(USE_AUTOMATIC_VERSIONING) #if ENABLED(USE_AUTOMATIC_VERSIONING)
#include "_Version.h" #include "_Version.h"
#else #else
#include "Default_Version.h" #include "Version.h"
#endif #endif
#define PROTOCOL_VERSION "1.0" #ifdef DEFAULT_SOURCE_CODE_URL
#undef SOURCE_CODE_URL
#ifndef DEFAULT_MACHINE_NAME #define SOURCE_CODE_URL DEFAULT_SOURCE_CODE_URL
#define DEFAULT_MACHINE_NAME "3D Printer"
#endif #endif
#ifdef CUSTOM_MACHINE_NAME #ifdef CUSTOM_MACHINE_NAME
#undef MACHINE_NAME
#define MACHINE_NAME CUSTOM_MACHINE_NAME #define MACHINE_NAME CUSTOM_MACHINE_NAME
#else #else
#define MACHINE_NAME DEFAULT_MACHINE_NAME #ifdef DEFAULT_MACHINE_NAME
#endif #undef MACHINE_NAME
#define MACHINE_NAME DEFAULT_MACHINE_NAME
#ifndef DEFAULT_SOURCE_URL #endif
/**
* The SOURCE_CODE_URL is the location where users will find the Marlin Source
* Code which is installed on the device. In most cases unless the manufacturer
* has a distinct Github fork the Source Code URL should just be the main
* Marlin repository.
*/
#define DEFAULT_SOURCE_URL "https://github.com/MarlinFirmware/Marlin"
#endif
#ifndef SOURCE_CODE_URL
#define SOURCE_CODE_URL DEFAULT_SOURCE_URL
#endif
#ifndef DETAILED_BUILD_VERSION
#error BUILD_VERSION Information must be specified
#endif #endif
#ifndef MACHINE_UUID #ifndef MACHINE_UUID
#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" #define MACHINE_UUID DEFAULT_MACHINE_UUID
#endif #endif
#ifdef DEFAULT_WEBSITE_URL
#undef WEBSITE_URL
#define WEBSITE_URL DEFAULT_WEBSITE_URL
#endif
// Common LCD messages // Common LCD messages

View file

@ -26,8 +26,8 @@
#include "pins_RAMPS_14.h" #include "pins_RAMPS_14.h"
#define DEFAULT_MACHINE_NAME "3Drag" #define DEFAULT_MACHINE_NAME "3Drag"
#define DEFAULT_SOURCE_URL "http://3dprint.elettronicain.it/" #define DEFAULT_SOURCE_CODE_URL "http://3dprint.elettronicain.it/"
#undef Z_ENABLE_PIN #undef Z_ENABLE_PIN
#define Z_ENABLE_PIN 63 #define Z_ENABLE_PIN 63

View file

@ -27,8 +27,8 @@
#include "pins_3DRAG.h" #include "pins_3DRAG.h"
#undef DEFAULT_MACHINE_NAME #undef DEFAULT_MACHINE_NAME
#define DEFAULT_MACHINE_NAME "K8200" #define DEFAULT_MACHINE_NAME "K8200"
#undef DEFAULT_SOURCE_URL #undef DEFAULT_SOURCE_CODE_URL
#define DEFAULT_SOURCE_URL "https://github.com/CONSULitAS/Marlin-K8200" #define DEFAULT_SOURCE_CODE_URL "https://github.com/CONSULitAS/Marlin-K8200"

View file

@ -31,8 +31,8 @@
#error Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu. #error Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu.
#endif #endif
#define DEFAULT_MACHINE_NAME "SAV MkI" #define DEFAULT_MACHINE_NAME "SAV MkI"
#define DEFAULT_SOURCE_URL "https://github.com/fmalpartida/Marlin/tree/SAV-MkI-config" #define DEFAULT_SOURCE_CODE_URL "https://github.com/fmalpartida/Marlin/tree/SAV-MkI-config"
#define LARGE_FLASH true #define LARGE_FLASH true

View file

@ -28,8 +28,8 @@
#error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu. #error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
#endif #endif
#define DEFAULT_MACHINE_NAME "Ultimaker" #define DEFAULT_MACHINE_NAME "Ultimaker"
#define DEFAULT_SOURCE_URL "https://github.com/Ultimaker/Marlin" #define DEFAULT_SOURCE_CODE_URL "https://github.com/Ultimaker/Marlin"
#define X_STEP_PIN 25 #define X_STEP_PIN 25
#define X_DIR_PIN 23 #define X_DIR_PIN 23

View file

@ -28,8 +28,8 @@
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif #endif
#define DEFAULT_MACHINE_NAME "Ultimaker" #define DEFAULT_MACHINE_NAME "Ultimaker"
#define DEFAULT_SOURCE_URL "https://github.com/Ultimaker/Marlin" #define DEFAULT_SOURCE_CODE_URL "https://github.com/Ultimaker/Marlin"
#define LARGE_FLASH true #define LARGE_FLASH true

View file

@ -28,8 +28,8 @@
#error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu.
#endif #endif
#define DEFAULT_MACHINE_NAME "Ultimaker" #define DEFAULT_MACHINE_NAME "Ultimaker"
#define DEFAULT_SOURCE_URL "https://github.com/Ultimaker/Marlin" #define DEFAULT_SOURCE_CODE_URL "https://github.com/Ultimaker/Marlin"
#define LARGE_FLASH true #define LARGE_FLASH true