diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..657ee8a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: Publish hjson-java releases on Maven +on: + workflow_dispatch: + release: + types: [released] +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '8' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3 + - name: Publish package + uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 + with: + arguments: publish + env: + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c24d8a0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,19 @@ +name: test +on: [push, pull_request] +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '8' + - run: java -version + - run: ./gradlew -version + - run: ./gradlew test --warning-mode all diff --git a/.gitignore b/.gitignore index ee3c2c8..ca51003 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,15 @@ -.DS_Store -gradle +# Gradle .gradle/ -gradlew -gradle.bat build/ -hjson.iml + +# IntelliJ +*.iml .idea + +# Eclipse +.project +.classpath +.settings/ + +# MacOS +.DS_Store diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6ac8d27..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: java -jdk: -- oraclejdk8 -- oraclejdk7 -env: - global: - secure: -script: -- gradle build -before_deploy: -- cd cli -- gradle zip -- mv build/zip/hjson.zip build/zip/hjson-${TRAVIS_TAG}.zip -- cd .. -deploy: - provider: releases - file: cli/build/zip/hjson-${TRAVIS_TAG}.zip - overwrite: true - skip_cleanup: true - on: - tags: true - jdk: oraclejdk8 - api-key: - secure: WB5LNxdwTPB1qn1/CKW9LkJ5R+LrXOK76vf5JdQsoYqGiu6YsxzDE4sedfJQvUOjl4lhlZkmGVeMjKXKyFIxcCwkfu5cRm8XqutoaRNc8s6ynHhkzhX2GNCTvZoUvF3Idvud6lacHSLn46buDlytOFMC7WzUWNvqrVZkP+XCkYo= diff --git a/README.md b/README.md index 9b1b3bc..13712e7 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # hjson-java -[![Build Status](https://img.shields.io/travis/hjson/hjson-java.svg?style=flat-square)](http://travis-ci.org/hjson/hjson-java) +[![Build Status](https://github.com/hjson/hjson-java/workflows/test/badge.svg)](https://github.com/hjson/hjson-java/actions) [![Maven Central](https://img.shields.io/maven-central/v/org.hjson/hjson.svg?style=flat-square)](http://search.maven.org/#search|ga|1|g%3A%22org.hjson%22%20a%3A%22hjson%22) -[![Javadoc](https://javadoc-emblem.rhcloud.com/doc/org.hjson/hjson/badge.svg?style=flat-square&color=blue)](http://www.javadoc.io/doc/org.hjson/hjson) +[![Javadoc](https://img.shields.io/badge/Javadoc-blue)](http://www.javadoc.io/doc/org.hjson/hjson) -[Hjson](http://hjson.org), the Human JSON. A configuration file format for humans. Relaxed syntax, fewer mistakes, more comments. +[Hjson](https://hjson.github.io), the Human JSON. A configuration file format for humans. Relaxed syntax, fewer mistakes, more comments. -![Hjson Intro](http://hjson.org/hjson1.gif) +![Hjson Intro](https://hjson.github.io/hjson1.gif) ``` { @@ -27,7 +27,7 @@ } ``` -The Java implementation of Hjson is based on [minimal-json](https://github.com/ralfstx/minimal-json). For other platforms see [hjson.org](http://hjson.org). +The Java implementation of Hjson is based on [minimal-json](https://github.com/ralfstx/minimal-json). For other platforms see [hjson.github.io](https://hjson.github.io). # CLI @@ -45,7 +45,7 @@ Add a dependency to your `build.gradle`: ``` dependencies { - compile 'org.hjson:hjson:1.0.0' + compile 'org.hjson:hjson:3.1.0' } ``` @@ -57,7 +57,7 @@ Add a dependency to your `pom.xml`: org.hjson hjson - 1.0.0 + 3.1.0 ``` @@ -67,7 +67,7 @@ Add a dependency to your `ivy.xml`: ```xml - + ``` @@ -172,7 +172,7 @@ jsonObject.toString(); // plain # API -[Documentation](http://hjson.github.io/hjson-java/) +[Documentation](https://hjson.github.io/hjson-java/) # History diff --git a/assets/charset2_result.hjson b/assets/charset2_result.hjson new file mode 100644 index 0000000..e04f07b --- /dev/null +++ b/assets/charset2_result.hjson @@ -0,0 +1,5 @@ +{ + uescape: "\u0000,\u0001,\uffff" + "um\u000blaut": äöüßÄÖÜ + hex: ģ䕧覫췯ꯍ +} \ No newline at end of file diff --git a/assets/charset2_result.json b/assets/charset2_result.json new file mode 100644 index 0000000..7e4c374 --- /dev/null +++ b/assets/charset2_result.json @@ -0,0 +1,5 @@ +{ + "uescape": "\u0000,\u0001,\uffff", + "um\u000blaut": "äöüßÄÖÜ", + "hex": "ģ䕧覫췯ꯍ" +} \ No newline at end of file diff --git a/assets/charset2_test.hjson b/assets/charset2_test.hjson new file mode 100644 index 0000000..41a685d --- /dev/null +++ b/assets/charset2_test.hjson @@ -0,0 +1,5 @@ +{ + uescape: "\u0000,\u0001,\uffff" + "um\u000blaut": äöüßÄÖÜ + hex: "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A" +} \ No newline at end of file diff --git a/assets/comments2_result.hjson b/assets/comments2_result.hjson new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/assets/comments2_result.hjson @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/assets/comments2_result.json b/assets/comments2_result.json new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/assets/comments2_result.json @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/assets/comments2_test.hjson b/assets/comments2_test.hjson new file mode 100644 index 0000000..c573d16 --- /dev/null +++ b/assets/comments2_test.hjson @@ -0,0 +1,3 @@ +// before +/* before2 */ 3 // after1 +// after2 \ No newline at end of file diff --git a/assets/comments3_result.hjson b/assets/comments3_result.hjson new file mode 100644 index 0000000..df7c1b4 --- /dev/null +++ b/assets/comments3_result.hjson @@ -0,0 +1 @@ +a string value // still part of the string \ No newline at end of file diff --git a/assets/comments3_result.json b/assets/comments3_result.json new file mode 100644 index 0000000..c8fc8ca --- /dev/null +++ b/assets/comments3_result.json @@ -0,0 +1 @@ +"a string value // still part of the string" \ No newline at end of file diff --git a/assets/comments3_test.hjson b/assets/comments3_test.hjson new file mode 100644 index 0000000..c09eb46 --- /dev/null +++ b/assets/comments3_test.hjson @@ -0,0 +1,3 @@ +// before +/* before2 */ a string value // still part of the string +// after2 \ No newline at end of file diff --git a/assets/comments4_result.hjson b/assets/comments4_result.hjson new file mode 100644 index 0000000..cf72d01 --- /dev/null +++ b/assets/comments4_result.hjson @@ -0,0 +1,23 @@ +[ + a string value // still part of the string + a string value + {} + {} + {} + [] + {} + { + val5a: 1 + val5b: 2 + } + [] + [] + [] + [] + [ + 1 + 2 + ] + 3 + 4 +] \ No newline at end of file diff --git a/assets/comments4_result.json b/assets/comments4_result.json new file mode 100644 index 0000000..43a35b7 --- /dev/null +++ b/assets/comments4_result.json @@ -0,0 +1,23 @@ +[ + "a string value // still part of the string", + "a string value", + {}, + {}, + {}, + [], + {}, + { + "val5a": 1, + "val5b": 2 + }, + [], + [], + [], + [], + [ + 1, + 2 + ], + 3, + 4 +] \ No newline at end of file diff --git a/assets/comments4_test.hjson b/assets/comments4_test.hjson new file mode 100644 index 0000000..c6a884e --- /dev/null +++ b/assets/comments4_test.hjson @@ -0,0 +1,51 @@ +// before +/* before2 */ [ #before1 + /*key1keycm*/a string value // still part of the string + /* key2keycm */ "a string value" // not part of the string + // map1before + /* map1key */ + {}//map2after + {} + { + // map3 inner comment + } + [] + // map4before + /*map4key*/{ + /* map4inner */ + } // map4after + //map5before + /*map5key*/ { + //map5ab4 + val5a: /* map5akey */ 1, // map5aAfter + val5b: 2 /* map5bb4comma */ , #map5bAfter + #map5extra + } /* map5after */ + // vec1bbefore + /* vec1bkey */ + []//vec1bafter + [] + [ + // vec3 inner comment + ] + // vec4before + /*vec4key*/[ + /* vec4inner */ + ] // vec4after + //vec5before + /*vec5key*/ [ + //vec5ab4 + 1, // vec5aAfter + 2 /* vec5bb4comma */ , #vec5bAfter + #vec5extra + ] /* map5after */ + // before3 + + 3 # after3 + # before4 + /*before4b*/4/*after4*/ + #after4b +] +// after2 + +/* after3 */ \ No newline at end of file diff --git a/assets/comments5_result.hjson b/assets/comments5_result.hjson new file mode 100644 index 0000000..81409f5 --- /dev/null +++ b/assets/comments5_result.hjson @@ -0,0 +1,25 @@ +{ + key1: a string value // still part of the string + key2: a string value + map1: {} + map2: {} + map3: {} + vec1: [] + map4: {} + map5: + { + val5a: 1 + val5b: 2 + } + vec1b: [] + vec2: [] + vec3: [] + vec4: [] + vec5: + [ + 1 + 2 + ] + key3: 3 + key4: 4 +} \ No newline at end of file diff --git a/assets/comments5_result.json b/assets/comments5_result.json new file mode 100644 index 0000000..50b7915 --- /dev/null +++ b/assets/comments5_result.json @@ -0,0 +1,23 @@ +{ + "key1": "a string value // still part of the string", + "key2": "a string value", + "map1": {}, + "map2": {}, + "map3": {}, + "vec1": [], + "map4": {}, + "map5": { + "val5a": 1, + "val5b": 2 + }, + "vec1b": [], + "vec2": [], + "vec3": [], + "vec4": [], + "vec5": [ + 1, + 2 + ], + "key3": 3, + "key4": 4 +} \ No newline at end of file diff --git a/assets/comments5_test.hjson b/assets/comments5_test.hjson new file mode 100644 index 0000000..9d983fb --- /dev/null +++ b/assets/comments5_test.hjson @@ -0,0 +1,51 @@ +// before +/* before2 */ { #before1 + key1:/*key1keycm*/a string value // still part of the string + key2: /* key2keycm */ "a string value" // not part of the string + // map1before + map1: /* map1key */ + {}//map2after + map2: {} + map3: { + // map3 inner comment + } + vec1: [] + // map4before + map4:/*map4key*/{ + /* map4inner */ + } // map4after + //map5before + map5: /*map5key*/ { + //map5ab4 + val5a: /* map5akey */ 1, // map5aAfter + val5b: 2 /* map5bb4comma */ , #map5bAfter + #map5extra + } /* map5after */ + // vec1bbefore + vec1b: /* vec1bkey */ + []//vec1bafter + vec2: [] + vec3: [ + // vec3 inner comment + ] + // vec4before + vec4:/*vec4key*/[ + /* vec4inner */ + ] // vec4after + //vec5before + vec5: /*vec5key*/ [ + //vec5ab4 + 1, // vec5aAfter + 2 /* vec5bb4comma */ , #vec5bAfter + #vec5extra + ] /* map5after */ + // before3 + + key3 : 3 # after3 + # before4 + /*before4b*/key4:4/*after4*/ + #after4b +} +// after2 + +/* after3 */ \ No newline at end of file diff --git a/assets/comments6_result.hjson b/assets/comments6_result.hjson new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/assets/comments6_result.hjson @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/assets/comments6_result.json b/assets/comments6_result.json new file mode 100644 index 0000000..e440e5c --- /dev/null +++ b/assets/comments6_result.json @@ -0,0 +1 @@ +3 \ No newline at end of file diff --git a/assets/comments6_test.hjson b/assets/comments6_test.hjson new file mode 100644 index 0000000..8a9c16f --- /dev/null +++ b/assets/comments6_test.hjson @@ -0,0 +1,3 @@ +// before +/* before2 */ 3 // after1 +// after2 \ No newline at end of file diff --git a/assets/comments7_result.hjson b/assets/comments7_result.hjson new file mode 100644 index 0000000..cda8102 --- /dev/null +++ b/assets/comments7_result.hjson @@ -0,0 +1,8 @@ +{ + b: + { + sub1: 3 + sub2: 4 + } + a: 2 +} \ No newline at end of file diff --git a/assets/comments7_result.json b/assets/comments7_result.json new file mode 100644 index 0000000..c621dab --- /dev/null +++ b/assets/comments7_result.json @@ -0,0 +1,7 @@ +{ + "b": { + "sub1": 3, + "sub2": 4 + }, + "a": 2 +} \ No newline at end of file diff --git a/assets/comments7_test.hjson b/assets/comments7_test.hjson new file mode 100644 index 0000000..1bb0342 --- /dev/null +++ b/assets/comments7_test.hjson @@ -0,0 +1,8 @@ +# comment before +b: /* key comment */ { + sub1: 3 # comment after + sub2: 4 # comment more after +} # cm after obj +// Comment B4 +a: 2 +/* Last comment */ diff --git a/assets/pass5_result.hjson b/assets/pass5_result.hjson new file mode 100644 index 0000000..8ff44cf --- /dev/null +++ b/assets/pass5_result.hjson @@ -0,0 +1,4 @@ +{ + bigDouble: 9.223372036854776e+58 + bigInt: 9.223372036854776e+58 +} \ No newline at end of file diff --git a/assets/pass5_result.json b/assets/pass5_result.json new file mode 100644 index 0000000..7ce31fd --- /dev/null +++ b/assets/pass5_result.json @@ -0,0 +1,4 @@ +{ + "bigDouble": 9.223372036854776e+58, + "bigInt": 9.223372036854776e+58 +} \ No newline at end of file diff --git a/assets/pass5_test.hjson b/assets/pass5_test.hjson new file mode 100644 index 0000000..6232d61 --- /dev/null +++ b/assets/pass5_test.hjson @@ -0,0 +1,4 @@ +{ + bigDouble: 92233720368547758073829419051489548484843823585675828488686.0 + bigInt: 92233720368547758073829419051489548484843823585675828488686 +} diff --git a/assets/pass6_result.hjson b/assets/pass6_result.hjson new file mode 100644 index 0000000..15f0523 --- /dev/null +++ b/assets/pass6_result.hjson @@ -0,0 +1,8 @@ +{ + a: 1 + b: 2 + c: 3 + d: 4 + e: 5 + f: 6 +} \ No newline at end of file diff --git a/assets/pass6_result.json b/assets/pass6_result.json new file mode 100644 index 0000000..4e47b38 --- /dev/null +++ b/assets/pass6_result.json @@ -0,0 +1,8 @@ +{ + "a": 1, + "b": 2, + "c": 3, + "d": 4, + "e": 5, + "f": 6 +} \ No newline at end of file diff --git a/assets/pass6_test.hjson b/assets/pass6_test.hjson new file mode 100644 index 0000000..45f8466 --- /dev/null +++ b/assets/pass6_test.hjson @@ -0,0 +1 @@ +a: 1, b: 2,c:3,'d' /*cm1*/ : 4, /*cm2 */ e: /* cm3*/ 5 /* cm 4 */ f : 6 diff --git a/assets/root_result.hjson b/assets/root_result.hjson new file mode 100644 index 0000000..736372f --- /dev/null +++ b/assets/root_result.hjson @@ -0,0 +1,7 @@ +{ + database: + { + host: 127.0.0.1 + port: 555 + } +} \ No newline at end of file diff --git a/assets/root_result.json b/assets/root_result.json new file mode 100644 index 0000000..21b01cd --- /dev/null +++ b/assets/root_result.json @@ -0,0 +1,6 @@ +{ + "database": { + "host": "127.0.0.1", + "port": 555 + } +} \ No newline at end of file diff --git a/assets/root_test.hjson b/assets/root_test.hjson new file mode 100644 index 0000000..c0acd16 --- /dev/null +++ b/assets/root_test.hjson @@ -0,0 +1,6 @@ +// a object with the root braces omitted +database: +{ + host: 127.0.0.1 + port: 555 +} diff --git a/assets/testlist.txt b/assets/testlist.txt index 49adf34..f254814 100644 --- a/assets/testlist.txt +++ b/assets/testlist.txt @@ -1,5 +1,12 @@ +charset2_test.hjson charset_test.hjson comments_test.hjson +comments2_test.hjson +comments3_test.hjson +comments4_test.hjson +comments5_test.hjson +comments6_test.hjson +comments7_test.hjson empty_test.hjson failCharset1_test.hjson failJSON02_test.json @@ -71,7 +78,10 @@ pass1_test.json pass2_test.json pass3_test.json pass4_test.json +pass5_test.hjson +pass6_test.hjson passSingle_test.hjson +root_test.hjson stringify1_test.hjson strings2_test.hjson strings_test.hjson @@ -83,4 +93,4 @@ stringify/quotes_strings_ml_test.json stringify/quotes_strings_test.hjson extra/notabs_test.json extra/root_test.hjson -extra/separator_test.json \ No newline at end of file +extra/separator_test.json diff --git a/build.gradle b/build.gradle index 0de0cc3..c7f0241 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,13 @@ -apply plugin: 'java' - -version = '3.0.0' -group = 'org.hjson' -description = """Hjson, the Human JSON.""" +plugins { + id 'java' + id 'maven-publish' + id 'signing' +} -sourceCompatibility = 1.7 -targetCompatibility = 1.7 +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} sourceSets { main { @@ -24,19 +26,19 @@ sourceSets { } task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from 'build/docs/javadoc' } task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } jar { manifest { attributes( - 'Hjson-Version': version, + 'Hjson-Version': project.version, ) } } @@ -48,10 +50,62 @@ artifacts { } task(testSuite, dependsOn: ['classes','testClasses'], type: JavaExec) { - main = 'org.hjson.test.Main' + mainClass = 'org.hjson.test.Main' classpath = files(sourceSets.main.runtimeClasspath, sourceSets.test.runtimeClasspath) } test.dependsOn testSuite -apply from: 'gradle-mvn-push.gradle' +publishing { + publications { + maven(MavenPublication) { + from components.java + artifact sourcesJar + artifact javadocJar + pom { + name = "Hjson Library" + description = project.description + url = "https://github.com/hjson/hjson-java" + licenses { + license { + name = "The MIT License (MIT)" + url = "https://github.com/hjson/hjson-java/blob/master/LICENSE" + distribution = "repo" + } + } + developers { + developer { + id = "laktak" + name = "Christian Zangl" + } + developer { + id = "trobro" + name = "Fredrik Trobro" + } + } + scm { + connection = "scm:git@github.com:hjson/hjson-java.git" + developerConnection = "scm:git@github.com:hjson/hjson-java.git" + url = "https://github.com/hjson/hjson-java" + } + } + } + } + repositories { + maven { + name = "OSSRH" + url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + credentials { + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") + } + } + } +} + +signing { + def signingKey = System.getenv("GPG_SIGNING_KEY") + def signingPassword = System.getenv("GPG_SIGNING_PASSWORD") + useInMemoryPgpKeys(signingKey, signingPassword) + sign publishing.publications.maven +} diff --git a/docs/allclasses-frame.html b/docs/allclasses-frame.html index 2d423a5..b78d2d4 100644 --- a/docs/allclasses-frame.html +++ b/docs/allclasses-frame.html @@ -2,9 +2,8 @@ - -All Classes (hjson 3.0.0 API) - + +All Classes (hjson 3.1.0 API) diff --git a/docs/allclasses-noframe.html b/docs/allclasses-noframe.html index 56dbef8..ebe7b9b 100644 --- a/docs/allclasses-noframe.html +++ b/docs/allclasses-noframe.html @@ -2,9 +2,8 @@ - -All Classes (hjson 3.0.0 API) - + +All Classes (hjson 3.1.0 API) diff --git a/docs/constant-values.html b/docs/constant-values.html index 1d548ec..fce4220 100644 --- a/docs/constant-values.html +++ b/docs/constant-values.html @@ -2,9 +2,8 @@ - -Constant Field Values (hjson 3.0.0 API) - + +Constant Field Values (hjson 3.1.0 API) @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ diff --git a/docs/org/hjson/package-summary.html b/docs/org/hjson/package-summary.html index f7dbb35..43f29a5 100644 --- a/docs/org/hjson/package-summary.html +++ b/docs/org/hjson/package-summary.html @@ -2,9 +2,8 @@ - -org.hjson (hjson 3.0.0 API) - + +org.hjson (hjson 3.1.0 API) @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@ @@ -12,7 +11,7 @@