diff --git a/.ci/SetupDevEnv/src/SetupDevEnv.jl b/.ci/SetupDevEnv/src/SetupDevEnv.jl index c76254d..300a83f 100644 --- a/.ci/SetupDevEnv/src/SetupDevEnv.jl +++ b/.ci/SetupDevEnv/src/SetupDevEnv.jl @@ -513,14 +513,38 @@ function calculate_linear_dependency_ordering( @info "calculate linare ordering to add QED packages" linear_pkg_ordering = Vector{String}() - for init_level in package_dependecy_list + # First we search for the highest level containing a required dependency + # All dependencies in the levels below the highest level needs to be installed + # and there be part of the output. + highest_level = 0 + + for level in 1:length(package_dependecy_list) for required_dep in required_dependencies - if required_dep in init_level - push!(linear_pkg_ordering, required_dep) + if required_dep in package_dependecy_list[level] + highest_level = level end end end + # could not find required dependency + if highest_level == 0 + return linear_pkg_ordering + end + + # copy complete level + for level in 1:(highest_level - 1) + for pkg in package_dependecy_list[level] + push!(linear_pkg_ordering, pkg) + end + end + + # copy only the dependencies from the highest_level, which are required + for pkg in package_dependecy_list[highest_level] + if pkg in required_dependencies + push!(linear_pkg_ordering, pkg) + end + end + with_logger(debuglogger) do @debug "linear ordering of QED packages to add: $(linear_pkg_ordering)" end diff --git a/.ci/SetupDevEnv/test/runtests.jl b/.ci/SetupDevEnv/test/runtests.jl index 485d07b..d95d069 100644 --- a/.ci/SetupDevEnv/test/runtests.jl +++ b/.ci/SetupDevEnv/test/runtests.jl @@ -127,3 +127,66 @@ using Test # end # end end + +@testset "calculate_linear_dependency_ordering()" begin + pkg_dependecy_list = Vector{Set{String}}() + push!(pkg_dependecy_list, Set(["QEDbase"])) + push!(pkg_dependecy_list, Set(["QEDcore"])) + push!(pkg_dependecy_list, Set(["QEDevents", "QEDfields", "QEDprocesses"])) + push!(pkg_dependecy_list, Set(["QuantumElectrodynamics"])) + + # For the real world code, it does not matter what is the ordering of + # entries in a set. + # For the tests it does matter. + # Therefore the current expected behavoir if we create a list from a set + # is, that the output list has the same odering than the input list. + # This behavior is implementation depend and can change + @test [a for a in Set(["QEDevents", "QEDfields", "QEDprocesses"])] == ["QEDevents", "QEDfields", "QEDprocesses"] + + @test SetupDevEnv.calculate_linear_dependency_ordering( + pkg_dependecy_list, ["NotInclude"] + ) == [] + + @test SetupDevEnv.calculate_linear_dependency_ordering( + pkg_dependecy_list, ["QEDbase"] + ) == ["QEDbase"] + @test SetupDevEnv.calculate_linear_dependency_ordering( + pkg_dependecy_list, ["QEDbase", "QEDcore"] + ) == ["QEDbase", "QEDcore"] + + @test SetupDevEnv.calculate_linear_dependency_ordering( + pkg_dependecy_list, ["QEDcore"] + ) == ["QEDbase", "QEDcore"] + + @test SetupDevEnv.calculate_linear_dependency_ordering( + pkg_dependecy_list, ["QEDfields"] + ) == ["QEDbase", "QEDcore", "QEDfields"] + + expected_processes_fields = vcat( + ["QEDbase", "QEDcore"], [a for a in Set(["QEDfields", "QEDprocesses"])] + ) + + @test SetupDevEnv.calculate_linear_dependency_ordering( + pkg_dependecy_list, ["QEDprocesses", "QEDfields"] + ) == expected_processes_fields + + @test SetupDevEnv.calculate_linear_dependency_ordering( + pkg_dependecy_list, ["QEDfields", "QEDprocesses"] + ) == expected_processes_fields + + @test SetupDevEnv.calculate_linear_dependency_ordering( + pkg_dependecy_list, ["QEDcore", "QEDfields"] + ) == ["QEDbase", "QEDcore", "QEDfields"] + + # needs to be constructed from a set, because how a set is iterated is + # implementation depend + expected_QuantumElectrodynamics = vcat( + ["QEDbase", "QEDcore"], + [a for a in Set(["QEDevents", "QEDfields", "QEDprocesses"])], + ["QuantumElectrodynamics"], + ) + + @test SetupDevEnv.calculate_linear_dependency_ordering( + pkg_dependecy_list, ["QuantumElectrodynamics"] + ) == expected_QuantumElectrodynamics +end diff --git a/.github/workflows/BuildDeployDoc.yml b/.github/workflows/BuildDeployDoc.yml index 9a4f334..3506ad2 100644 --- a/.github/workflows/BuildDeployDoc.yml +++ b/.github/workflows/BuildDeployDoc.yml @@ -18,8 +18,8 @@ jobs: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: - version: "1.10" - - name: set dependencies to dev branch version + version: '1.10' + - name: set dev dependencies run: | $(julia --project=. .ci/integTestGen/src/get_project_name_version_path.jl) echo "CI_DEV_PKG_NAME -> $CI_DEV_PKG_NAME" diff --git a/Project.toml b/Project.toml index 902728b..a6971f0 100644 --- a/Project.toml +++ b/Project.toml @@ -1,30 +1,24 @@ name = "QuantumElectrodynamics" uuid = "bb1fba1d-cf9b-41b3-874e-4b81465537b9" -authors = [ - "Uwe Hernandez Acosta ", - "Simeon Ehrig", - "Klaus Steiniger", - "Tom Jungnickel", - "Anton Reinhard", -] +authors = ["Uwe Hernandez Acosta ", "Simeon Ehrig", "Klaus Steiniger", "Tom Jungnickel", "Anton Reinhard"] version = "0.1.0" [deps] -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" QEDbase = "10e22c08-3ccb-4172-bfcf-7d7aa3d04d93" QEDcore = "35dc0263-cb5f-4c33-a114-1d7f54ab753e" QEDevents = "fc3ce04a-5be5-4f3a-acff-eceaab723759" QEDfields = "ac3a6c97-e859-4b9f-96bb-63d2a216042c" QEDprocesses = "46de9c38-1bb3-4547-a1ec-da24d767fdad" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" [compat] -julia = "1.10" -Reexport = "^1.2" -QEDbase = "0.2.2" -QEDcore = "0.1" +QEDbase = "0.3" +QEDcore = "0.2" QEDevents = "0.1" QEDfields = "0.1" QEDprocesses = "0.2" +Reexport = "^1.2" +julia = "1.10" [extras] SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"