File tree Expand file tree Collapse file tree 15 files changed +233
-40
lines changed
x86_64-unknown-linux-musl Expand file tree Collapse file tree 15 files changed +233
-40
lines changed Original file line number Diff line number Diff line change 1
1
cache : cargo
2
2
dist : trusty
3
- env : TARGET=x86_64-unknown-linux-gnu
4
3
language : rust
5
- rust : nightly-2016-09-30
4
+ rust : stable
6
5
services : docker
7
6
sudo : required
8
7
8
+ env :
9
+ global :
10
+ - CRATE_NAME=svd2rust
11
+ - TARGET=x86_64-unknown-linux-gnu
12
+
13
+ matrix :
14
+ include :
15
+ # OSX
16
+ - env : TARGET=i686-apple-darwin
17
+ os : osx
18
+ - env : TARGET=x86_64-apple-darwin
19
+ os : osx
20
+
21
+ # Linux
22
+ - env : TARGET=i686-unknown-linux-gnu
23
+ - env : TARGET=i686-unknown-linux-musl
24
+ - env : TARGET=x86_64-unknown-linux-musl
25
+
26
+ install :
27
+ # `std for cross-compilation
28
+ - curl https://static.rust-lang.org/rustup.sh |
29
+ sh -s -- --add-target=$TARGET --disable-sudo -y --prefix=`rustc --print sysroot`
30
+
9
31
script :
10
32
- cargo generate-lockfile
11
- - sh ci/run-docker.sh $TARGET
33
+ - if [[ $TRAVIS_OS_NAME = linux ]]; then
34
+ sh ci/run-docker.sh $TARGET;
35
+ else
36
+ sh ci/run.sh;
37
+ fi
12
38
# Travis can't cache files that are not readable by "others"
13
39
- chmod -R a+r $HOME/.cargo
14
40
41
+ before_deploy :
42
+ - sh ci/package.sh $TARGET
43
+
44
+ deploy :
45
+ provider : releases
46
+ api_key :
47
+ secure : b+q2Uul+hA1OyFbfWaQTF02xwZNTl5x8uumHkx7eeZZYtrXZh8aKyMgUiCVbcdch+p8r0QqvGYXyHUqtCmeFzLrFiudoleQBojs+0Pbrfnw5PH93k4Bf2snOJu6Sp5xjl5X34C+eM/hT3vIrAmEZCXFwVG7piZsdXWBdvkudz6pit8R2hsa6uxbyCs2lXmS/aWHSygg25DtrP/cezILxwS0VtXwgFOUTn8AQMd4bZeEz6ezTcUuCKEHdC9SUmFiNIwR7rjVzL4+Z7ffOz3TF4UHyTa+DLRM4pIO4L/DH+G2KJ3kw2C/98tLGwyObYChwiKXY1lW+bjauD38rwIMpzbAEAx+oPZQNLwdLXjIk9ZN9K3Dm0yWs5aZC+8O7QiOgxMTA3zQmZJdSRpnHLZJKns8hmxOyVeGr+RlTt+sJXqErgN8yzUSdn918kTbAqvc1x0zb/eC+wAx7ULvgjGmO6AuWZWRVM6SrXoKjANUCH1OdkpFA7T0pZ3Nx4p503234hKFyIoS/sd1I17bcBElP59zdv/NlpBAndxRdzPk/V2W40736xxLdQWgRgTMP95+/AJmsf8orscVag/wOdN4ACmwdAi6YxZB+bO9mMzuLJ8Z9BoudGqzaw3uCxkNNQSn+KJ+MrkhBnct7TnDPuAhy4pAOtmwgW3PTPrxsiNQQw+4=
48
+ file : $CRATE_NAME-$TRAVIS_TAG-$TARGET.*
49
+ # don't delete the target directory
50
+ skip_cleanup : true
51
+ on :
52
+ condition : $TRAVIS_RUST_VERSION = stable
53
+ tags : true
54
+
15
55
branches :
16
56
only :
57
+ # Release tags
58
+ - /^v\d+\.\d+\.\d+.*$/
17
59
- auto
18
60
- try
19
61
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
authors = [" Jorge Aparicio <japaricious@gmail.com>" ]
3
- build = " build.rs"
4
3
name = " svd2rust"
5
4
version = " 0.1.0"
6
5
Original file line number Diff line number Diff line change
1
+ environment :
2
+ global :
3
+ CRATE_NAME : svd2rust
4
+ RUST_VERSION : nightly
5
+ matrix :
6
+ - TARGET : i686-pc-windows-gnu
7
+ - TARGET : i686-pc-windows-msvc
8
+ - TARGET : x86_64-pc-windows-gnu
9
+ - TARGET : x86_64-pc-windows-msvc
10
+
11
+ install :
12
+ - ps : ci\install.ps1
13
+
14
+ build : false
15
+
16
+ test_script :
17
+ - if [%APPVEYOR_REPO_TAG%]==[false] (
18
+ cargo build --target %TARGET%
19
+ ) else (
20
+ cargo rustc --target %TARGET% --release --bin svd2rust -- -C lto
21
+ )
22
+
23
+ before_deploy :
24
+ - ps : ci\package.ps1
25
+
26
+ deploy :
27
+ description : ' Windows release'
28
+ artifact : /.*\.zip/
29
+ auth_token :
30
+ secure : bQ29dEXeNG5VP2hQcWiZ1xsfmkGosteCDNeYu/cXTX4lOeghOp0qANpQXmGfal29
31
+ provider : GitHub
32
+ on :
33
+ RUST_VERSION : nightly
34
+ appveyor_repo_tag : true
35
+
36
+ cache :
37
+ - C:\Users\appveyor\.cargo\registry
38
+ - target
39
+
40
+ branches :
41
+ only :
42
+ # Release tags
43
+ - /^v\d+\.\d+\.\d+.*$/
44
+ - auto
45
+ - try
46
+
47
+ notifications :
48
+ - provider : Email
49
+ on_build_success : false
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ FROM ubuntu:12.04
2
+ RUN apt-get update
3
+ RUN apt-get install -y --no-install-recommends \
4
+ ca-certificates \
5
+ curl \
6
+ gcc-multilib
Original file line number Diff line number Diff line change
1
+ FROM ubuntu:16.04
2
+ RUN apt-get update
3
+ RUN apt-get install -y --no-install-recommends \
4
+ ca-certificates \
5
+ curl \
6
+ gcc-multilib \
7
+ musl-tools
8
+ ENV CARGO_TARGET_I686_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
9
+ CC_i686_unknown_linux_musl=musl-gcc
Original file line number Diff line number Diff line change 1
- FROM ubuntu:16 .04
1
+ FROM ubuntu:12 .04
2
2
RUN apt-get update
3
3
RUN apt-get install -y --no-install-recommends \
4
4
ca-certificates \
Original file line number Diff line number Diff line change
1
+ FROM ubuntu:16.04
2
+ RUN apt-get update
3
+ RUN apt-get install -y --no-install-recommends \
4
+ ca-certificates \
5
+ curl \
6
+ gcc \
7
+ libc6-dev \
8
+ musl-tools
Original file line number Diff line number Diff line change
1
+ $Env: HOST = $Env: TARGET
2
+
3
+ If ($Env: TARGET -Match ' gnu' ) {
4
+ if ($Env: TARGET -Match ' x86_64' ) {
5
+ $Env: PATH += ' ;C:\msys64\mingw64\bin'
6
+ } else {
7
+ $Env: PATH += ' ;C:\msys64\mingw32\bin'
8
+ }
9
+ } ElseIf ($Env: TARGET -Match ' i586' ) {
10
+ $Env: HOST = ' i686-pc-windows-msvc'
11
+ }
12
+
13
+ [Net.ServicePointManager ]::SecurityProtocol = ' Ssl3, Tls, Tls12'
14
+ Start-FileDownload ' https://win.rustup.rs' ' rustup-init.exe'
15
+
16
+ .\rustup- init -- default- host $Env: HOST -- default- toolchain $Env: RUST_VERSION - y
17
+
18
+ $Env: PATH = ' C:\Users\appveyor\.cargo\bin;' + $Env: PATH
19
+
20
+ If ($Env: TARGET -ne $Env: HOST ) {
21
+ rustup target add $Env: TARGET
22
+ }
23
+
24
+ rustc - Vv
25
+
26
+ cargo - V
Original file line number Diff line number Diff line change
1
+ $SRC_DIR = $PWD.Path
2
+ $STAGE = [System.Guid ]::NewGuid().ToString()
3
+
4
+ Set-Location $ENV: Temp
5
+ New-Item - Type Directory - Name $STAGE
6
+ Set-Location $STAGE
7
+
8
+ $ZIP = " $SRC_DIR \$ ( $Env: CRATE_NAME ) -$ ( $Env: APPVEYOR_REPO_TAG_NAME ) -$ ( $Env: TARGET ) .zip"
9
+ Copy-Item " $SRC_DIR \target\$ ( $Env: TARGET ) \release\svd2rust.exe" ' .\'
10
+ 7z a " $ZIP " *
11
+
12
+ Push-AppveyorArtifact " $ZIP "
13
+
14
+ Remove-Item * .* - Force
15
+ Set-Location ..
16
+ Remove-Item $STAGE
17
+ Set-Location $SRC_DIR
Original file line number Diff line number Diff line change
1
+ set -ex
2
+
3
+ run () {
4
+ local src_dir=$( pwd) \
5
+ stage=$( mk_temp_dir)
6
+
7
+ cp target/$TARGET /release/svd2rust $stage /
8
+
9
+ cd $stage
10
+ tar czf $src_dir /$CRATE_NAME -$TRAVIS_TAG -$TARGET .tar.gz *
11
+ cd $src_dir
12
+
13
+ rm -rf $stage
14
+ }
15
+
16
+ mk_temp_dir () {
17
+ case $TRAVIS_OS_NAME in
18
+ linux)
19
+ mktemp -d
20
+ ;;
21
+ osx)
22
+ mktemp -d -t tmp
23
+ ;;
24
+ esac
25
+ }
26
+
27
+ run
Original file line number Diff line number Diff line change 1
1
set -ex
2
2
3
3
run () {
4
- local target=$1
5
-
6
- echo $target
7
-
8
4
# This directory needs to exist before calling docker, otherwise docker will create it but it
9
5
# will be owned by root
10
6
mkdir -p target
11
7
12
- docker build -t $target ci/docker/$target
8
+ docker build -t $1 ci/docker/$1
13
9
docker run \
14
10
--rm \
15
11
--user $( id -u) :$( id -g) \
16
12
-e CARGO_HOME=/cargo \
17
13
-e CARGO_TARGET_DIR=/target \
18
- -e HOME=/tmp \
14
+ -e TARGET=$1 \
15
+ -e TRAVIS_OS_NAME=linux \
16
+ -e TRAVIS_RUST_VERSION=$TRAVIS_RUST_VERSION \
17
+ -e TRAVIS_TAG=$TRAVIS_TAG \
18
+ -e USER=$USER \
19
19
-v $HOME /.cargo:/cargo \
20
20
-v ` pwd` /target:/target \
21
21
-v ` pwd` :/checkout:ro \
22
22
-v ` rustc --print sysroot` :/rust:ro \
23
23
-w /checkout \
24
- -it $target \
25
- sh -c " PATH=\$ PATH:/rust/bin ci/run.sh $target "
24
+ -it $1 \
25
+ sh -c " HOME=/tmp PATH=\$ PATH:/rust/bin ci/run.sh"
26
26
}
27
27
28
28
if [ -z $1 ]; then
Original file line number Diff line number Diff line change 1
1
set -ex
2
2
3
3
test_gen () {
4
- echo ' extern crate volatile_register;' > /tmp/foo /src/lib.rs
5
- cargo run --release -- -i /tmp/ STM32F30x.svd $1 >> /tmp/foo /src/lib.rs
6
- cargo build --manifest-path /tmp/foo /Cargo.toml
4
+ echo ' extern crate volatile_register;' > $td /src/lib.rs
5
+ cargo run $flags --release -- -i $td / STM32F30x.svd $1 >> $td /src/lib.rs
6
+ cargo build $flags --manifest-path $td /Cargo.toml
7
7
}
8
8
9
- main () {
10
- export LD_LIBRARY_PATH=$( rustc --print sysroot) /lib/rustlib/${1} /lib
11
- export USER=rust
9
+ test_mode () {
10
+ # test crate
11
+ cargo init --name foo $td
12
+ echo ' volatile-register = "0.1.0"' >> $td /Cargo.toml
12
13
13
14
curl -L \
14
- https://raw.githubusercontent.com/posborne/cmsis-svd/master /data/STMicro/STM32F30x.svd \
15
- > /tmp /STM32F30x.svd
15
+ https://raw.githubusercontent.com/posborne/cmsis-svd/python-0.4 /data/STMicro/STM32F30x.svd \
16
+ > $td /STM32F30x.svd
16
17
17
18
# test the library
18
- cargo build --release
19
+ cargo build $flags
20
+ cargo build $flags --release
19
21
20
- # test repository
21
- cargo new /tmp/foo
22
- echo ' volatile-register = "0.1.0"' >> /tmp/foo/Cargo.toml
23
-
24
- # test generated code
22
+ # test the generated code
25
23
test_gen
26
24
test_gen dbgmcu
27
25
test_gen gpioa
@@ -31,4 +29,27 @@ main() {
31
29
test_gen tim6
32
30
}
33
31
34
- main $1
32
+ deploy_mode () {
33
+ cargo rustc $flags --release --bin svd2rust -- -C lto
34
+ }
35
+
36
+ run () {
37
+ flags=" --target $TARGET "
38
+
39
+ case $TRAVIS_OS_NAME in
40
+ linux)
41
+ td=$( mktemp -d)
42
+ ;;
43
+ osx)
44
+ td=$( mktemp -d -t tmp)
45
+ ;;
46
+ esac
47
+
48
+ if [ -z $TRAVIS_TAG ]; then
49
+ test_mode
50
+ else
51
+ deploy_mode
52
+ fi
53
+ }
54
+
55
+ run
Original file line number Diff line number Diff line change 1
- #![ feature( plugin) ]
2
1
#![ recursion_limit="100" ]
3
2
4
3
extern crate inflections;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ fn main() {
20
20
. arg ( Arg :: with_name ( "peripheral" )
21
21
. help ( "Pattern used to select a single peripheral" )
22
22
. value_name ( "PATTERN" ) )
23
- . version ( include_str ! ( concat! ( env!( "OUT_DIR" ) , "/version.txt" ) ) )
23
+ . version ( env ! ( "CARGO_PKG_VERSION" ) )
24
24
. get_matches ( ) ;
25
25
26
26
let xml = & mut String :: new ( ) ;
You can’t perform that action at this time.
0 commit comments