newtmgr - Remove newt code
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/commit/e31a7d31 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/tree/e31a7d31 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/diff/e31a7d31 Branch: refs/heads/master Commit: e31a7d31e1ed9a581f1e5e58c64c659cf5dfa2ea Parents: 963e368 Author: Christopher Collins <[email protected]> Authored: Tue Mar 28 15:30:13 2017 -0700 Committer: Christopher Collins <[email protected]> Committed: Tue Mar 28 15:38:36 2017 -0700 ---------------------------------------------------------------------- INSTALLING.md | 83 - README.md | 105 +- RELEASE_NOTES.md | 25 - build.sh | 83 - newt/Godeps/Godeps.json | 69 - newt/Godeps/Readme | 5 - newt/builder/build.go | 755 ----- newt/builder/buildpackage.go | 260 -- newt/builder/buildutil.go | 125 - newt/builder/depgraph.go | 174 -- newt/builder/library.go | 218 -- newt/builder/load.go | 214 -- newt/builder/paths.go | 185 -- newt/builder/selftest.go | 174 -- newt/builder/size.go | 534 ---- newt/builder/size_report.go | 332 --- newt/builder/symbol_tree.go | 195 -- newt/builder/targetbuild.go | 818 ------ newt/cli/build_cmds.go | 478 --- newt/cli/complete_cmd.go | 252 -- newt/cli/image_cmds.go | 95 - newt/cli/mfg_cmds.go | 201 -- newt/cli/pkg_cmds.go | 288 -- newt/cli/project_cmds.go | 259 -- newt/cli/run_cmds.go | 115 - newt/cli/target_cmds.go | 809 ------ newt/cli/util.go | 353 --- newt/cli/vals_cmds.go | 71 - newt/cli/vars.go | 172 -- newt/compat/compat.go | 275 -- newt/downloader/downloader.go | 472 --- newt/flash/flash.go | 421 --- newt/image/image.go | 777 ----- newt/interfaces/interfaces.go | 78 - newt/mfg/create.go | 515 ---- newt/mfg/load.go | 305 -- newt/mfg/meta.go | 247 -- newt/mfg/mfg.go | 96 - newt/mfg/paths.go | 167 -- newt/mfg/read.go | 40 - newt/newt.go | 171 -- newt/newtutil/newtutil.go | 309 -- newt/pkg/bsp_package.go | 183 -- newt/pkg/dependency.go | 89 - newt/pkg/localpackage.go | 463 --- newt/pkg/package.go | 94 - newt/pkg/packageutil.go | 58 - newt/project/pkgwriter.go | 174 -- newt/project/project.go | 719 ----- newt/project/projectstate.go | 109 - newt/repo/repo.go | 757 ----- newt/repo/version.go | 257 -- newt/resolve/resolve.go | 626 ---- newt/resolve/resolveutil.go | 92 - newt/symbol/symbol.go | 322 --- newt/syscfg/restrict.go | 199 -- newt/syscfg/syscfg.go | 1045 ------- newt/sysinit/sysinit.go | 170 -- newt/target/target.go | 293 -- newt/toolchain/compiler.go | 1286 -------- newt/toolchain/deps.go | 452 --- .../github.com/Sirupsen/logrus/.gitignore | 1 - .../github.com/Sirupsen/logrus/.travis.yml | 9 - .../github.com/Sirupsen/logrus/CHANGELOG.md | 66 - newt/vendor/github.com/Sirupsen/logrus/LICENSE | 21 - .../vendor/github.com/Sirupsen/logrus/README.md | 426 --- .../github.com/Sirupsen/logrus/alt_exit.go | 64 - newt/vendor/github.com/Sirupsen/logrus/doc.go | 26 - newt/vendor/github.com/Sirupsen/logrus/entry.go | 275 -- .../github.com/Sirupsen/logrus/exported.go | 193 -- .../github.com/Sirupsen/logrus/formatter.go | 45 - newt/vendor/github.com/Sirupsen/logrus/hooks.go | 34 - .../Sirupsen/logrus/json_formatter.go | 69 - .../vendor/github.com/Sirupsen/logrus/logger.go | 308 -- .../vendor/github.com/Sirupsen/logrus/logrus.go | 143 - .../Sirupsen/logrus/terminal_appengine.go | 8 - .../github.com/Sirupsen/logrus/terminal_bsd.go | 10 - .../Sirupsen/logrus/terminal_linux.go | 14 - .../Sirupsen/logrus/terminal_notwindows.go | 22 - .../Sirupsen/logrus/terminal_solaris.go | 15 - .../Sirupsen/logrus/terminal_windows.go | 27 - .../Sirupsen/logrus/text_formatter.go | 168 -- .../vendor/github.com/Sirupsen/logrus/writer.go | 53 - .../inconshreveable/mousetrap/LICENSE | 13 - .../inconshreveable/mousetrap/README.md | 23 - .../inconshreveable/mousetrap/trap_others.go | 15 - .../inconshreveable/mousetrap/trap_windows.go | 98 - .../mousetrap/trap_windows_1.4.go | 46 - newt/vendor/github.com/kr/pretty/.gitignore | 4 - newt/vendor/github.com/kr/pretty/License | 21 - newt/vendor/github.com/kr/pretty/Readme | 9 - newt/vendor/github.com/kr/pretty/diff.go | 265 -- newt/vendor/github.com/kr/pretty/formatter.go | 328 --- newt/vendor/github.com/kr/pretty/pretty.go | 108 - newt/vendor/github.com/kr/pretty/zero.go | 41 - newt/vendor/github.com/kr/text/License | 19 - newt/vendor/github.com/kr/text/Readme | 3 - newt/vendor/github.com/kr/text/doc.go | 3 - newt/vendor/github.com/kr/text/indent.go | 74 - newt/vendor/github.com/kr/text/wrap.go | 86 - .../mitchellh/mapstructure/.travis.yml | 7 - .../github.com/mitchellh/mapstructure/LICENSE | 21 - .../github.com/mitchellh/mapstructure/README.md | 46 - .../mitchellh/mapstructure/decode_hooks.go | 154 - .../github.com/mitchellh/mapstructure/error.go | 50 - .../mitchellh/mapstructure/mapstructure.go | 782 ----- newt/vendor/github.com/spf13/cast/.gitignore | 25 - newt/vendor/github.com/spf13/cast/LICENSE | 21 - newt/vendor/github.com/spf13/cast/README.md | 72 - newt/vendor/github.com/spf13/cast/cast.go | 83 - newt/vendor/github.com/spf13/cast/caste.go | 527 ---- newt/vendor/github.com/spf13/cobra/.gitignore | 36 - newt/vendor/github.com/spf13/cobra/.mailmap | 3 - newt/vendor/github.com/spf13/cobra/.travis.yml | 24 - newt/vendor/github.com/spf13/cobra/LICENSE.txt | 174 -- newt/vendor/github.com/spf13/cobra/README.md | 898 ------ .../github.com/spf13/cobra/bash_completions.go | 641 ---- .../github.com/spf13/cobra/bash_completions.md | 206 -- newt/vendor/github.com/spf13/cobra/cobra.go | 173 -- newt/vendor/github.com/spf13/cobra/command.go | 1291 --------- .../github.com/spf13/cobra/command_notwin.go | 5 - .../github.com/spf13/cobra/command_win.go | 26 - .../spf13/jwalterweatherman/.gitignore | 22 - .../github.com/spf13/jwalterweatherman/LICENSE | 21 - .../spf13/jwalterweatherman/README.md | 161 -- .../thatswhyyoualwaysleaveanote.go | 256 -- newt/vendor/github.com/spf13/pflag/.travis.yml | 20 - newt/vendor/github.com/spf13/pflag/LICENSE | 28 - newt/vendor/github.com/spf13/pflag/README.md | 275 -- newt/vendor/github.com/spf13/pflag/bool.go | 94 - newt/vendor/github.com/spf13/pflag/count.go | 94 - newt/vendor/github.com/spf13/pflag/duration.go | 86 - newt/vendor/github.com/spf13/pflag/flag.go | 947 ------ newt/vendor/github.com/spf13/pflag/float32.go | 88 - newt/vendor/github.com/spf13/pflag/float64.go | 84 - .../vendor/github.com/spf13/pflag/golangflag.go | 104 - newt/vendor/github.com/spf13/pflag/int.go | 84 - newt/vendor/github.com/spf13/pflag/int32.go | 88 - newt/vendor/github.com/spf13/pflag/int64.go | 84 - newt/vendor/github.com/spf13/pflag/int8.go | 88 - newt/vendor/github.com/spf13/pflag/int_slice.go | 128 - newt/vendor/github.com/spf13/pflag/ip.go | 96 - newt/vendor/github.com/spf13/pflag/ipmask.go | 122 - newt/vendor/github.com/spf13/pflag/ipnet.go | 100 - newt/vendor/github.com/spf13/pflag/string.go | 80 - .../github.com/spf13/pflag/string_array.go | 109 - .../github.com/spf13/pflag/string_slice.go | 132 - newt/vendor/github.com/spf13/pflag/uint.go | 88 - newt/vendor/github.com/spf13/pflag/uint16.go | 88 - newt/vendor/github.com/spf13/pflag/uint32.go | 88 - newt/vendor/github.com/spf13/pflag/uint64.go | 88 - newt/vendor/github.com/spf13/pflag/uint8.go | 88 - newt/vendor/golang.org/x/sys/LICENSE | 27 - newt/vendor/golang.org/x/sys/PATENTS | 22 - newt/vendor/golang.org/x/sys/unix/.gitignore | 1 - newt/vendor/golang.org/x/sys/unix/asm.s | 10 - .../golang.org/x/sys/unix/asm_darwin_386.s | 29 - .../golang.org/x/sys/unix/asm_darwin_amd64.s | 29 - .../golang.org/x/sys/unix/asm_darwin_arm.s | 30 - .../golang.org/x/sys/unix/asm_darwin_arm64.s | 30 - .../golang.org/x/sys/unix/asm_dragonfly_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_386.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_linux_386.s | 35 - .../golang.org/x/sys/unix/asm_linux_amd64.s | 29 - .../golang.org/x/sys/unix/asm_linux_arm.s | 29 - .../golang.org/x/sys/unix/asm_linux_arm64.s | 24 - .../golang.org/x/sys/unix/asm_linux_mips64x.s | 28 - .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 28 - .../golang.org/x/sys/unix/asm_linux_s390x.s | 28 - .../golang.org/x/sys/unix/asm_netbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_netbsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_netbsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_solaris_amd64.s | 17 - .../golang.org/x/sys/unix/bluetooth_linux.go | 35 - newt/vendor/golang.org/x/sys/unix/constants.go | 13 - newt/vendor/golang.org/x/sys/unix/env_unix.go | 27 - newt/vendor/golang.org/x/sys/unix/env_unset.go | 14 - newt/vendor/golang.org/x/sys/unix/flock.go | 24 - .../golang.org/x/sys/unix/flock_linux_32bit.go | 13 - newt/vendor/golang.org/x/sys/unix/gccgo.go | 46 - newt/vendor/golang.org/x/sys/unix/gccgo_c.c | 41 - .../golang.org/x/sys/unix/gccgo_linux_amd64.go | 20 - .../x/sys/unix/gccgo_linux_sparc64.go | 20 - newt/vendor/golang.org/x/sys/unix/mkall.sh | 292 -- newt/vendor/golang.org/x/sys/unix/mkerrors.sh | 483 ---- newt/vendor/golang.org/x/sys/unix/mkpost.go | 62 - newt/vendor/golang.org/x/sys/unix/mksyscall.pl | 323 --- .../golang.org/x/sys/unix/mksyscall_solaris.pl | 294 -- .../golang.org/x/sys/unix/mksysctl_openbsd.pl | 264 -- .../golang.org/x/sys/unix/mksysnum_darwin.pl | 39 - .../golang.org/x/sys/unix/mksysnum_dragonfly.pl | 50 - .../golang.org/x/sys/unix/mksysnum_freebsd.pl | 63 - .../golang.org/x/sys/unix/mksysnum_linux.pl | 58 - .../golang.org/x/sys/unix/mksysnum_netbsd.pl | 58 - .../golang.org/x/sys/unix/mksysnum_openbsd.pl | 50 - newt/vendor/golang.org/x/sys/unix/race.go | 30 - newt/vendor/golang.org/x/sys/unix/race0.go | 25 - .../golang.org/x/sys/unix/sockcmsg_linux.go | 36 - .../golang.org/x/sys/unix/sockcmsg_unix.go | 103 - newt/vendor/golang.org/x/sys/unix/str.go | 26 - newt/vendor/golang.org/x/sys/unix/syscall.go | 76 - .../vendor/golang.org/x/sys/unix/syscall_bsd.go | 628 ---- .../golang.org/x/sys/unix/syscall_darwin.go | 511 ---- .../golang.org/x/sys/unix/syscall_darwin_386.go | 77 - .../x/sys/unix/syscall_darwin_amd64.go | 79 - .../golang.org/x/sys/unix/syscall_darwin_arm.go | 71 - .../x/sys/unix/syscall_darwin_arm64.go | 77 - .../golang.org/x/sys/unix/syscall_dragonfly.go | 412 --- .../x/sys/unix/syscall_dragonfly_amd64.go | 61 - .../golang.org/x/sys/unix/syscall_freebsd.go | 683 ----- .../x/sys/unix/syscall_freebsd_386.go | 61 - .../x/sys/unix/syscall_freebsd_amd64.go | 61 - .../x/sys/unix/syscall_freebsd_arm.go | 61 - .../golang.org/x/sys/unix/syscall_linux.go | 1111 ------- .../golang.org/x/sys/unix/syscall_linux_386.go | 399 --- .../x/sys/unix/syscall_linux_amd64.go | 157 - .../golang.org/x/sys/unix/syscall_linux_arm.go | 263 -- .../x/sys/unix/syscall_linux_arm64.go | 190 -- .../x/sys/unix/syscall_linux_mips64x.go | 208 -- .../x/sys/unix/syscall_linux_ppc64x.go | 135 - .../x/sys/unix/syscall_linux_s390x.go | 329 --- .../x/sys/unix/syscall_linux_sparc64.go | 169 -- .../golang.org/x/sys/unix/syscall_netbsd.go | 492 ---- .../golang.org/x/sys/unix/syscall_netbsd_386.go | 42 - .../x/sys/unix/syscall_netbsd_amd64.go | 42 - .../golang.org/x/sys/unix/syscall_netbsd_arm.go | 42 - .../golang.org/x/sys/unix/syscall_no_getwd.go | 11 - .../golang.org/x/sys/unix/syscall_openbsd.go | 304 -- .../x/sys/unix/syscall_openbsd_386.go | 42 - .../x/sys/unix/syscall_openbsd_amd64.go | 42 - .../golang.org/x/sys/unix/syscall_solaris.go | 725 ----- .../x/sys/unix/syscall_solaris_amd64.go | 35 - .../golang.org/x/sys/unix/syscall_unix.go | 297 -- .../golang.org/x/sys/unix/types_darwin.go | 250 -- .../golang.org/x/sys/unix/types_dragonfly.go | 242 -- .../golang.org/x/sys/unix/types_freebsd.go | 353 --- .../vendor/golang.org/x/sys/unix/types_linux.go | 457 --- .../golang.org/x/sys/unix/types_netbsd.go | 232 -- .../golang.org/x/sys/unix/types_openbsd.go | 244 -- .../golang.org/x/sys/unix/types_solaris.go | 262 -- .../golang.org/x/sys/unix/zerrors_darwin_386.go | 1576 ---------- .../x/sys/unix/zerrors_darwin_amd64.go | 1576 ---------- .../golang.org/x/sys/unix/zerrors_darwin_arm.go | 1293 --------- .../x/sys/unix/zerrors_darwin_arm64.go | 1576 ---------- .../x/sys/unix/zerrors_dragonfly_amd64.go | 1530 ---------- .../x/sys/unix/zerrors_freebsd_386.go | 1743 ----------- .../x/sys/unix/zerrors_freebsd_amd64.go | 1748 ----------- .../x/sys/unix/zerrors_freebsd_arm.go | 1729 ----------- .../golang.org/x/sys/unix/zerrors_linux_386.go | 1819 ------------ .../x/sys/unix/zerrors_linux_amd64.go | 1820 ------------ .../golang.org/x/sys/unix/zerrors_linux_arm.go | 1743 ----------- .../x/sys/unix/zerrors_linux_arm64.go | 1897 ------------ .../x/sys/unix/zerrors_linux_mips64.go | 1917 ------------ .../x/sys/unix/zerrors_linux_mips64le.go | 1917 ------------ .../x/sys/unix/zerrors_linux_ppc64.go | 1970 ------------- .../x/sys/unix/zerrors_linux_ppc64le.go | 1969 ------------- .../x/sys/unix/zerrors_linux_s390x.go | 2027 ------------- .../x/sys/unix/zerrors_linux_sparc64.go | 2077 ------------- .../golang.org/x/sys/unix/zerrors_netbsd_386.go | 1712 ----------- .../x/sys/unix/zerrors_netbsd_amd64.go | 1702 ----------- .../golang.org/x/sys/unix/zerrors_netbsd_arm.go | 1688 ----------- .../x/sys/unix/zerrors_openbsd_386.go | 1584 ---------- .../x/sys/unix/zerrors_openbsd_amd64.go | 1583 ---------- .../x/sys/unix/zerrors_solaris_amd64.go | 1436 --------- .../x/sys/unix/zsyscall_darwin_386.go | 1427 --------- .../x/sys/unix/zsyscall_darwin_amd64.go | 1443 --------- .../x/sys/unix/zsyscall_darwin_arm.go | 1427 --------- .../x/sys/unix/zsyscall_darwin_arm64.go | 1427 --------- .../x/sys/unix/zsyscall_dragonfly_amd64.go | 1413 --------- .../x/sys/unix/zsyscall_freebsd_386.go | 1665 ----------- .../x/sys/unix/zsyscall_freebsd_amd64.go | 1665 ----------- .../x/sys/unix/zsyscall_freebsd_arm.go | 1665 ----------- .../golang.org/x/sys/unix/zsyscall_linux_386.go | 1671 ----------- .../x/sys/unix/zsyscall_linux_amd64.go | 1865 ------------ .../golang.org/x/sys/unix/zsyscall_linux_arm.go | 1772 ------------ .../x/sys/unix/zsyscall_linux_arm64.go | 1745 ----------- .../x/sys/unix/zsyscall_linux_mips64.go | 1814 ------------ .../x/sys/unix/zsyscall_linux_mips64le.go | 1814 ------------ .../x/sys/unix/zsyscall_linux_ppc64.go | 1876 ------------ .../x/sys/unix/zsyscall_linux_ppc64le.go | 1876 ------------ .../x/sys/unix/zsyscall_linux_s390x.go | 1656 ----------- .../x/sys/unix/zsyscall_linux_sparc64.go | 1845 ------------ .../x/sys/unix/zsyscall_netbsd_386.go | 1327 --------- .../x/sys/unix/zsyscall_netbsd_amd64.go | 1327 --------- .../x/sys/unix/zsyscall_netbsd_arm.go | 1327 --------- .../x/sys/unix/zsyscall_openbsd_386.go | 1387 --------- .../x/sys/unix/zsyscall_openbsd_amd64.go | 1387 --------- .../x/sys/unix/zsyscall_solaris_amd64.go | 1599 ---------- .../golang.org/x/sys/unix/zsysctl_openbsd.go | 270 -- .../golang.org/x/sys/unix/zsysnum_darwin_386.go | 398 --- .../x/sys/unix/zsysnum_darwin_amd64.go | 398 --- .../golang.org/x/sys/unix/zsysnum_darwin_arm.go | 358 --- .../x/sys/unix/zsysnum_darwin_arm64.go | 398 --- .../x/sys/unix/zsysnum_dragonfly_amd64.go | 304 -- .../x/sys/unix/zsysnum_freebsd_386.go | 351 --- .../x/sys/unix/zsysnum_freebsd_amd64.go | 351 --- .../x/sys/unix/zsysnum_freebsd_arm.go | 351 --- .../golang.org/x/sys/unix/zsysnum_linux_386.go | 355 --- .../x/sys/unix/zsysnum_linux_amd64.go | 321 -- .../golang.org/x/sys/unix/zsysnum_linux_arm.go | 356 --- .../x/sys/unix/zsysnum_linux_arm64.go | 272 -- .../x/sys/unix/zsysnum_linux_mips64.go | 327 --- .../x/sys/unix/zsysnum_linux_mips64le.go | 327 --- .../x/sys/unix/zsysnum_linux_ppc64.go | 360 --- .../x/sys/unix/zsysnum_linux_ppc64le.go | 353 --- .../x/sys/unix/zsysnum_linux_s390x.go | 328 --- .../x/sys/unix/zsysnum_linux_sparc64.go | 348 --- .../golang.org/x/sys/unix/zsysnum_netbsd_386.go | 273 -- .../x/sys/unix/zsysnum_netbsd_amd64.go | 273 -- .../golang.org/x/sys/unix/zsysnum_netbsd_arm.go | 273 -- .../x/sys/unix/zsysnum_openbsd_386.go | 207 -- .../x/sys/unix/zsysnum_openbsd_amd64.go | 207 -- .../x/sys/unix/zsysnum_solaris_amd64.go | 13 - .../golang.org/x/sys/unix/ztypes_darwin_386.go | 447 --- .../x/sys/unix/ztypes_darwin_amd64.go | 462 --- .../golang.org/x/sys/unix/ztypes_darwin_arm.go | 449 --- .../x/sys/unix/ztypes_darwin_arm64.go | 457 --- .../x/sys/unix/ztypes_dragonfly_amd64.go | 443 --- .../golang.org/x/sys/unix/ztypes_freebsd_386.go | 502 ---- .../x/sys/unix/ztypes_freebsd_amd64.go | 505 ---- .../golang.org/x/sys/unix/ztypes_freebsd_arm.go | 497 ---- .../golang.org/x/sys/unix/ztypes_linux_386.go | 627 ---- .../golang.org/x/sys/unix/ztypes_linux_amd64.go | 645 ----- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 616 ---- .../golang.org/x/sys/unix/ztypes_linux_arm64.go | 624 ---- .../x/sys/unix/ztypes_linux_mips64.go | 627 ---- .../x/sys/unix/ztypes_linux_mips64le.go | 627 ---- .../golang.org/x/sys/unix/ztypes_linux_ppc64.go | 634 ---- .../x/sys/unix/ztypes_linux_ppc64le.go | 634 ---- .../golang.org/x/sys/unix/ztypes_linux_s390x.go | 649 ----- .../x/sys/unix/ztypes_linux_sparc64.go | 640 ---- .../golang.org/x/sys/unix/ztypes_netbsd_386.go | 396 --- .../x/sys/unix/ztypes_netbsd_amd64.go | 403 --- .../golang.org/x/sys/unix/ztypes_netbsd_arm.go | 401 --- .../golang.org/x/sys/unix/ztypes_openbsd_386.go | 441 --- .../x/sys/unix/ztypes_openbsd_amd64.go | 448 --- .../x/sys/unix/ztypes_solaris_amd64.go | 423 --- newt/vendor/gopkg.in/fsnotify.v1/.editorconfig | 5 - newt/vendor/gopkg.in/fsnotify.v1/.gitignore | 6 - newt/vendor/gopkg.in/fsnotify.v1/.travis.yml | 28 - newt/vendor/gopkg.in/fsnotify.v1/AUTHORS | 46 - newt/vendor/gopkg.in/fsnotify.v1/CHANGELOG.md | 307 -- .../vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md | 77 - newt/vendor/gopkg.in/fsnotify.v1/LICENSE | 28 - newt/vendor/gopkg.in/fsnotify.v1/README.md | 50 - newt/vendor/gopkg.in/fsnotify.v1/fen.go | 37 - newt/vendor/gopkg.in/fsnotify.v1/fsnotify.go | 62 - newt/vendor/gopkg.in/fsnotify.v1/inotify.go | 325 --- .../gopkg.in/fsnotify.v1/inotify_poller.go | 187 -- newt/vendor/gopkg.in/fsnotify.v1/kqueue.go | 503 ---- .../gopkg.in/fsnotify.v1/open_mode_bsd.go | 11 - .../gopkg.in/fsnotify.v1/open_mode_darwin.go | 12 - newt/vendor/gopkg.in/fsnotify.v1/windows.go | 561 ---- newt/vendor/mynewt.apache.org/newt/util/util.go | 621 ---- .../vendor/mynewt.apache.org/newt/viper/LICENSE | 21 - .../mynewt.apache.org/newt/viper/README.md | 620 ---- .../mynewt.apache.org/newt/viper/flags.go | 57 - .../vendor/mynewt.apache.org/newt/viper/util.go | 195 -- .../mynewt.apache.org/newt/viper/viper.go | 1300 --------- newt/vendor/mynewt.apache.org/newt/yaml/apic.go | 767 ----- .../mynewt.apache.org/newt/yaml/decode.go | 308 -- .../mynewt.apache.org/newt/yaml/emitterc.go | 1710 ----------- newt/vendor/mynewt.apache.org/newt/yaml/misc.go | 32 - .../mynewt.apache.org/newt/yaml/parserc.go | 1121 ------- .../mynewt.apache.org/newt/yaml/readerc.go | 419 --- .../mynewt.apache.org/newt/yaml/scannerc.go | 2735 ------------------ newt/vendor/mynewt.apache.org/newt/yaml/shim.go | 42 - .../mynewt.apache.org/newt/yaml/writerc.go | 114 - .../vendor/mynewt.apache.org/newt/yaml/yamlh.go | 754 ----- .../mynewt.apache.org/newt/yaml/yamlprivateh.go | 198 -- newtvm/newtvm.go | 194 -- util/unixchild/unixchild.go | 340 --- util/util.go | 628 ---- viper/LICENSE | 21 - viper/README.md | 620 ---- viper/flags.go | 57 - viper/flags_test.go | 66 - viper/remote/remote.go | 77 - viper/util.go | 195 -- viper/viper.go | 1300 --------- viper/viper_test.go | 783 ----- yaml/apic.go | 767 ----- yaml/decode.go | 308 -- yaml/emitterc.go | 1710 ----------- yaml/misc.go | 32 - yaml/parserc.go | 1121 ------- yaml/readerc.go | 419 --- yaml/scannerc.go | 2735 ------------------ yaml/shim.go | 42 - yaml/writerc.go | 114 - yaml/yamlh.go | 754 ----- yaml/yamlprivateh.go | 198 -- 396 files changed, 1 insertion(+), 170216 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/INSTALLING.md ---------------------------------------------------------------------- diff --git a/INSTALLING.md b/INSTALLING.md deleted file mode 100644 index 0718925..0000000 --- a/INSTALLING.md +++ /dev/null @@ -1,83 +0,0 @@ -# Installing Newt - -There are two methods for the installation of newt, either from source, or -from a binary release. This document contains information on how to do both. - -# Downloading Binary Newt - -Binary releases of newt will be published on the Apache Mynewt website -when available. To find these, please go to https://mynewt.apache.org/. - -# Installing From Source - -The newt tool is written in Go (https://golang.org/). In order to build Apache -Mynewt, you must have Go 1.7 or later installed on your system. Please visit -the Golang website for more information on installing Go (https://golang.org/). - -Once you have Go installed, you can build newt by running the contained -build.sh script. This script will create the newt executable with the -following path, relative to the source directory: - -```no-highlight - newt/newt -``` - -If you do not wish to run the included script, you can build newt manually with Go as follows (executed from the source directory): - -```no-highlight - $ mkdir "$GOPATH"/src/mynewt.apache.org - $ cp -r * "$GOPATH"/src/mynewt.apache.org # Or untar to this path - $ go install mynewt.apache.org/newt/newt -``` - -This puts the newt binary in $GOPATH/bin - -You can test the installation by running newt: - -```no-highlight -$ newt -Newt allows you to create your own embedded application based on the Mynewt -operating system. Newt provides both build and package management in a single -tool, which allows you to compose an embedded application, and set of -projects, and then build the necessary artifacts from those projects. For more -information on the Mynewt operating system, please visit -https://mynewt.apache.org/. - -Please use the newt help command, and specify the name of the command you want -help for, for help on how to use a specific command - -Usage: - newt [flags] - newt [command] - -Examples: - newt - newt help [<command-name>] - For help on <command-name>. If not specified, print this message. - -Available Commands: - version Display the Newt version number. - install Install project dependencies - upgrade Upgrade project dependencies - new Create a new project - info Show project info - target Command for manipulating targets - build Builds one or more apps. - clean Deletes app build artifacts. - test Executes unit tests for one or more packages - load Load built target to board - debug Open debugger session to target - size Size of target components - create-image Add image header to target binary - run build/create-image/download/debug <target> - -Flags: - -h, --help help for newt - -l, --loglevel string Log level, defaults to WARN. (default "WARN") - -o, --outfile string Filename to tee log output to - -q, --quiet Be quiet; only display error output. - -s, --silent Be silent; don't output anything. - -v, --verbose Enable verbose output when executing commands. - -Use "newt [command] --help" for more information about a command. -``` http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index a61b01d..5c26a1a 100644 --- a/README.md +++ b/README.md @@ -19,107 +19,4 @@ # --> -# Newt - -Apache Newt is a smart build and package management tool, designed for C and C++ -applications in embedded contexts. Newt was developed as a part of the -Apache Mynewt Operating System, more information on Apache Mynewt can be found -at https://mynewt.apache.org/. - -# Features - -Newt is a build system that can read a directory tree, build a dependency tree, and emit the right build artifacts. It then allows you to do the following: - -* Download built target to board -* Generate full flash images -* Download debug images to a target board using a debugger -* Conditionally compile libraries & code based upon build settings -* Generate and download manufacturing flash images - -Newt is also a source management system that allows you to do the following: - -* Create reusable source distributions (called repos) from a collection of code. -* Use third-party components with licenses that are not comptatible with the ASF (Apache Software Foundation) license -* Upgrade repos - - -# How it Works - -When Newt sees a directory tree that contains a "project.yml" file, it recognizes it as the base directory of a project, and automatically builds a package tree. -More information can be found in the "Newt Tool Manual" under Docs at https://mynewt.apache.org/. - - -# Getting Started - -To build Apache Newt, simply run the included build.sh script. For more -information on building and installng Apache Newt, please read -[INSTALLING](/INSTALLING.md) or the documentation on https://mynewt.apache.org/ - -Once you've installed newt, you can get started by creating a new project: - -```no-highlight - $ newt new your_project -``` - -For more information, and a tutorial for getting started, please take a look at -the [Apache Mynewt documentation](https://mynewt.apache.org/os/get_started/introduction/). - - - -# Contributing - -## Introduction - -Anybody who works with Apache Mynewt can be a contributing member of the -community that develops and deploys it. The process of releasing an operating -system for microcontrollers is never done: and we welcome your contributions -to that effort. - -## Pull Requests - -Apache Mynewt welcomes pull request via Github. Discussions are done on Github, -but depending on the topic, can also be relayed to the official Apache Mynewt -developer mailing list [email protected]. - -If you are suggesting a new feature, please email the developer list directly, -with a description of the feature you are planning to work on. - -We do not merge pull requests directly on Github, all PRs will be pulled and -pushed through https://git.apache.org/. - -## Filing Bugs - -Bugs can be filed on the -[Apache Mynewt Bug Tracker](https://issues.apache.org/jira/browse/MYNEWT). - -Where possible, please include a self-contained reproduction case! - -## Feature Requests - -Feature requests should also be filed on the -[Apache Mynewt Bug Tracker](https://issues.apache.org/jira/browse/MYNEWT). -Please introduce it as a ticket type "Wish." - -## Writing Tests - -We love getting newt tests! Apache Mynewt is a huge undertaking, and improving -code coverage is a win for every Apache Mynewt user. - -## Writing Documentation - -Contributing to documentation (in addition to writing tests), is a great way -to get involved with the Apache Mynewt project. - -Pull requests to the apache-mynewt-site repository on Github are the best -way to submit documentation. For more information on contributing to the -documentation, the [FAQ](https://mynewt.apache.org/faq/answers/) has some -more information. - -## Getting Help - -If you are having trouble contributing to Apache Mynewt, or just want to talk -to a human about what you're working on, you can contact us via the -[developers mailing list](mailto:[email protected]). - -Although not a formal channel, you can also find a number of core developers -on the #mynewt channel on Freenode. +# Newtmgr http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/RELEASE_NOTES.md ---------------------------------------------------------------------- diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md deleted file mode 100644 index e92398b..0000000 --- a/RELEASE_NOTES.md +++ /dev/null @@ -1,25 +0,0 @@ -# RELEASE NOTES - -7 March 2017 - Apache Newt v1.0.0 - -For full release notes, please visit the -[Apache Mynewt Wiki](https://cwiki.apache.org/confluence/display/MYNEWT/Release+Notes). - -Apache Newt is the build and package management system for the Apache Mynewt -project. More information on Newt can be found -[here](http://mail-archives.apache.org/mod_mbox/incubator-mynewt-dev/201603.mbox/%3C56E21C13.9050303%40apache.org%3E) - -Apache Mynewt continues to stabilize with each release, and we believe this -release is a further step forward. People who are interested in playing -around, and trying Newt, are encouraged to download and begin evaluating it. - -Future versions will add: - - * More robust package management and versioning - - * Plenty of helper commands for seeing what's installed, what's changed, - and why things failed. - -If working on next-generation build and source package management systems -sounds exciting to you, get in touch, by sending a mail to the Apache Mynewt -Developer's list, [email protected]. http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/build.sh ---------------------------------------------------------------------- diff --git a/build.sh b/build.sh deleted file mode 100755 index 9405e6b..0000000 --- a/build.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -set -e - -### Function to do the task of the non-standard realpath utility. This does -### not expand links, however. -expandpath() { - ( - cd "$1" && pwd - ) -} - -### Ensure >= go1.7 is installed. -go_ver_str="$(go version | cut -d ' ' -f 3)" -go_ver="${go_ver_str#go}" - -oldIFS="$IFS" -IFS='.' -set -- $go_ver -IFS="$oldIFS" -go_maj="$1" -go_min="$2" - -if [ "$go_maj" = "" ] -then - printf "* Error: could not extract go version (version string: %s)\n" \ - "$go_ver_str" - exit 1 -fi - -if [ "$go_min" = "" ] -then - go_min=0 -fi - -if [ ! "$go_maj" -gt 1 ] && [ ! "$go_min" -ge 7 ] -then - printf "* Error: go 1.7 or later is required (detected version: %s)\n" \ - "$go_maj"."$go_min".X - exit 1 -fi - -### Create a temporary go tree in /tmp. -installdir="$(expandpath "$(dirname "$0")")" -godir="$(mktemp -d /tmp/mynewt.XXXXXXXXXX)" -mynewtdir="$godir"/src/mynewt.apache.org -repodir="$mynewtdir"/newt -newtdir="$repodir"/newt -dstfile="$installdir"/newt/newt - -mkdir -p "$mynewtdir" -ln -s "$installdir" "$repodir" - -### Build newt. -( - cd "$newtdir" - - printf "Building newt. This may take a minute...\n" - GOPATH="$godir" GO15VENDOREXPERIMENT=1 go install - - mv "$godir"/bin/newt "$dstfile" - - printf "Successfully built executable: %s\n" "$dstfile" -) - -### Delete the temporary directory. -rm -r "$godir" http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/newt/Godeps/Godeps.json ---------------------------------------------------------------------- diff --git a/newt/Godeps/Godeps.json b/newt/Godeps/Godeps.json deleted file mode 100644 index 32f885b..0000000 --- a/newt/Godeps/Godeps.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "ImportPath": "mynewt.apache.org/newt/newt", - "GoVersion": "go1.6", - "GodepVersion": "v74", - "Deps": [ - { - "ImportPath": "github.com/Sirupsen/logrus", - "Comment": "v0.11.0-10-ga437dfd", - "Rev": "a437dfd2463eaedbec3dfe443e477d3b0a810b3f" - }, - { - "ImportPath": "github.com/inconshreveable/mousetrap", - "Rev": "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" - }, - { - "ImportPath": "github.com/kr/pretty", - "Comment": "go.weekly.2011-12-22-36-gcfb55aa", - "Rev": "cfb55aafdaf3ec08f0db22699ab822c50091b1c4" - }, - { - "ImportPath": "github.com/kr/text", - "Rev": "7cafcd837844e784b526369c9bce262804aebc60" - }, - { - "ImportPath": "github.com/mitchellh/mapstructure", - "Rev": "f3009df150dadf309fdee4a54ed65c124afad715" - }, - { - "ImportPath": "github.com/spf13/cast", - "Rev": "24b6558033ffe202bf42f0f3b870dcc798dd2ba8" - }, - { - "ImportPath": "github.com/spf13/cobra", - "Rev": "9495bc009a56819bdb0ddbc1a373e29c140bc674" - }, - { - "ImportPath": "github.com/spf13/jwalterweatherman", - "Rev": "33c24e77fb80341fe7130ee7c594256ff08ccc46" - }, - { - "ImportPath": "github.com/spf13/pflag", - "Rev": "5ccb023bc27df288a957c5e994cd44fd19619465" - }, - { - "ImportPath": "golang.org/x/sys/unix", - "Rev": "b699b7032584f0953262cb2788a0ca19bb494703" - }, - { - "ImportPath": "gopkg.in/fsnotify.v1", - "Comment": "v1.4.2", - "Rev": "629574ca2a5df945712d3079857300b5e4da0236" - }, - { - "ImportPath": "mynewt.apache.org/newt/util", - "Comment": "pre_sterly_refactor-136-gb93ff7f", - "Rev": "b93ff7f6f8715f92d37ce68c66978f2b9bf20692" - }, - { - "ImportPath": "mynewt.apache.org/newt/viper", - "Comment": "pre_sterly_refactor-136-gb93ff7f", - "Rev": "b93ff7f6f8715f92d37ce68c66978f2b9bf20692" - }, - { - "ImportPath": "mynewt.apache.org/newt/yaml", - "Comment": "pre_sterly_refactor-136-gb93ff7f", - "Rev": "b93ff7f6f8715f92d37ce68c66978f2b9bf20692" - } - ] -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/newt/Godeps/Readme ---------------------------------------------------------------------- diff --git a/newt/Godeps/Readme b/newt/Godeps/Readme deleted file mode 100644 index 4cdaa53..0000000 --- a/newt/Godeps/Readme +++ /dev/null @@ -1,5 +0,0 @@ -This directory tree is generated automatically by godep. - -Please do not edit. - -See https://github.com/tools/godep for more information. http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/newt/builder/build.go ---------------------------------------------------------------------- diff --git a/newt/builder/build.go b/newt/builder/build.go deleted file mode 100644 index d82d9ff..0000000 --- a/newt/builder/build.go +++ /dev/null @@ -1,755 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package builder - -import ( - "fmt" - "os" - "path/filepath" - - log "github.com/Sirupsen/logrus" - - "mynewt.apache.org/newt/newt/image" - "mynewt.apache.org/newt/newt/newtutil" - "mynewt.apache.org/newt/newt/pkg" - "mynewt.apache.org/newt/newt/repo" - "mynewt.apache.org/newt/newt/resolve" - "mynewt.apache.org/newt/newt/symbol" - "mynewt.apache.org/newt/newt/syscfg" - "mynewt.apache.org/newt/newt/target" - "mynewt.apache.org/newt/newt/toolchain" - "mynewt.apache.org/newt/util" -) - -type Builder struct { - PkgMap map[*resolve.ResolvePackage]*BuildPackage - - apiMap map[string]*BuildPackage - appPkg *BuildPackage - bspPkg *BuildPackage - compilerPkg *BuildPackage - targetPkg *BuildPackage - compilerInfo *toolchain.CompilerInfo - targetBuilder *TargetBuilder - cfg syscfg.Cfg - linkerScripts []string - buildName string - linkElf string - injectedSettings map[string]string -} - -func NewBuilder( - t *TargetBuilder, - buildName string, - rpkgs []*resolve.ResolvePackage, - apiMap map[string]*resolve.ResolvePackage, - cfg syscfg.Cfg) (*Builder, error) { - - b := &Builder{ - PkgMap: make(map[*resolve.ResolvePackage]*BuildPackage, len(rpkgs)), - cfg: cfg, - - buildName: buildName, - apiMap: make(map[string]*BuildPackage, len(apiMap)), - linkElf: "", - targetBuilder: t, - injectedSettings: map[string]string{}, - } - - for _, rpkg := range rpkgs { - if _, err := b.addPackage(rpkg); err != nil { - return nil, err - } - } - - // Create a pseudo build package for the generated sysinit code. - if _, err := b.addSysinitBpkg(); err != nil { - return nil, err - } - - for api, rpkg := range apiMap { - bpkg := b.PkgMap[rpkg] - if bpkg == nil { - for _, rpkg := range b.sortedRpkgs() { - log.Debugf(" * %s", rpkg.Lpkg.Name()) - } - return nil, util.FmtNewtError( - "Unexpected unsatisfied API: %s; required by: %s", api, - rpkg.Lpkg.Name()) - } - - b.apiMap[api] = bpkg - } - - return b, nil -} - -func (b *Builder) addPackage(rpkg *resolve.ResolvePackage) ( - *BuildPackage, error) { - - // Don't allow nil entries to the map - if rpkg == nil { - panic("Cannot add nil package builder map") - } - - bpkg := b.PkgMap[rpkg] - if bpkg == nil { - bpkg = NewBuildPackage(rpkg) - - switch bpkg.rpkg.Lpkg.Type() { - case pkg.PACKAGE_TYPE_APP: - if b.appPkg != nil { - return nil, pkgTypeConflictErr(b.appPkg, bpkg) - } - b.appPkg = bpkg - - case pkg.PACKAGE_TYPE_BSP: - if b.bspPkg != nil { - return nil, pkgTypeConflictErr(b.bspPkg, bpkg) - } - b.bspPkg = bpkg - - case pkg.PACKAGE_TYPE_COMPILER: - if b.compilerPkg != nil { - return nil, pkgTypeConflictErr(b.compilerPkg, bpkg) - } - b.compilerPkg = bpkg - - case pkg.PACKAGE_TYPE_TARGET: - if b.targetPkg != nil { - return nil, pkgTypeConflictErr(b.targetPkg, bpkg) - } - b.targetPkg = bpkg - } - - b.PkgMap[rpkg] = bpkg - } - - return bpkg, nil -} - -func pkgTypeConflictErr(p1 *BuildPackage, p2 *BuildPackage) error { - return util.FmtNewtError("Two %s packages in build: %s, %s", - pkg.PackageTypeNames[p1.rpkg.Lpkg.Type()], - p1.rpkg.Lpkg.Name(), - p2.rpkg.Lpkg.Name()) -} - -// Recursively compiles all the .c and .s files in the specified directory. -// Architecture-specific files are also compiled. -func collectCompileEntriesDir(srcDir string, c *toolchain.Compiler, - arch string, ignDirs []string) ([]toolchain.CompilerJob, error) { - - // Quietly succeed if the source directory doesn't exist. - if util.NodeNotExist(srcDir) { - return nil, nil - } - - util.StatusMessage(util.VERBOSITY_VERBOSE, - "Compiling src in base directory: %s\n", srcDir) - - // Start from the source directory. - c.SetSrcDir(srcDir) - - // Ignore architecture-specific source files for now. Use a temporary - // string slice here so that the "arch" directory is not ignored in the - // subsequent architecture-specific compile phase. - ignDirsArch := append(ignDirs, "arch") - - entries := []toolchain.CompilerJob{} - - subEntries, err := c.RecursiveCollectEntries(toolchain.COMPILER_TYPE_C, - ignDirsArch) - if err != nil { - return nil, err - } - entries = append(entries, subEntries...) - - // Compile CPP files - subEntries, err = c.RecursiveCollectEntries(toolchain.COMPILER_TYPE_CPP, - ignDirsArch) - if err != nil { - return nil, err - } - entries = append(entries, subEntries...) - - // Copy in pre-compiled library files - subEntries, err = c.RecursiveCollectEntries( - toolchain.COMPILER_TYPE_ARCHIVE, ignDirsArch) - if err != nil { - return nil, err - } - entries = append(entries, subEntries...) - - archDir := srcDir + "/arch/" + arch + "/" - if util.NodeExist(archDir) { - util.StatusMessage(util.VERBOSITY_VERBOSE, - "Compiling architecture specific src pkgs in directory: %s\n", - archDir) - c.SetSrcDir(archDir) - - // Compile C source. - subEntries, err = c.RecursiveCollectEntries( - toolchain.COMPILER_TYPE_C, ignDirs) - if err != nil { - return nil, err - } - entries = append(entries, subEntries...) - - // Compile CPP source - subEntries, err = c.RecursiveCollectEntries( - toolchain.COMPILER_TYPE_CPP, ignDirs) - if err != nil { - return nil, err - } - entries = append(entries, subEntries...) - - // Compile assembly source (only architecture-specific). - subEntries, err = c.RecursiveCollectEntries( - toolchain.COMPILER_TYPE_ASM, ignDirs) - if err != nil { - return nil, err - } - entries = append(entries, subEntries...) - - // Copy in pre-compiled library files - subEntries, err = c.RecursiveCollectEntries( - toolchain.COMPILER_TYPE_ARCHIVE, ignDirs) - if err != nil { - return nil, err - } - entries = append(entries, subEntries...) - } - - return entries, nil -} - -func (b *Builder) newCompiler(bpkg *BuildPackage, - dstDir string) (*toolchain.Compiler, error) { - - c, err := b.targetBuilder.NewCompiler(dstDir) - if err != nil { - return nil, err - } - - c.AddInfo(b.compilerInfo) - - if bpkg != nil { - log.Debugf("Generating build flags for package %s", - bpkg.rpkg.Lpkg.FullName()) - ci, err := bpkg.CompilerInfo(b) - if err != nil { - return nil, err - } - c.AddInfo(ci) - } - - return c, nil -} - -func (b *Builder) collectCompileEntriesBpkg(bpkg *BuildPackage) ( - []toolchain.CompilerJob, error) { - - c, err := b.newCompiler(bpkg, b.PkgBinDir(bpkg)) - if err != nil { - return nil, err - } - - srcDirs := []string{} - - if len(bpkg.SourceDirectories) > 0 { - for _, relDir := range bpkg.SourceDirectories { - dir := bpkg.rpkg.Lpkg.BasePath() + "/" + relDir - if util.NodeNotExist(dir) { - return nil, util.NewNewtError(fmt.Sprintf( - "Specified source directory %s, does not exist.", - dir)) - } - srcDirs = append(srcDirs, dir) - } - } else { - srcDir := bpkg.rpkg.Lpkg.BasePath() + "/src" - if util.NodeNotExist(srcDir) { - // Nothing to compile. - return nil, nil - } - - srcDirs = append(srcDirs, srcDir) - } - - entries := []toolchain.CompilerJob{} - for _, dir := range srcDirs { - subEntries, err := collectCompileEntriesDir(dir, c, - b.targetBuilder.bspPkg.Arch, nil) - if err != nil { - return nil, err - } - - entries = append(entries, subEntries...) - } - - return entries, nil -} - -func (b *Builder) createArchive(c *toolchain.Compiler, - bpkg *BuildPackage) error { - - // Create a static library ("archive"). - c.SetSrcDir(bpkg.rpkg.Lpkg.RelativePath()) - archiveFile := b.ArchivePath(bpkg) - if err := c.CompileArchive(archiveFile); err != nil { - return err - } - - return nil -} - -func (b *Builder) RemovePackages(cmn map[string]bool) error { - for pkgName, _ := range cmn { - for lp, bpkg := range b.PkgMap { - if bpkg.rpkg.Lpkg.Name() == pkgName { - delete(b.PkgMap, lp) - } - } - } - return nil -} - -func (b *Builder) ExtractSymbolInfo() (error, *symbol.SymbolMap) { - syms := symbol.NewSymbolMap() - for _, bpkg := range b.PkgMap { - err, sm := b.ParseObjectLibrary(bpkg) - if err == nil { - syms, err = (*syms).Merge(sm) - if err != nil { - return err, nil - } - } - } - return nil, syms -} - -func (b *Builder) link(elfName string, linkerScripts []string, - keepSymbols []string) error { - - c, err := b.newCompiler(b.appPkg, b.FileBinDir(elfName)) - if err != nil { - return err - } - - /* Always used the trimmed archive files. */ - pkgNames := []string{} - - for _, bpkg := range b.PkgMap { - archiveNames, _ := filepath.Glob(b.PkgBinDir(bpkg) + "/*.a") - for i, archiveName := range archiveNames { - archiveNames[i] = filepath.ToSlash(archiveName) - } - pkgNames = append(pkgNames, archiveNames...) - } - - c.LinkerScripts = linkerScripts - err = c.CompileElf(elfName, pkgNames, keepSymbols, b.linkElf) - if err != nil { - return err - } - - return nil -} - -// Populates the builder with all the packages that need to be built and -// configures each package's build settings. After this function executes, -// packages are ready to be built. -func (b *Builder) PrepBuild() error { - // Populate the base set of compiler flags. Flags from the following - // packages get applied to every source file: - // * target - // * app (if present) - // * bsp - // * compiler (not added here) - // - // In the case of conflicting flags, the higher priority package's flag - // wins. Package priorities are assigned as follows (highest priority - // first): - // * target - // * app (if present) - // * bsp - // * <library package> - // * compiler - baseCi := toolchain.NewCompilerInfo() - - // Target flags. - log.Debugf("Generating build flags for target %s", - b.targetPkg.rpkg.Lpkg.FullName()) - targetCi, err := b.targetPkg.CompilerInfo(b) - if err != nil { - return err - } - baseCi.AddCompilerInfo(targetCi) - - // App flags. - if b.appPkg != nil { - log.Debugf("Generating build flags for app %s", - b.appPkg.rpkg.Lpkg.FullName()) - appCi, err := b.appPkg.CompilerInfo(b) - if err != nil { - return err - } - - baseCi.AddCompilerInfo(appCi) - } - - // Bsp flags. - log.Debugf("Generating build flags for bsp %s", - b.bspPkg.rpkg.Lpkg.FullName()) - bspCi, err := b.bspPkg.CompilerInfo(b) - if err != nil { - return err - } - - // Define a cpp symbol indicating the BSP architecture, name of the - // BSP and app. - - archName := b.targetBuilder.bspPkg.Arch - bspCi.Cflags = append(bspCi.Cflags, "-DARCH_"+util.CIdentifier(archName)) - bspCi.Cflags = append(bspCi.Cflags, "-DARCH_NAME="+archName+"") - - if b.appPkg != nil { - appName := filepath.Base(b.appPkg.rpkg.Lpkg.Name()) - bspCi.Cflags = append(bspCi.Cflags, "-DAPP_"+util.CIdentifier(appName)) - bspCi.Cflags = append(bspCi.Cflags, "-DAPP_NAME="+appName+"") - } - - bspName := filepath.Base(b.bspPkg.rpkg.Lpkg.Name()) - bspCi.Cflags = append(bspCi.Cflags, "-DBSP_"+util.CIdentifier(bspName)) - bspCi.Cflags = append(bspCi.Cflags, "-DBSP_NAME="+bspName+"") - - baseCi.AddCompilerInfo(bspCi) - - // All packages have access to the generated code header directory. - baseCi.Cflags = append(baseCi.Cflags, - "-I"+GeneratedIncludeDir(b.targetPkg.rpkg.Lpkg.Name())) - - // Note: Compiler flags get added at the end, after the flags for library - // package being built are calculated. - b.compilerInfo = baseCi - - return nil -} - -func (b *Builder) AddCompilerInfo(info *toolchain.CompilerInfo) { - b.compilerInfo.AddCompilerInfo(info) -} - -func (b *Builder) addSysinitBpkg() (*BuildPackage, error) { - lpkg := pkg.NewLocalPackage(b.targetPkg.rpkg.Lpkg.Repo().(*repo.Repo), - GeneratedBaseDir(b.targetPkg.rpkg.Lpkg.Name())) - lpkg.SetName(pkg.ShortName(b.targetPkg.rpkg.Lpkg) + "-sysinit-" + - b.buildName) - lpkg.SetType(pkg.PACKAGE_TYPE_GENERATED) - - rpkg := resolve.NewResolvePkg(lpkg) - return b.addPackage(rpkg) -} - -// Runs build jobs while any remain. On failure, signals the other workers to -// stop via the stop channel. On error, the error object is signaled via the -// results channel. On successful completion, nil is signaled via the results -// channel. -func buildWorker( - id int, - jobs <-chan toolchain.CompilerJob, - stop chan struct{}, - results chan error) { - - // Execute each job until failure or until a stop is signalled. - for { - select { - case s := <-stop: - // Re-enqueue the stop signal for the other routines. - stop <- s - - // Terminate this go routine. - results <- nil - return - - case j := <-jobs: - if err := toolchain.RunJob(j); err != nil { - // Stop the other routines. - stop <- struct{}{} - - // Report the error back to the master thread and terminate. - results <- err - return - } - - default: - // Terminate this go routine. - results <- nil - return - } - } -} - -func (b *Builder) Build() error { - b.CleanArtifacts() - - // Build the packages alphabetically to ensure a consistent order. - bpkgs := b.sortedBuildPackages() - - // Calculate the list of jobs. Each record represents a single file that - // needs to be compiled. - entries := []toolchain.CompilerJob{} - bpkgCompilerMap := map[*BuildPackage]*toolchain.Compiler{} - for _, bpkg := range bpkgs { - subEntries, err := b.collectCompileEntriesBpkg(bpkg) - if err != nil { - return err - } - entries = append(entries, subEntries...) - - if len(subEntries) > 0 { - bpkgCompilerMap[bpkg] = subEntries[0].Compiler - } - } - - // Build each file in parallel. - jobs := make(chan toolchain.CompilerJob, len(entries)) - defer close(jobs) - - stop := make(chan struct{}, newtutil.NewtNumJobs) - defer close(stop) - - errors := make(chan error, newtutil.NewtNumJobs) - defer close(errors) - - for _, entry := range entries { - jobs <- entry - } - - for i := 0; i < newtutil.NewtNumJobs; i++ { - go buildWorker(i, jobs, stop, errors) - } - - var err error - for i := 0; i < newtutil.NewtNumJobs; i++ { - subErr := <-errors - if err == nil && subErr != nil { - err = subErr - } - } - if err != nil { - return err - } - - for _, bpkg := range bpkgs { - c := bpkgCompilerMap[bpkg] - if c != nil { - if err := b.createArchive(c, bpkg); err != nil { - return err - } - } - } - - return nil -} - -func (b *Builder) Link(linkerScripts []string) error { - if err := b.link(b.AppElfPath(), linkerScripts, nil); err != nil { - return err - } - return nil -} - -func (b *Builder) KeepLink( - linkerScripts []string, keepMap *symbol.SymbolMap) error { - - keepSymbols := make([]string, 0) - - if keepMap != nil { - for _, info := range *keepMap { - keepSymbols = append(keepSymbols, info.Name) - } - } - if err := b.link(b.AppElfPath(), linkerScripts, keepSymbols); err != nil { - return err - } - return nil -} - -func (b *Builder) TentativeLink(linkerScripts []string) error { - if err := b.link(b.AppTentativeElfPath(), linkerScripts, nil); err != nil { - return err - } - return nil -} - -func (b *Builder) pkgWithPath(path string) *BuildPackage { - for _, bpkg := range b.PkgMap { - if bpkg.rpkg.Lpkg.BasePath() == path { - return bpkg - } - } - - return nil -} - -func (b *Builder) FetchSymbolMap() (error, *symbol.SymbolMap) { - loaderSm := symbol.NewSymbolMap() - - for _, bpkg := range b.PkgMap { - err, sm := b.ParseObjectLibrary(bpkg) - if err == nil { - util.StatusMessage(util.VERBOSITY_VERBOSE, - "Size of %s Loader Map %d\n", bpkg.rpkg.Lpkg.Name(), len(*sm)) - loaderSm, err = loaderSm.Merge(sm) - if err != nil { - return err, nil - } - } - } - - return nil, loaderSm -} - -func (b *Builder) GetTarget() *target.Target { - return b.targetBuilder.GetTarget() -} - -func (b *Builder) buildRomElf(common *symbol.SymbolMap) error { - // check dependencies on the ROM ELF. This is really dependent on - // all of the .a files, but since we already depend on the loader - // .as to build the initial elf, we only need to check the app .a - c, err := b.targetBuilder.NewCompiler(b.AppElfPath()) - d := toolchain.NewDepTracker(c) - if err != nil { - return err - } - - archNames := []string{} - - // build the set of archive file names - for _, bpkg := range b.PkgMap { - archiveNames, _ := filepath.Glob(b.PkgBinDir(bpkg) + "/*.a") - archNames = append(archNames, archiveNames...) - } - - bld, err := d.RomElfBuildRequired(b.AppLinkerElfPath(), - b.AppElfPath(), archNames) - if err != nil { - return err - } - - if !bld { - return nil - } - - util.StatusMessage(util.VERBOSITY_DEFAULT, - "Generating ROM elf \n") - - /* the linker needs these symbols kept for the split app - * to initialize the loader data and bss */ - common.Add(*symbol.NewElfSymbol("__HeapBase")) - common.Add(*symbol.NewElfSymbol("__bss_start__")) - common.Add(*symbol.NewElfSymbol("__bss_end__")) - common.Add(*symbol.NewElfSymbol("__etext")) - common.Add(*symbol.NewElfSymbol("__data_start__")) - common.Add(*symbol.NewElfSymbol("__data_end__")) - - /* the split app may need this to access interrupts */ - common.Add(*symbol.NewElfSymbol("__vector_tbl_reloc__")) - common.Add(*symbol.NewElfSymbol("__isr_vector")) - - err = b.CopySymbols(common) - if err != nil { - return err - } - - /* These symbols are needed by the split app so it can zero - * bss and copy data from the loader app before it restarts, - * but we have to rename them since it has its own copies of - * these special linker symbols */ - tmp_sm := symbol.NewSymbolMap() - tmp_sm.Add(*symbol.NewElfSymbol("__HeapBase")) - tmp_sm.Add(*symbol.NewElfSymbol("__bss_start__")) - tmp_sm.Add(*symbol.NewElfSymbol("__bss_end__")) - tmp_sm.Add(*symbol.NewElfSymbol("__etext")) - tmp_sm.Add(*symbol.NewElfSymbol("__data_start__")) - tmp_sm.Add(*symbol.NewElfSymbol("__data_end__")) - err = c.RenameSymbols(tmp_sm, b.AppLinkerElfPath(), "_loader") - - if err != nil { - return err - } - return nil -} - -func (b *Builder) CreateImage(version string, - keystr string, keyId uint8, loaderImg *image.Image) (*image.Image, error) { - - img, err := image.NewImage(b.AppBinPath(), b.AppImgPath()) - if err != nil { - return nil, err - } - - err = img.SetVersion(version) - if err != nil { - return nil, err - } - - if keystr != "" { - err = img.SetSigningKey(keystr, keyId) - if err != nil { - return nil, err - } - } - - err = img.Generate(loaderImg) - if err != nil { - return nil, err - } - - util.StatusMessage(util.VERBOSITY_DEFAULT, - "App image succesfully generated: %s\n", img.TargetImg) - - return img, nil -} - -// Deletes files that should never be reused for a subsequent build. This -// list includes: -// <app>.img -// <app>.elf.bin -// manifest.json -func (b *Builder) CleanArtifacts() { - if b.appPkg == nil { - return - } - - paths := []string{ - b.AppImgPath(), - b.AppBinPath(), - b.ManifestPath(), - } - - // Attempt to delete each artifact, ignoring errors. - for _, p := range paths { - os.Remove(p) - } -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/newt/builder/buildpackage.go ---------------------------------------------------------------------- diff --git a/newt/builder/buildpackage.go b/newt/builder/buildpackage.go deleted file mode 100644 index e82566f..0000000 --- a/newt/builder/buildpackage.go +++ /dev/null @@ -1,260 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package builder - -import ( - "os" - "path/filepath" - "regexp" - - "mynewt.apache.org/newt/newt/newtutil" - "mynewt.apache.org/newt/newt/pkg" - "mynewt.apache.org/newt/newt/resolve" - "mynewt.apache.org/newt/newt/syscfg" - "mynewt.apache.org/newt/newt/toolchain" - "mynewt.apache.org/newt/util" -) - -type BuildPackage struct { - rpkg *resolve.ResolvePackage - SourceDirectories []string - ci *toolchain.CompilerInfo -} - -func NewBuildPackage(rpkg *resolve.ResolvePackage) *BuildPackage { - bpkg := &BuildPackage{ - rpkg: rpkg, - } - - return bpkg -} - -// Recursively iterates through an pkg's dependencies, adding each pkg -// encountered to the supplied set. -func (bpkg *BuildPackage) collectDepsAux(b *Builder, - set *map[*BuildPackage]bool) error { - - if (*set)[bpkg] { - return nil - } - - (*set)[bpkg] = true - - for _, dep := range bpkg.rpkg.Deps { - dbpkg := b.PkgMap[dep.Rpkg] - if dbpkg == nil { - return util.FmtNewtError("Package not found %s; required by %s", - dbpkg.rpkg.Lpkg.Name(), bpkg.rpkg.Lpkg.Name()) - } - - if err := dbpkg.collectDepsAux(b, set); err != nil { - return err - } - } - - return nil -} - -// Recursively iterates through an pkg's dependencies. The resulting array -// contains a pointer to each encountered pkg. -func (bpkg *BuildPackage) collectDeps(b *Builder) ([]*BuildPackage, error) { - set := map[*BuildPackage]bool{} - - err := bpkg.collectDepsAux(b, &set) - if err != nil { - return nil, err - } - - arr := []*BuildPackage{} - for p, _ := range set { - arr = append(arr, p) - } - - return arr, nil -} - -// Calculates the include paths exported by the specified pkg and all of -// its recursive dependencies. -func (bpkg *BuildPackage) recursiveIncludePaths( - b *Builder) ([]string, error) { - - deps, err := bpkg.collectDeps(b) - if err != nil { - return nil, err - } - - incls := []string{} - for _, p := range deps { - incls = append(incls, p.publicIncludeDirs(b.targetBuilder.bspPkg)...) - } - - return incls, nil -} - -// Replaces instances of "@<repo-name>" with repo paths. -func expandFlags(flags []string) { - for i, f := range flags { - newFlag, changed := newtutil.ReplaceRepoDesignators(f) - if changed { - flags[i] = newFlag - } - } -} - -func (bpkg *BuildPackage) CompilerInfo( - b *Builder) (*toolchain.CompilerInfo, error) { - - // If this package's compiler info has already been generated, returned the - // cached copy. - if bpkg.ci != nil { - return bpkg.ci, nil - } - - ci := toolchain.NewCompilerInfo() - features := b.cfg.FeaturesForLpkg(bpkg.rpkg.Lpkg) - - // Read each set of flags and expand repo designators ("@<repo-nme>") into - // paths. - ci.Cflags = newtutil.GetStringSliceFeatures(bpkg.rpkg.Lpkg.PkgV, features, - "pkg.cflags") - expandFlags(ci.Cflags) - - ci.Lflags = newtutil.GetStringSliceFeatures(bpkg.rpkg.Lpkg.PkgV, features, - "pkg.lflags") - expandFlags(ci.Lflags) - - ci.Aflags = newtutil.GetStringSliceFeatures(bpkg.rpkg.Lpkg.PkgV, features, - "pkg.aflags") - expandFlags(ci.Aflags) - - // Package-specific injected settings get specified as C flags on the - // command line. - for k, _ := range bpkg.rpkg.Lpkg.InjectedSettings() { - ci.Cflags = append(ci.Cflags, syscfg.FeatureToCflag(k)) - } - - ci.IgnoreFiles = []*regexp.Regexp{} - ignPats := newtutil.GetStringSliceFeatures(bpkg.rpkg.Lpkg.PkgV, - features, "pkg.ign_files") - for _, str := range ignPats { - re, err := regexp.Compile(str) - if err != nil { - return nil, util.NewNewtError( - "Ignore files, unable to compile re: " + err.Error()) - } - ci.IgnoreFiles = append(ci.IgnoreFiles, re) - } - - ci.IgnoreDirs = []*regexp.Regexp{} - ignPats = newtutil.GetStringSliceFeatures(bpkg.rpkg.Lpkg.PkgV, - features, "pkg.ign_dirs") - for _, str := range ignPats { - re, err := regexp.Compile(str) - if err != nil { - return nil, util.NewNewtError( - "Ignore dirs, unable to compile re: " + err.Error()) - } - ci.IgnoreDirs = append(ci.IgnoreDirs, re) - } - - bpkg.SourceDirectories = newtutil.GetStringSliceFeatures( - bpkg.rpkg.Lpkg.PkgV, - features, "pkg.src_dirs") - - includePaths, err := bpkg.recursiveIncludePaths(b) - if err != nil { - return nil, err - } - - ci.Includes = append(bpkg.privateIncludeDirs(b), includePaths...) - bpkg.ci = ci - - return bpkg.ci, nil -} - -func (bpkg *BuildPackage) findSdkIncludes() []string { - sdkDir := bpkg.rpkg.Lpkg.BasePath() + "/src/ext/" - - sdkPathList := []string{} - err := filepath.Walk(sdkDir, - func(path string, info os.FileInfo, err error) error { - if !info.IsDir() { - return nil - } - - sdkPathList = append(sdkPathList, path) - return nil - }) - if err != nil { - return []string{} - } - - return sdkPathList -} - -func (bpkg *BuildPackage) publicIncludeDirs(bspPkg *pkg.BspPackage) []string { - pkgBase := filepath.Base(bpkg.rpkg.Lpkg.Name()) - bp := bpkg.rpkg.Lpkg.BasePath() - - incls := []string{ - bp + "/include", - bp + "/include/" + pkgBase + "/arch/" + bspPkg.Arch, - } - - if bpkg.rpkg.Lpkg.Type() == pkg.PACKAGE_TYPE_SDK { - incls = append(incls, bspPkg.BasePath()+"/include/bsp/") - - sdkIncls := bpkg.findSdkIncludes() - incls = append(incls, sdkIncls...) - } - - return incls -} - -func (bpkg *BuildPackage) privateIncludeDirs(b *Builder) []string { - srcDir := bpkg.rpkg.Lpkg.BasePath() + "/src/" - - incls := []string{} - incls = append(incls, srcDir) - incls = append(incls, srcDir+"/arch/"+b.targetBuilder.bspPkg.Arch) - - switch bpkg.rpkg.Lpkg.Type() { - case pkg.PACKAGE_TYPE_SDK: - // If pkgType == SDK, include all the items in "ext" directly into the - // include path - incls = append(incls, b.bspPkg.rpkg.Lpkg.BasePath()+"/include/bsp/") - - sdkIncls := bpkg.findSdkIncludes() - incls = append(incls, sdkIncls...) - - case pkg.PACKAGE_TYPE_UNITTEST: - // A unittest package gets access to its parent package's private - // includes. - parentPkg := b.testOwner(bpkg) - if parentPkg != nil { - parentIncls := parentPkg.privateIncludeDirs(b) - incls = append(incls, parentIncls...) - } - - default: - } - - return incls -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/newt/builder/buildutil.go ---------------------------------------------------------------------- diff --git a/newt/builder/buildutil.go b/newt/builder/buildutil.go deleted file mode 100644 index 61e5b65..0000000 --- a/newt/builder/buildutil.go +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package builder - -import ( - "bytes" - "sort" - "strings" - - log "github.com/Sirupsen/logrus" - - "mynewt.apache.org/newt/newt/resolve" -) - -func TestTargetName(testPkgName string) string { - return strings.Replace(testPkgName, "/", "_", -1) -} - -func (b *Builder) FeatureString() string { - var buffer bytes.Buffer - - featureMap := b.cfg.Features() - featureSlice := make([]string, 0, len(featureMap)) - for k, _ := range featureMap { - featureSlice = append(featureSlice, k) - } - sort.Strings(featureSlice) - - for i, feature := range featureSlice { - if i != 0 { - buffer.WriteString(" ") - } - - buffer.WriteString(feature) - } - return buffer.String() -} - -type bpkgSorter struct { - bpkgs []*BuildPackage -} - -func (b bpkgSorter) Len() int { - return len(b.bpkgs) -} -func (b bpkgSorter) Swap(i, j int) { - b.bpkgs[i], b.bpkgs[j] = b.bpkgs[j], b.bpkgs[i] -} -func (b bpkgSorter) Less(i, j int) bool { - return b.bpkgs[i].rpkg.Lpkg.Name() < b.bpkgs[j].rpkg.Lpkg.Name() -} - -func (b *Builder) sortedBuildPackages() []*BuildPackage { - sorter := bpkgSorter{ - bpkgs: make([]*BuildPackage, 0, len(b.PkgMap)), - } - - for _, bpkg := range b.PkgMap { - sorter.bpkgs = append(sorter.bpkgs, bpkg) - } - - sort.Sort(sorter) - return sorter.bpkgs -} - -func (b *Builder) sortedRpkgs() []*resolve.ResolvePackage { - bpkgs := b.sortedBuildPackages() - - rpkgs := make([]*resolve.ResolvePackage, len(bpkgs), len(bpkgs)) - for i, bpkg := range bpkgs { - rpkgs[i] = bpkg.rpkg - } - - return rpkgs -} - -func logDepInfo(res *resolve.Resolution) { - // Log API set. - apis := []string{} - for api, _ := range res.ApiMap { - apis = append(apis, api) - } - sort.Strings(apis) - - log.Debugf("API set:") - for _, api := range apis { - rpkg := res.ApiMap[api] - log.Debugf(" * " + api + " (" + rpkg.Lpkg.FullName() + ")") - } - - // Log dependency graph. - dg, err := depGraph(res.MasterSet) - if err != nil { - log.Debugf("Error while constructing dependency graph: %s\n", - err.Error()) - } else { - log.Debugf("%s", DepGraphText(dg)) - } - - // Log reverse dependency graph. - rdg, err := revdepGraph(res.MasterSet) - if err != nil { - log.Debugf("Error while constructing reverse dependency graph: %s\n", - err.Error()) - } else { - log.Debugf("%s", RevdepGraphText(rdg)) - } -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/newt/builder/depgraph.go ---------------------------------------------------------------------- diff --git a/newt/builder/depgraph.go b/newt/builder/depgraph.go deleted file mode 100644 index 6fc8a19..0000000 --- a/newt/builder/depgraph.go +++ /dev/null @@ -1,174 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package builder - -import ( - "bytes" - "fmt" - - "mynewt.apache.org/newt/newt/resolve" -) - -type DepGraph map[*resolve.ResolvePackage][]*resolve.ResolveDep -type graphMap map[*resolve.ResolvePackage]map[*resolve.ResolveDep]struct{} - -func graphMapAdd(gm graphMap, p *resolve.ResolvePackage, c *resolve.ResolveDep) { - dstGraph := gm[p] - if dstGraph == nil { - dstGraph = map[*resolve.ResolveDep]struct{}{} - } - dstGraph[c] = struct{}{} - - gm[p] = dstGraph -} - -func graphMapToDepGraph(gm graphMap) DepGraph { - dg := DepGraph{} - - for parent, childMap := range gm { - dg[parent] = []*resolve.ResolveDep{} - for child, _ := range childMap { - dg[parent] = append(dg[parent], child) - } - resolve.SortResolveDeps(dg[parent]) - } - - return dg -} - -func depGraph(rs *resolve.ResolveSet) (DepGraph, error) { - graph := DepGraph{} - - for _, parent := range rs.Rpkgs { - graph[parent] = []*resolve.ResolveDep{} - - for _, dep := range parent.Deps { - graph[parent] = append(graph[parent], dep) - } - - resolve.SortResolveDeps(graph[parent]) - } - - return graph, nil -} - -func revdepGraph(rs *resolve.ResolveSet) (DepGraph, error) { - graph, err := depGraph(rs) - if err != nil { - return nil, err - } - - revGm := graphMap{} - for parent, children := range graph { - for _, child := range children { - rParent := child.Rpkg - rChild := *child - rChild.Rpkg = parent - - graphMapAdd(revGm, rParent, &rChild) - } - } - - return graphMapToDepGraph(revGm), nil -} - -func depString(dep *resolve.ResolveDep) string { - s := fmt.Sprintf("%s", dep.Rpkg.Lpkg.FullName()) - if dep.Api != "" { - s += fmt.Sprintf("(api:%s)", dep.Api) - } - - return s -} - -func DepGraphText(graph DepGraph) string { - parents := make([]*resolve.ResolvePackage, 0, len(graph)) - for lpkg, _ := range graph { - parents = append(parents, lpkg) - } - parents = resolve.SortResolvePkgs(parents) - - buffer := bytes.NewBufferString("") - - fmt.Fprintf(buffer, "Dependency graph (depender --> [dependees]):") - for _, parent := range parents { - children := resolve.SortResolveDeps(graph[parent]) - fmt.Fprintf(buffer, "\n * %s --> [", parent.Lpkg.FullName()) - for i, child := range children { - if i != 0 { - fmt.Fprintf(buffer, " ") - } - fmt.Fprintf(buffer, "%s", depString(child)) - } - fmt.Fprintf(buffer, "]") - } - - return buffer.String() -} - -func RevdepGraphText(graph DepGraph) string { - parents := make([]*resolve.ResolvePackage, 0, len(graph)) - for lpkg, _ := range graph { - parents = append(parents, lpkg) - } - parents = resolve.SortResolvePkgs(parents) - - buffer := bytes.NewBufferString("") - - fmt.Fprintf(buffer, "Reverse dependency graph (dependee <-- [dependers]):") - for _, parent := range parents { - children := resolve.SortResolveDeps(graph[parent]) - fmt.Fprintf(buffer, "\n * %s <-- [", parent.Lpkg.FullName()) - for i, child := range children { - if i != 0 { - fmt.Fprintf(buffer, " ") - } - fmt.Fprintf(buffer, "%s", depString(child)) - } - fmt.Fprintf(buffer, "]") - } - - return buffer.String() -} - -// Extracts a new dependency graph containing only the specified parents. -// -// @param dg The source graph to filter. -// @param parents The parent nodes to keep. -// -// @return DepGraph Filtered dependency graph. -// []*ResolvePackage Specified packages that were not parents in -// original graph. -func FilterDepGraph(dg DepGraph, parents []*resolve.ResolvePackage) ( - DepGraph, []*resolve.ResolvePackage) { - - newDg := DepGraph{} - - var missing []*resolve.ResolvePackage - for _, p := range parents { - if dg[p] == nil { - missing = append(missing, p) - } else { - newDg[p] = dg[p] - } - } - - return newDg, missing -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/newt/builder/library.go ---------------------------------------------------------------------- diff --git a/newt/builder/library.go b/newt/builder/library.go deleted file mode 100644 index af3c5b8..0000000 --- a/newt/builder/library.go +++ /dev/null @@ -1,218 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* this file parses a library file for the build and returns - * a list of all the symbols with their types and sizes */ - -/* gets an objdump -t and parses into a symbolMap" */ - -package builder - -import ( - "bytes" - "path/filepath" - "regexp" - "strconv" - - "mynewt.apache.org/newt/newt/symbol" - "mynewt.apache.org/newt/util" -) - -/* This is a tricky thing to parse. Right now, I keep all the - * flags together and just store the offset, size, name and flags. -* 00012970 l .bss 00000000 _end -* 00011c60 l .init_array 00000000 __init_array_start -* 00011c60 l .init_array 00000000 __preinit_array_start -* 000084b0 g F .text 00000034 os_arch_start -* 00000000 g .debug_aranges 00000000 __HeapBase -* 00011c88 g O .data 00000008 g_os_task_list -* 000082cc g F .text 0000004c os_idle_task -* 000094e0 g F .text 0000002e .hidden __gnu_uldivmod_helper -* 00000000 g .svc_table 00000000 SVC_Count -* 000125e4 g O .bss 00000004 g_console_is_init -* 00009514 g F .text 0000029c .hidden __divdi3 -* 000085a8 g F .text 00000054 os_eventq_put -* 00000100 O *COM* 00000004 g_idle_task_stack - -*/ -func parseObjectLine(line string, r *regexp.Regexp) (error, *symbol.SymbolInfo) { - - answer := r.FindAllStringSubmatch(line, 11) - - if len(answer) == 0 { - return nil, nil - } - - data := answer[0] - - if len(data) != 6 { - util.StatusMessage(util.VERBOSITY_DEFAULT, - "Not enough content in object file line --- %s", line) - return nil, nil - } - - si := symbol.NewSymbolInfo() - - si.Name = data[5] - - v, err := strconv.ParseUint(data[1], 16, 32) - - if err != nil { - util.StatusMessage(util.VERBOSITY_DEFAULT, - "Could not convert location from object file line --- %s", line) - return nil, nil - } - - si.Loc = int(v) - - v, err = strconv.ParseUint(data[4], 16, 32) - - if err != nil { - util.StatusMessage(util.VERBOSITY_DEFAULT, - "Could not convert size form object file line --- %s", line) - return nil, nil - } - - si.Size = int(v) - si.Code = data[2] - si.Section = data[3] - - /* Common section has length in a different spot. Also, these - * are really global variables so mark them as such */ - if si.IsSection("*COM*") { - si.Size = (*si).Loc - si.Code = "g" + si.Code[1:] - } - - return nil, si -} - -func getParseRexeg() (error, *regexp.Regexp) { - r, err := regexp.Compile("^([0-9A-Fa-f]+)[\t ]+([lgu! ][w ][C ][W ][Ii ][Dd ][FfO ])[\t ]+([^\t\n\f\r ]+)[\t ]+([0-9a-fA-F]+)[\t ]([^\t\n\f\r ]+)") - - if err != nil { - return err, nil - } - - return nil, r -} - -func (b *Builder) ParseObjectLibrary(bp *BuildPackage) ( - error, *symbol.SymbolMap) { - - file := b.ArchivePath(bp) - return b.ParseObjectLibraryFile(bp, file, true) -} - -func (b *Builder) ParseObjectElf(elf_file string) (error, *symbol.SymbolMap) { - return b.ParseObjectLibraryFile(nil, elf_file, false) -} - -func (b *Builder) ParseObjectLibraryFile(bp *BuildPackage, - file string, textDataOnly bool) (error, *symbol.SymbolMap) { - - c, err := b.targetBuilder.NewCompiler(b.AppElfPath()) - - ext := filepath.Ext(file) - - if err != nil { - return err, nil - } - - err, out := c.ParseLibrary(file) - - if err != nil { - return err, nil - } - - sm := symbol.NewSymbolMap() - - buffer := bytes.NewBuffer(out) - - err, r := getParseRexeg() - - if err != nil { - return err, nil - } - - for { - line, err := buffer.ReadString('\n') - if err != nil { - break - } - err, si := parseObjectLine(line, r) - - if err == nil && si != nil { - - /* assign the library */ - if bp != nil { - (*si).Bpkg = bp.rpkg.Lpkg.Name() - } else { - (*si).Bpkg = "elf" - } - - /* discard undefined */ - if (*si).IsSection("*UND*") { - continue - } - - /* discard debug symbols */ - if (*si).IsDebug() { - continue - } - - if (*si).IsFile() { - continue - } - - /* if we are looking for text and data only, do a special check */ - if textDataOnly { - include := (*si).IsSection(".bss") || - (*si).IsSection(".text") || - (*si).IsSection(".data") || - (*si).IsSection("*COM*") || - (*si).IsSection(".rodata") - - if !include { - continue - } - } - - /* add the symbol to the map */ - (*si).Ext = ext - sm.Add(*si) - util.StatusMessage(util.VERBOSITY_VERBOSE, - "Keeping Symbol %s in package %s\n", (*si).Name, (*si).Bpkg) - } - } - - return nil, sm -} - -func (b *Builder) CopySymbols(sm *symbol.SymbolMap) error { - c, err := b.targetBuilder.NewCompiler(b.AppElfPath()) - - if err != nil { - return err - } - - err = c.CopySymbols(b.AppElfPath(), b.AppLinkerElfPath(), sm) - - return err -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/e31a7d31/newt/builder/load.go ---------------------------------------------------------------------- diff --git a/newt/builder/load.go b/newt/builder/load.go deleted file mode 100644 index eb7396e..0000000 --- a/newt/builder/load.go +++ /dev/null @@ -1,214 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package builder - -import ( - "fmt" - "os" - "sort" - "strconv" - "strings" - - "mynewt.apache.org/newt/newt/pkg" - "mynewt.apache.org/newt/newt/project" - "mynewt.apache.org/newt/util" -) - -func (t *TargetBuilder) Load(extraJtagCmd string) error { - - err := t.PrepBuild() - - if err != nil { - return err - } - - if t.LoaderBuilder != nil { - err = t.AppBuilder.Load(1, extraJtagCmd) - if err == nil { - err = t.LoaderBuilder.Load(0, extraJtagCmd) - } - } else { - err = t.AppBuilder.Load(0, extraJtagCmd) - } - - return err -} - -func Load(binBaseName string, bspPkg *pkg.BspPackage, - extraEnvSettings map[string]string) error { - - if bspPkg.DownloadScript == "" { - return nil - } - - bspPath := bspPkg.BasePath() - - sortedKeys := make([]string, 0, len(extraEnvSettings)) - for k, _ := range extraEnvSettings { - sortedKeys = append(sortedKeys, k) - } - sort.Strings(sortedKeys) - - env := []string{} - for _, key := range sortedKeys { - env = append(env, fmt.Sprintf("%s=%s", key, extraEnvSettings[key])) - } - - coreRepo := project.GetProject().FindRepo("apache-mynewt-core") - env = append(env, fmt.Sprintf("CORE_PATH=%s", coreRepo.Path())) - env = append(env, fmt.Sprintf("BSP_PATH=%s", bspPath)) - env = append(env, fmt.Sprintf("BIN_BASENAME=%s", binBaseName)) - - // bspPath, binBaseName are passed in command line for backwards - // compatibility - cmd := []string{ - bspPkg.DownloadScript, - bspPath, - binBaseName, - } - - util.StatusMessage(util.VERBOSITY_VERBOSE, "Load command: %s\n", - strings.Join(cmd, " ")) - if _, err := util.ShellCommand(cmd, env); err != nil { - return err - } - util.StatusMessage(util.VERBOSITY_VERBOSE, "Successfully loaded image.\n") - - return nil -} - -func (b *Builder) Load(imageSlot int, extraJtagCmd string) error { - if b.appPkg == nil { - return util.NewNewtError("app package not specified") - } - - /* Populate the package list and feature sets. */ - err := b.targetBuilder.PrepBuild() - if err != nil { - return err - } - - envSettings := map[string]string{ - "IMAGE_SLOT": strconv.Itoa(imageSlot), - "FEATURES": b.FeatureString(), - } - if extraJtagCmd != "" { - envSettings["EXTRA_JTAG_CMD"] = extraJtagCmd - } - features := b.cfg.Features() - - var flashTargetArea string - if _, ok := features["BOOT_LOADER"]; ok { - envSettings["BOOT_LOADER"] = "1" - - flashTargetArea = "FLASH_AREA_BOOTLOADER" - util.StatusMessage(util.VERBOSITY_DEFAULT, - "Loading bootloader\n") - } else { - if imageSlot == 0 { - flashTargetArea = "FLASH_AREA_IMAGE_0" - } else if imageSlot == 1 { - flashTargetArea = "FLASH_AREA_IMAGE_1" - } - util.StatusMessage(util.VERBOSITY_DEFAULT, - "Loading %s image into slot %d\n", b.buildName, imageSlot+1) - } - - bspPkg := b.targetBuilder.bspPkg - tgtArea := bspPkg.FlashMap.Areas[flashTargetArea] - if tgtArea.Name == "" { - return util.NewNewtError(fmt.Sprintf("No flash target area %s\n", - flashTargetArea)) - } - envSettings["FLASH_OFFSET"] = "0x" + strconv.FormatInt(int64(tgtArea.Offset), 16) - - if err := Load(b.AppBinBasePath(), b.targetBuilder.bspPkg, - envSettings); err != nil { - - return err - } - - util.StatusMessage(util.VERBOSITY_VERBOSE, "Successfully loaded image.\n") - - return nil -} - -func (t *TargetBuilder) Debug(extraJtagCmd string, reset bool, noGDB bool) error { - if err := t.PrepBuild(); err != nil { - return err - } - - if t.LoaderBuilder == nil { - return t.AppBuilder.Debug(extraJtagCmd, reset, noGDB) - } - return t.LoaderBuilder.Debug(extraJtagCmd, reset, noGDB) -} - -func (b *Builder) debugBin(binPath string, extraJtagCmd string, reset bool, - noGDB bool) error { - /* - * Populate the package list and feature sets. - */ - err := b.targetBuilder.PrepBuild() - if err != nil { - return err - } - - bspPath := b.bspPkg.rpkg.Lpkg.BasePath() - binBaseName := binPath - featureString := b.FeatureString() - - coreRepo := project.GetProject().FindRepo("apache-mynewt-core") - envSettings := []string{ - fmt.Sprintf("CORE_PATH=%s", coreRepo.Path()), - fmt.Sprintf("BSP_PATH=%s", bspPath), - fmt.Sprintf("BIN_BASENAME=%s", binBaseName), - fmt.Sprintf("FEATURES=%s", featureString), - } - if extraJtagCmd != "" { - envSettings = append(envSettings, - fmt.Sprintf("EXTRA_JTAG_CMD=%s", extraJtagCmd)) - } - if reset == true { - envSettings = append(envSettings, fmt.Sprintf("RESET=true")) - } - if noGDB == true { - envSettings = append(envSettings, fmt.Sprintf("NO_GDB=1")) - } - - os.Chdir(project.GetProject().Path()) - - // bspPath, binBaseName are passed in command line for backwards - // compatibility - cmdLine := []string{ - b.targetBuilder.bspPkg.DebugScript, bspPath, binBaseName, - } - - fmt.Printf("%s\n", cmdLine) - return util.ShellInteractiveCommand(cmdLine, envSettings) -} - -func (b *Builder) Debug(extraJtagCmd string, reset bool, noGDB bool) error { - if b.appPkg == nil { - return util.NewNewtError("app package not specified") - } - - return b.debugBin(b.AppBinBasePath(), extraJtagCmd, reset, noGDB) -}
