Skip to content

Commit

Permalink
Fix PR workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRT committed Jan 11, 2024
1 parent fa6f495 commit 28e6957
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 26 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,17 @@ jobs:
cd ../build/lib
tar -czvf ${{matrix.sys.os}}-library.tar.gz *
mv ${{matrix.sys.os}}-library.tar.gz '${{github.workspace}}/'.
- name: Run the testsuite
uses: julia-actions/julia-runtest@v1
- name: Build
# Always use bash to avoid having to escape quotes for Windows
shell: bash
run: julia --compiled-modules=no --color=yes --project -e 'import Pkg; Pkg.Registry.add("General"); Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/JKRT/OpenModelicaRegistry.git")); Pkg.build(;verbose = true);Pkg.instantiate(); Pkg.resolve()'

- name: Test
run: julia --color=yes --project -e 'import Pkg; Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/Absyn.jl.git", rev="master")); Pkg.test("Absyn"); Pkg.test("OMParser")'
with:
version: "1.10.0"

- name: upload library
uses: actions/upload-artifact@v2
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Goal. Make a release workflow so that we can built artificats and use them quickly
name: Manual Release
name: Manual Release

on:
workflow_dispatch:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
with:
update: false
platform-check-severity: warn
install: autoconf automake m4 pkg-config libtool base-devel mingw-w64-x86_64-toolchain
install: java autoconf automake m4 pkg-config libtool base-devel mingw-w64-x86_64-toolchain
path-type: inherit # to find julia!

- name: set git to use LF on Windows
Expand All @@ -53,6 +53,7 @@ jobs:

- name: configure the library and build
run: |
which java
which gcc
gcc --version
cd lib/parser
Expand Down
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ ImmutableList = "4a558cac-c1ed-11e9-20da-3584bcd8709a"
Inflate = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
MetaModelica = "9d7f2a79-07b5-5542-8b19-c0100dda6b06"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
TarIterators = "06456b94-f2fb-4c2e-911f-0795f0d2fb0a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[compat]
julia = "1.10"
[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[targets]
test = ["Test"]
10 changes: 10 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
import ZipFile
import Tar
import Inflate
import Pkg
pkgs = Pkg.installed()

if ! ("MetaModelica" in keys(pkgs))
Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/MetaModelica.jl.git", rev="master"))
end
if ! ("Absyn" in keys(pkgs))
Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/Absyn.jl.git", rev="master"))
Pkg.develop(Pkg.PackageSpec(url="https://github.com/OpenModelica/Absyn.jl.git", rev="master"))
end

function extractTar(libraryString; URL)
@info "Downloading Linux so file..."
Expand Down
28 changes: 15 additions & 13 deletions lib/parser/GenerateJLHeader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,21 @@ Pkg.Registry.add("General")
Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/JKRT/OpenModelicaRegistry.git"));

pkgs = Pkg.installed()
if ! ("MetaModelica" in keys(pkgs))
Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/MetaModelica.jl.git", rev="master"))
end

#= Add the latest Absyn from the master branch but only if Absyn is not installed =#
if ! ("Absyn" in keys(pkgs))
Pkg.add(Pkg.PackageSpec(url="https://github.com/OpenModelica/Absyn.jl.git", rev="master"))
end

if ! ("MetaModelica" in keys(pkgs))
Pkg.add("MetaModelica")
end

if ! ("ImmutableList" in keys(pkgs))
Pkg.add("ImmutableList")
end

Pkg.resolve()

import Absyn

COPYRIGHT_HEADER = "/*
Expand Down Expand Up @@ -157,7 +159,7 @@ end
Generate the program external header for Julia.
@author johti17, based on code by adrpo.
"""
function programExternalHeaderJulia(allDataTypes, moduleName)
function programExternalHeaderJulia(allDataTypes, moduleName)
local buffer = IOBuffer()
println(buffer, COPYRIGHT_HEADER)
println(buffer, "/* Automatically generated header for external MetaModelica functions */")
Expand Down Expand Up @@ -227,7 +229,7 @@ function generateJL_Values(allDataTypes)
println(buffer, funcStr)
println(buffer, valueStr)
end
end
end
String(take!(buffer))
end

Expand Down Expand Up @@ -267,14 +269,14 @@ function generateJL_Asserts(allDataTypes, moduleName)
#= Get <Module>_<Uniontype>_<Record> =#
local qualifiedName = getSuperTypePath(dataType)
#= Get qualified path for basic datatype =#
local baseTypeStr = components[2]
local baseTypeStr = components[2]
local assertStr1 = "assert(($qualifiedName = jl_get_function($(moduleName), \"$(baseTypeStr)\")));"
local assertStr2 = "assert(($(qualifiedName)_type = jl_get_global($(moduleName), jl_symbol(\"$(baseTypeStr)\"))));"
println(buffer, assertStr1)
println(buffer, assertStr2)
#=TODO is the double underscore important?=#
end
end
end
return String(take!(buffer))
end

Expand All @@ -289,12 +291,12 @@ This is followed by a function definition
"""
function generateExternalDeclarations(allSuperTypes)
local buffer = IOBuffer()
println(buffer, "/* Extern declarations */")
println(buffer, "/* Extern declarations */")
for superType in allSuperTypes
local subTypes = subtypes(superType)
local subTypes = subtypes(superType)
local components = split(string(superType), ".")
local qualifiedName = getQualifiedName(components)
if length(components) < 2 #= Some components are to small to include=#
if length(components) < 2 #= Some components are to small to include=#
continue
end
local baseTypeStr = components[2] #= In this case the base type should be the type without the absyn prefix=#
Expand All @@ -305,7 +307,7 @@ function generateExternalDeclarations(allSuperTypes)
for subType in subTypes
local components = split(string(subType), ".")
local qualifiedName = getSuperTypePath(subType)
local baseTypeStr = components[2]
local baseTypeStr = components[2]
local functionName = string("extern jl_function_t *", qualifiedName, ";")
local typeName = string("extern jl_function_t *", qualifiedName, "_type", ";")
println(buffer, functionName)
Expand Down Expand Up @@ -338,7 +340,7 @@ function generateExternalDeclarations(allSuperTypes)
println(buffer, arrayDecl)
println(buffer, returnStmt)
println(buffer, staticFuncEpilog)
end
end
end
println(buffer, "/* End External declarations for the uniontype" * string(superType) * " */")
end
Expand Down
3 changes: 2 additions & 1 deletion src/OMParser.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module OMParser

using MetaModelica

import Absyn, ImmutableList
#= For searching files.. =#
import Glob
using MetaModelica

#import Settings
const INSTALLATION_DIRECTORY_PATH = realpath(realpath(dirname(Base.find_package("OMParser")) * "/../"))
Expand Down
4 changes: 1 addition & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Test

import OMParser
import Pkg
Pkg.instantiate()

@testset "Simple standalone modules" begin

@test true == begin
try
res = OMParser.parseFile("HelloWorld.mo")
Expand Down

0 comments on commit 28e6957

Please sign in to comment.