Commit ba2f3c74 authored by Drew's avatar Drew

Merge remote-tracking branch 'origin/master' into tool_warnings

parents 6c86e64e ea762196
Pipeline #1092 passed with stage
......@@ -9,7 +9,7 @@ linux:
- docker build -t atbuild .
- id=$(docker create atbuild)
- mkdir bin
- docker cp $id:atbuild/.atllbuild/products/atbuild bin/atbuild
- docker cp $id:atbuild/bin/atbuild bin/atbuild
- docker rm -v $id
- docker rmi atbuild
tags:
......@@ -23,9 +23,9 @@ osx:
script:
- export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
- ./bootstrap/build.sh
- .atllbuild/products/atbuild check
- bin/atbuild check
tags:
- openswift
artifacts:
paths:
- .atllbuild/products/atbuild
- bin/atbuild
// Place your settings in this file to overwrite default and user settings.
{
"editor.tabSize": 4,
"editor.insertSpaces": true
}
\ No newline at end of file
# atbuild
[![Anarchy Tools compatible](https://img.shields.io/badge/Anarchy%20Tools-compatible-4BC51D.svg?style=flat)](http://anarchytools.org)
The Anarchy Tools Build Tool.
`atbuild` is a cross-platform build system, primarily for Swift-language projects, following the [Anarchy Tools philosophy](https://github.com/AnarchyTools/AnarchyTools) of simple, unopinionated, hackable tools.
......@@ -89,3 +91,11 @@ Usage:
atbuild [task]
task: ["default", "helloworld", "bootstrap"]
```
# Badges
To declare your project to be compatible with Anarchy Tools, simply
```markdown
[![Anarchy Tools compatible](https://img.shields.io/badge/Anarchy%20Tools-compatible-4BC51D.svg?style=flat)](http://anarchytools.org)
```
Subproject commit 17c1df6f7b55aac1d99ae8759eb0d143a741ff29
Subproject commit 4ec529d30af9db68f59415f0546ed0517eab4dd9
......@@ -23,6 +23,7 @@ import atpkg
*/
final class Shell : Tool {
func run(task: Task) {
setenv("ATBUILD_USER_PATH", userPath(), 1)
guard let script = task["script"]?.string else { fatalError("Invalid 'script' argument to shell tool.") }
do {
let oldPath = NSFileManager.defaultManager().currentDirectoryPath
......
......@@ -13,6 +13,7 @@
// limitations under the License.
import atpkg
import Foundation
/** The builtin tools. */
let tools: [String:Tool] = [
......@@ -38,3 +39,18 @@ func toolByName(name: String) -> Tool {
guard let tool = tools[name] else { fatalError("Unknown build tool \(name)") }
return tool
}
private var userPathCreated = false
/**Returns the "user" path. This is a path that the user may use to store artifacts or for any other purposes. This path is shared for all tasks built as part of the same `atbuild` invocation.
- postcondition: The path exists at this absolute locaton on disk.
- warning: This path is cleared between atbuild invocations. */
func userPath() -> String {
let manager = NSFileManager.defaultManager()
let userPath = manager.currentDirectoryPath + "/user"
if !userPathCreated {
let _ = try? manager.removeItemAtPath(userPath)
try! manager.createDirectoryAtPath(userPath, withIntermediateDirectories: false, attributes: nil)
userPathCreated = true
}
return userPath
}
......@@ -15,10 +15,6 @@
import Foundation
import atpkg
#if os(Linux)
import Glibc //need sleep
#endif
/**The ATllbuild tool builds a swift module via llbuild.
For more information on this tool, see `docs/attllbuild.md` */
final class ATllbuild : Tool {
......@@ -198,6 +194,7 @@ final class ATllbuild : Tool {
case SwiftCPath = "swiftc-path"
case XCTestify = "xctestify"
case XCTestStrict = "xctest-strict"
case IncludeWithUser = "include-with-user"
case PublishProduct = "publish-product"
static var allOptions : [Options] {
......@@ -215,6 +212,7 @@ final class ATllbuild : Tool {
SwiftCPath,
XCTestify,
XCTestStrict,
IncludeWithUser,
PublishProduct
]
}
......@@ -273,6 +271,13 @@ final class ATllbuild : Tool {
compileOptions.append(os)
}
}
if let includePaths = task[Options.IncludeWithUser.rawValue]?.vector {
for path_s in includePaths {
guard let path = path_s.string else { fatalError("Non-string path \(path_s)") }
compileOptions.append("-I")
compileOptions.append(userPath() + "/" + path)
}
}
var linkOptions: [String] = []
if let opts = task[Options.LinkOptions.rawValue]?.vector {
for o in opts {
......
......@@ -26,7 +26,8 @@
:output-type "executable"
:link-with ["attools.a" "atpkg.a"]
:dependencies ["attools" "atpkg.atpkg"]
:publish-product true
:overlays {
:bootstrap-osx {
:bootstrap-only true
......
(package
:name "b"
:tasks {
:second {
:tool "shell"
:script "echo SECOND >> $ATBUILD_USER_PATH/test"
}
}
)
\ No newline at end of file
import Foo
\ No newline at end of file
(package
:name "user_paths"
:import-packages ["b/build.atpkg"]
:tasks {
:first {
:tool "shell"
:script "echo FIRST >> $ATBUILD_USER_PATH/test"
}
:third {
:tool "shell"
:script "echo THIRD >> $ATBUILD_USER_PATH/test"
:dependencies ["first" "b.second"]
}
:compiledep {
:tool "shell"
:script "mkdir $ATBUILD_USER_PATH/Foo && echo module Foo { } > $ATBUILD_USER_PATH/Foo/module.modulemap"
}
:compile {
:tool "atllbuild"
:sources ["bar.swift"]
:include-with-user ["Foo"]
:dependencies ["compiledep"]
:output-type "static-library"
:name "bar"
}
}
)
\ No newline at end of file
......@@ -10,6 +10,22 @@ pwd
echo "****************SELF-HOSTING TEST**************"
$ATBUILD atbuild
echo "****************USER PATH TEST**************"
cd $DIR/tests/fixtures/user_paths
$ATBUILD third
RESULT=`cat user/test`
RESULT2="FIRST
SECOND
THIRD"
if [ "$RESULT" != "$RESULT2" ]; then
echo "Unusual user path concoction $RESULT $RESULT2"
exit 1
fi
$ATBUILD compile
echo "****************PUBLISHPRODUCT TEST**************"
cd $DIR/tests/fixtures/publish_product
$ATBUILD
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment