|
@@ -3,24 +3,29 @@
|
3
|
3
|
|
4
|
4
|
DIR="$1" export DIR
|
5
|
5
|
OUTFILE="$2" export OUTFILE
|
6
|
|
-echo "/* This file is automatically generated by an Arduino hook" >"$OUTFILE"
|
7
|
|
-echo " * Do not manually edit it" >>"$OUTFILE"
|
8
|
|
-echo " * It does not get committed to the repository" >>"$OUTFILE"
|
9
|
|
-echo " */" >>"$OUTFILE"
|
10
|
|
-echo "" >>"$OUTFILE"
|
11
|
|
-
|
12
|
|
-echo "#define PROTOCOL_VERSION \"1.0\"" >>"$OUTFILE"
|
13
|
|
-echo "#define DEFAULT_SOURCE_URL \"https://github.com/MarlinFirmware/Marlin\"" >>"$OUTFILE"
|
14
|
|
-echo "#define DEFAULT_MACHINE_NAME \"Travis 3D Printer\"" >>"$OUTFILE"
|
15
|
|
-echo "#define DEFAULT_MACHINE_UUID \"3442baa1-08ee-435b-8a10-99d185bd43b8\"" >>"$OUTFILE"
|
16
|
|
-echo "" >>"$OUTFILE"
|
17
|
|
-
|
18
|
|
-echo "#define BUILD_UNIX_DATETIME" `date +%s` >>"$OUTFILE"
|
19
|
|
-echo "#define STRING_DISTRIBUTION_DATE" `date '+"%Y-%m-%d %H:%M"'` >>"$OUTFILE"
|
20
|
|
-echo "" >>"$OUTFILE"
|
|
6
|
+
|
|
7
|
+BUILDATE=$(date '+"%s"')
|
|
8
|
+DISTDATE=$(date '+"%Y-%m-%d %H:%M"')
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+cat > "$OUTFILE" <<EOF
|
|
12
|
+/**
|
|
13
|
+ * THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
|
|
14
|
+ * IT DOES NOT GET COMMITTED TO THE REPOSITORY.
|
|
15
|
+ */
|
|
16
|
+
|
|
17
|
+#define BUILD_UNIX_DATETIME ${BUILDATE}
|
|
18
|
+#define STRING_DISTRIBUTION_DATE ${DISTDATE}
|
|
19
|
+#define PROTOCOL_VERSION "1.0"
|
|
20
|
+#define MACHINE_NAME "Travis CI"
|
|
21
|
+#define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin"
|
|
22
|
+#define DEFAULT_MACHINE_UUID "3442baa1-08ee-435b-8a10-99d185bd43b8"
|
|
23
|
+#define WEBSITE_URL "http://marlinfw.org"
|
|
24
|
+EOF
|
21
|
25
|
|
22
|
26
|
( set +e
|
23
|
27
|
cd "$DIR"
|
|
28
|
+
|
24
|
29
|
BRANCH=`git symbolic-ref -q --short HEAD`
|
25
|
30
|
if [ "x$BRANCH" == "x" ] ; then
|
26
|
31
|
BRANCH=""
|
|
@@ -29,6 +34,7 @@ echo "" >>"$OUTFILE"
|
29
|
34
|
else
|
30
|
35
|
BRANCH=" $BRANCH"
|
31
|
36
|
fi
|
|
37
|
+
|
32
|
38
|
VERSION=`git describe --tags --first-parent 2>/dev/null`
|
33
|
39
|
if [ "x$VERSION" != "x" ] ; then
|
34
|
40
|
echo "#define SHORT_BUILD_VERSION \"$VERSION\"" | sed "s/-.*/$BRANCH\"/" >>"$OUTFILE"
|
|
@@ -38,8 +44,4 @@ echo "" >>"$OUTFILE"
|
38
|
44
|
echo "#define SHORT_BUILD_VERSION \"$BRANCH\"" >>"$OUTFILE"
|
39
|
45
|
echo "#define DETAILED_BUILD_VERSION \"${BRANCH}-$VERSION\"" >>"$OUTFILE"
|
40
|
46
|
fi
|
41
|
|
- URL=`git config --local --get remote.origin.url | sed "sx.*github.com.xhttps://github.com/x" | sed "sx\.gitx/x"`
|
42
|
|
- if [ "x$URL" != "x" ] ; then
|
43
|
|
- echo "#define SOURCE_CODE_URL \""$URL"\"" >>"$OUTFILE"
|
44
|
|
- fi
|
45
|
47
|
)
|