Skip to content

Commit

Permalink
v0.1.14 (#23)
Browse files Browse the repository at this point in the history
* FMIExport redirection

* function for package installation path

* lowercase comparision for package paths
  • Loading branch information
ThummeTo authored May 3, 2023
1 parent dc9234b commit 832d8d6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FMIBuild"
uuid = "226f0e26-6dd6-4589-ada7-1d32f6e1d800"
authors = ["TT <[email protected]>", "LM <[email protected]>"]
version = "0.1.13"
version = "0.1.14"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
29 changes: 29 additions & 0 deletions src/FMIBuild.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ import Dates
# exports
export fmi2Save

# returns the path for a given package name (`nothing` if not installed)
function packagePath(pkg)
path = Base.find_package(pkg)

if isnothing(path)
return nothing
end

splits = splitpath(path)

return joinpath(splits[1:end-2]...)
end

"""
fmi2Save(fmu::FMU2,
fmu_path::String,
Expand Down Expand Up @@ -221,13 +234,29 @@ function fmi2Save(fmu::FMU2, fmu_path::String, fmu_src_file::Union{Nothing, Stri
# installedPkgs = split(String(take!(buf)), "\n")
# installedPkgs = installedPkgs[3:end] # skip header

fmiexportPath = packagePath("FMIExport")

# adding Pkgs
Pkg.activate(merge_dir)
# for pkg in installedPkgs
# pkgname = pkg[14:end]
# Pkg.add(pkgname)
# @info "[Build FMU] > Added `$(pkgname)`"
# end

# redirect FMIExport.jl package (if locally checked out, this is necessary for Github-CI to use the current version from a PR)
if haskey(Pkg.project().dependencies, "FMIExport")
old_fmiexportPath = packagePath("FMIExport")
if lowercase(old_fmiexportPath) == lowercase(fmiexportPath)
@info "[Build FMU] > Most recent version of `FMIExport` already checked out, is `$(fmiexportPath)`."
else
@info "[Build FMU] > Replacing `FMIExport` at `$(old_fmiexportPath)` with the current installation at `$(fmiexportPath)`."
end
Pkg.add(path=fmiexportPath)
else
@info "[Build FMU] > FMU has no dependency on `FMIExport`."
end

Pkg.add("FMICore")
core_version = Pkg.dependencies()[Base.UUID("8af89139-c281-408e-bce2-3005eb87462f")].version
@assert core_version >= v"0.17.0" "Installed FMICore < v0.17.0, this is not supported. Please file an issue on GitHub."
Expand Down

2 comments on commit 832d8d6

@ThummeTo
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/82782

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.14 -m "<description of version>" 832d8d6cadabd6a95de7b54ef9ec1396513f6a6e
git push origin v0.1.14

Please sign in to comment.