Skip to content

Commit

Permalink
fixed afer success script
Browse files Browse the repository at this point in the history
  • Loading branch information
toeb committed Feb 18, 2015
1 parent e656dfb commit 3652136
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
3 changes: 1 addition & 2 deletions build/after_success.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# call this script with cmake -P compile.cmake path/to/target/dir
include("${CMAKE_CURRENT_LIST_DIR}/../cmakepp.cmake")


cmakepp_compile("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/release/cmakepp.cmake")
cmakepp_compile("${CMAKE_CURRENT_SOURCE_DIR}/release/cmakepp.cmake")



8 changes: 8 additions & 0 deletions cmake/collections/list_reverse.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## `(<list ref>)-><void>`
##
## reverses the specified lists elements
macro(list_reverse __list_reverse_lst)
if(${__list_reverse_lst})
list(REVERSE ${__list_reverse_lst})
endif()
endmacro()
2 changes: 1 addition & 1 deletion cmake/core/topsort.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# this function will return nothing if there was a cycle or if no input was given
# else it will return the topological order of the graph
function(topsort get_hash expand)

function_import("${get_hash}" as __topsort_get_hash REDEFINE)
function_import("${expand}" as __topsort_expand REDEFINE)


# visitor function
function(topsort_visit result visited node)
# get hash for current node
Expand Down
41 changes: 28 additions & 13 deletions tests/package/dependency_management_test.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
function(test)

fwrite_data("pkg1/package.cmake" "{dependencies:['./pkg2','./pkg3']}" --json)
fwrite_data("pkg2/package.cmake" "{dependencies:['./pkg3']}" --json)
fwrite_data("pkg1/package.cmake" "{dependencies:[]}" --json)
fwrite_data("pkg2/package.cmake" "{dependencies:[]}" --json)
fwrite_data("pkg3/package.cmake" "{dependencies:[]}" --json)
fwrite_data("pkg4/package.cmake" "{dependencies:[]}" --json)
fwrite_data("pkg5/package.cmake" "{dependencies:[]}" --json)


path_package_source()
Expand All @@ -14,26 +16,33 @@ function(test)
assign(pkg1 = source.push(${path_source} pkg1))
assign(pkg2 = source.push(${path_source} pkg2))
assign(pkg3 = source.push(${path_source} pkg3))
assign(pkg4 = source.push(${path_source} pkg4))
assign(pkg5 = source.push(${path_source} pkg5))

managed_package_source("src" "${test_dir}/target")
ans(sink)

default_package_source()
ans(default_source)

function(resolve_dependencies source)
function(dependency_order source)
function(dependency_hash source dep)
ref_isvalid(${dep})
ans(isref)
if(NOT isref)
assign(dep = source.resolve("${dep}"))
endif()
map_tryget(${dep} uri)
return_ans()
endfunction()
function(dependency_expand source dep)
message(FORMAT "expand {dep.package_descriptor.id}")
ref_isvalid(${dep})
ans(isref)
if(NOT isref)
assign(dep = source.resolve("${dep}"))
endif()
assign(deps = dep.package_descriptor.dependencies)
set(preds)
foreach(dep ${deps})
message("resolving ${dep}")
assign(predecessors = source.resolve("${dep}"))
message("pred ${predecessors}")
list(APPEND preds ${predecessors})
endforeach()
return_ref(preds)
Expand All @@ -48,12 +57,18 @@ function(test)

topsort("${hash}" "${dep}" ${ARGN})
ans(order)
foreach(it ${order})
print_vars(it.package_descriptor.id)
endforeach()
list_reverse(order)
return_ref(order)
endfunction()

resolve_dependencies(${default_source} ${pkg1})
timer_start(t1)
dependency_order(${path_source} ./pkg5 ./pkg1 )
ans(order)
timer_print_elapsed(t1)

foreach(it ${order})
print_vars(it.uri)
endforeach()




Expand Down

0 comments on commit 3652136

Please sign in to comment.