Skip to content

Commit

Permalink
Drop support for 0.6, update for 0.7, update CI scripts (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoolen authored and ararslan committed Aug 11, 2018
1 parent ffd0b77 commit d217d34
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 47 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -3,8 +3,8 @@ os:
- linux
- osx
julia:
- 0.6
- 0.7
- 1.0
- nightly
notifications:
email: false
Expand All @@ -17,6 +17,6 @@ matrix:

after_success:
# push coverage results to Coveralls
- julia -e 'cd(Pkg.dir("LightXML")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
- julia --project -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
# push coverage results to Codecov
- julia -e 'cd(Pkg.dir("LightXML")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
- julia --project -e 'import Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
3 changes: 1 addition & 2 deletions REQUIRE
@@ -1,3 +1,2 @@
julia 0.6
julia 0.7
BinaryProvider 0.3.0
Compat 0.59
47 changes: 24 additions & 23 deletions appveyor.yml
@@ -1,16 +1,18 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

matrix:
allow_failures:
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 0.7
- julia_version: 1
- julia_version: nightly

platform:
- x86 # 32-bit
- x64 # 64-bit

# # Uncomment the following lines to allow failures on nightly julia
# # (tests will run but not make your overall status red)
# matrix:
# allow_failures:
# - julia_version: latest

branches:
only:
Expand All @@ -24,19 +26,18 @@ notifications:
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"LightXML\"); Pkg.build(\"LightXML\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"LightXML\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"

# # Uncomment to support code coverage upload. Should only be enabled for packages
# # which would have coverage gaps without running on Windows
# on_success:
# - echo "%JL_CODECOV_SCRIPT%"
# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"
3 changes: 0 additions & 3 deletions src/LightXML.jl
@@ -1,9 +1,6 @@
__precompile__()

module LightXML

using Compat

let depsfile = joinpath(@__DIR__, "..", "deps", "deps.jl")
if !isfile(depsfile)
error("LightXML is not properly installed. Run `Pkg.build(\"LightXML\")` and " *
Expand Down
34 changes: 20 additions & 14 deletions src/nodes.jl
Expand Up @@ -95,10 +95,13 @@ struct XMLAttrIter
p::Xptr
end

Base.start(it::XMLAttrIter) = it.p
Base.done(it::XMLAttrIter, p::Xptr) = (p == C_NULL)
Base.next(it::XMLAttrIter, p::Xptr) = (a = XMLAttr(p); (a, a._struct.next))
Compat.IteratorSize(::Type{XMLAttrIter}) = Base.SizeUnknown()
function Base.iterate(it::XMLAttrIter, p::Xptr=it.p)
p == C_NULL && return nothing
a = XMLAttr(p)
(a, a._struct.next)
end

Base.IteratorSize(::Type{XMLAttrIter}) = Base.SizeUnknown()

#######################################
#
Expand Down Expand Up @@ -160,10 +163,13 @@ struct XMLNodeIter
p::Xptr
end

Base.start(it::XMLNodeIter) = it.p
Base.done(it::XMLNodeIter, p::Xptr) = (p == C_NULL)
Base.next(it::XMLNodeIter, p::Xptr) = (nd = XMLNode(p); (nd, nd._struct.next))
Compat.IteratorSize(::Type{XMLNodeIter}) = Base.SizeUnknown()
function Base.iterate(it::XMLNodeIter, p::Xptr=it.p)
p == C_NULL && return nothing
nd = XMLNode(p)
(nd, nd._struct.next)
end

Base.IteratorSize(::Type{XMLNodeIter}) = Base.SizeUnknown()

child_nodes(nd::XMLNode) = XMLNodeIter(nd._struct.children)

Expand Down Expand Up @@ -259,12 +265,12 @@ struct XMLElementIter
parent_ptr::Xptr
end

Base.start(it::XMLElementIter) =
ccall((:xmlFirstElementChild,libxml2), Xptr, (Xptr,), it.parent_ptr)
Base.done(it::XMLElementIter, p::Xptr) = (p == C_NULL)
Base.next(it::XMLElementIter, p::Xptr) =
(XMLElement(p), ccall((:xmlNextElementSibling,libxml2), Xptr, (Xptr,), p))
Compat.IteratorSize(::Type{XMLElementIter}) = Base.SizeUnknown()
function Base.iterate(it::XMLElementIter, p::Xptr=ccall((:xmlFirstElementChild, libxml2), Xptr, (Xptr,), it.parent_ptr))
p == C_NULL && return nothing
XMLElement(p), ccall((:xmlNextElementSibling, libxml2), Xptr, (Xptr,), p)
end

Base.IteratorSize(::Type{XMLElementIter}) = Base.SizeUnknown()

child_elements(x::XMLElement) = XMLElementIter(x.node.ptr)

Expand Down
3 changes: 1 addition & 2 deletions test/runtests.jl
@@ -1,6 +1,5 @@
using LightXML
using Compat
using Compat.Test
using Test

tests = ["parse", "create", "cdata", "pi"]

Expand Down

0 comments on commit d217d34

Please sign in to comment.