Logo: Relish

  1. Sign in

Project: Weyland 0.1.0

No options given

Weyland searches for a file named Weylandfile which
defines the build to execute. If it locates such a file,
it will execute the default build action specified by the
file.

Scenarios
A build file with a single package, and no build action
Given
a file named "Weylandfile" with:
Weyland::package do |pkg|
	pkg.name = "test_pkg" 
end
When
I run weyland
Then
the exit status should be 0
And
the output should contain:
Building package test_pkg#any...
A build file with a single package which builds a C Program
Given
a file named "Weylandfile" with:
require 'weyland/c'

Weyland::package do |pkg|
	pkg.name = "test_pkg"
	pkg.c_program "simple", sources: [ 'src/main.c' ]
end 
And
a file named "src/main.c" with:
#include <stdio.h>

int main(int argc, char** argv) {
	printf("Hello, from a simple program built with Weyland!");
}
When
I run weyland
Then
the exit status should be 0
And
the output should contain:
TASK       test_pkg:simple
CC         build/test_pkg/obj/simple/src/main.o
LINK       build/test_pkg/bin/simple
A build file with several C tasks builds all of them
Given
a file named "Weylandfile" with:
require 'weyland/c'

Weyland::package do |pkg|
	pkg.name = "test_pkg"
	pkg.c_staticlib "adder", sources: [ 'src/adder/add.c' ], include_dirs: [ 'include' ], exports: [ :include_dirs ]
	pkg.c_program "simple", sources: [ 'src/simple/main.c' ]
end 
And
a file named "include/adder/add.h" with:
int add(int a, int b);
And
a file named "src/adder/add.c" with:
#include "adder/add.h"

int add(int a, int b) {
	return a + b;
}
And
a file named "src/simple/main.c" with:
#include <stdio.h>

int main(int argc, char** argv) {
	printf("Hello, from a simple program built with Weyland!");
}
When
I run weyland
Then
the exit status should be 0
And
the output should contain:
TASK       test_pkg:simple
CC         build/test_pkg/obj/simple/src/simple/main.o
LINK       build/test_pkg/bin/simple
And
the output should contain:
TASK       test_pkg:adder
CC         build/test_pkg/obj/adder/src/adder/add.o
LINK       build/test_pkg/lib/libadder.a
A build file with a default task and several C tasks builds the default task
Given
a file named "Weylandfile" with:
require 'weyland/c'

Weyland::package do |pkg|
	pkg.name = "test_pkg"
	pkg.c_staticlib "adder", sources: [ 'src/adder/add.c' ], include_dirs: [ 'include' ], exports: [ :include_dirs ]
	pkg.c_program "simple", sources: [ 'src/simple/main.c' ]

	pkg.default_task = "adder"
end 
And
a file named "include/adder/add.h" with:
int add(int a, int b);
And
a file named "src/adder/add.c" with:
#include "adder/add.h"

int add(int a, int b) {
	return a + b;
}
And
a file named "src/simple/main.c" with:
#include <stdio.h>

int main(int argc, char** argv) {
	printf("Hello, from a simple program built with Weyland!");
}
When
I run weyland
Then
the exit status should be 0
And
the output should not contain:
TASK       test_pkg:simple
CC         build/test_pkg/obj/simple/src/simple/main.o
LINK       build/test_pkg/bin/simple
And
the output should contain:
TASK       test_pkg:adder
CC         build/test_pkg/obj/adder/src/adder/add.o
LINK       build/test_pkg/lib/libadder.a

Last published over 5 years ago by smkell.