diff --git a/abaplint-downport.jsonc b/abaplint-downport.jsonc index efb04a55..ad3ea8dc 100644 --- a/abaplint-downport.jsonc +++ b/abaplint-downport.jsonc @@ -4,7 +4,7 @@ }, "dependencies": [ { - "url": "https://github.com/open-abap/open-abap", + "url": "https://github.com/open-abap/open-abap-core", "files": "/src/**/*.*" } ], diff --git a/abaplint.jsonc b/abaplint.jsonc index f66973fa..8c17150b 100644 --- a/abaplint.jsonc +++ b/abaplint.jsonc @@ -10,7 +10,7 @@ }, "dependencies": [ { - "url": "https://github.com/open-abap/open-abap", + "url": "https://github.com/open-abap/open-abap-core", "folder": "/open-abap", "files": "/src/**/*.*" }, diff --git a/package-lock.json b/package-lock.json index 6e353b83..b18dc7e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,17 +9,17 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@abaplint/cli": "^2.93.33", - "@abaplint/database-sqlite": "^2.1.74", - "@abaplint/runtime": "^2.1.88", - "@abaplint/transpiler-cli": "^2.1.88", - "abapmerge": "^0.14.7" + "@abaplint/cli": "^2.93.65", + "@abaplint/database-sqlite": "^2.3.21", + "@abaplint/runtime": "^2.3.30", + "@abaplint/transpiler-cli": "^2.3.30", + "abapmerge": "^0.14.8" } }, "node_modules/@abaplint/cli": { - "version": "2.93.33", - "resolved": "https://registry.npmjs.org/@abaplint/cli/-/cli-2.93.33.tgz", - "integrity": "sha512-TArvQMiB006TasfjBCjBp3H+uNsCipFdRuOjq1uYrOOQ3QgtGkHcLIpVHYARi7vZ/bvQxJJ0dvzRxLGhLsCHSg==", + "version": "2.93.65", + "resolved": "https://registry.npmjs.org/@abaplint/cli/-/cli-2.93.65.tgz", + "integrity": "sha512-cFImqkxzuzYATi12JYP6j5i8GrUyvaCSou5rf6oeNsCgeXZdCI4kEuOEZCKqM9xxXLg9t9rplSG/Nl8F91b+nA==", "bin": { "abaplint": "abaplint" }, @@ -28,33 +28,33 @@ } }, "node_modules/@abaplint/database-sqlite": { - "version": "2.1.74", - "resolved": "https://registry.npmjs.org/@abaplint/database-sqlite/-/database-sqlite-2.1.74.tgz", - "integrity": "sha512-m3ScxnAVtULKCW7ZnIBhJlOcDboq8q2Iy1u2xYUQrb5kNz68774r8eIldQdHdRpuyBGymS/F7GKTdt91bSN8xA==", + "version": "2.3.21", + "resolved": "https://registry.npmjs.org/@abaplint/database-sqlite/-/database-sqlite-2.3.21.tgz", + "integrity": "sha512-VI5qYZqVVOh2jfuHGsE34ozZLeh01gLJCIK67OkTmacWlullrAS7qY5W3KkgvtSfTx/LTiLTLOn1xF525ksGaw==", "dependencies": { "sql.js": "^1.8.0" } }, "node_modules/@abaplint/runtime": { - "version": "2.1.88", - "resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-2.1.88.tgz", - "integrity": "sha512-T63iW3yN+j2oQVX+q4151T73xkv7V1Qpkf+XWas83N9v3YpCipuT98W7R3Q6lZ2ITmW7vuBhyrpYCzxsteMwjA==", + "version": "2.3.30", + "resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-2.3.30.tgz", + "integrity": "sha512-s1XBI+muLtpUIsFUibeivQUh1kfGnNslhMFeDrupBMYRRGM34QLAqjwCg4ImyDafjjhv10SGfJjKq1gNjzTTnQ==", "dependencies": { "temporal-polyfill": "^0.0.8" } }, "node_modules/@abaplint/transpiler-cli": { - "version": "2.1.88", - "resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-2.1.88.tgz", - "integrity": "sha512-bLt6UHkHxmaU2oaw3kKHOEvgdXbhJfB2/Hk92koO8LG5zYL2O1GxtFcN0qbOvTEWem4WsUn1QYewOc/4NoRoQA==", + "version": "2.3.30", + "resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-2.3.30.tgz", + "integrity": "sha512-2O4iqDRTxUQsqbv9uzq32ZLlf5Ha6BkvBssWQFVCdBsHhLXMrclqZWrjd/yEH20ffAep6drC5FOdcqOj9MtuOQ==", "bin": { "abap_transpile": "abap_transpile" } }, "node_modules/abapmerge": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/abapmerge/-/abapmerge-0.14.7.tgz", - "integrity": "sha512-rqizPvXuPy2Knd4PdA/Fl1Hgd53p/AMbwn2AjujY4FXDR4hwwH65zR5O8AeyxAhnARNzdOQ30KBJUwHWMJu+9g==", + "version": "0.14.8", + "resolved": "https://registry.npmjs.org/abapmerge/-/abapmerge-0.14.8.tgz", + "integrity": "sha512-M/wkUoPiZSx/5l+rBanlixLQ/Miwk9I0FLBbd2uC9ez8ZXnknLjoKMSsi3Xh4olkmT4VJUFyNeQWK+ZSdgvfuw==", "dependencies": { "commander": "^7.2.0" }, @@ -91,35 +91,35 @@ }, "dependencies": { "@abaplint/cli": { - "version": "2.93.33", - "resolved": "https://registry.npmjs.org/@abaplint/cli/-/cli-2.93.33.tgz", - "integrity": "sha512-TArvQMiB006TasfjBCjBp3H+uNsCipFdRuOjq1uYrOOQ3QgtGkHcLIpVHYARi7vZ/bvQxJJ0dvzRxLGhLsCHSg==" + "version": "2.93.65", + "resolved": "https://registry.npmjs.org/@abaplint/cli/-/cli-2.93.65.tgz", + "integrity": "sha512-cFImqkxzuzYATi12JYP6j5i8GrUyvaCSou5rf6oeNsCgeXZdCI4kEuOEZCKqM9xxXLg9t9rplSG/Nl8F91b+nA==" }, "@abaplint/database-sqlite": { - "version": "2.1.74", - "resolved": "https://registry.npmjs.org/@abaplint/database-sqlite/-/database-sqlite-2.1.74.tgz", - "integrity": "sha512-m3ScxnAVtULKCW7ZnIBhJlOcDboq8q2Iy1u2xYUQrb5kNz68774r8eIldQdHdRpuyBGymS/F7GKTdt91bSN8xA==", + "version": "2.3.21", + "resolved": "https://registry.npmjs.org/@abaplint/database-sqlite/-/database-sqlite-2.3.21.tgz", + "integrity": "sha512-VI5qYZqVVOh2jfuHGsE34ozZLeh01gLJCIK67OkTmacWlullrAS7qY5W3KkgvtSfTx/LTiLTLOn1xF525ksGaw==", "requires": { "sql.js": "^1.8.0" } }, "@abaplint/runtime": { - "version": "2.1.88", - "resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-2.1.88.tgz", - "integrity": "sha512-T63iW3yN+j2oQVX+q4151T73xkv7V1Qpkf+XWas83N9v3YpCipuT98W7R3Q6lZ2ITmW7vuBhyrpYCzxsteMwjA==", + "version": "2.3.30", + "resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-2.3.30.tgz", + "integrity": "sha512-s1XBI+muLtpUIsFUibeivQUh1kfGnNslhMFeDrupBMYRRGM34QLAqjwCg4ImyDafjjhv10SGfJjKq1gNjzTTnQ==", "requires": { "temporal-polyfill": "^0.0.8" } }, "@abaplint/transpiler-cli": { - "version": "2.1.88", - "resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-2.1.88.tgz", - "integrity": "sha512-bLt6UHkHxmaU2oaw3kKHOEvgdXbhJfB2/Hk92koO8LG5zYL2O1GxtFcN0qbOvTEWem4WsUn1QYewOc/4NoRoQA==" + "version": "2.3.30", + "resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-2.3.30.tgz", + "integrity": "sha512-2O4iqDRTxUQsqbv9uzq32ZLlf5Ha6BkvBssWQFVCdBsHhLXMrclqZWrjd/yEH20ffAep6drC5FOdcqOj9MtuOQ==" }, "abapmerge": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/abapmerge/-/abapmerge-0.14.7.tgz", - "integrity": "sha512-rqizPvXuPy2Knd4PdA/Fl1Hgd53p/AMbwn2AjujY4FXDR4hwwH65zR5O8AeyxAhnARNzdOQ30KBJUwHWMJu+9g==", + "version": "0.14.8", + "resolved": "https://registry.npmjs.org/abapmerge/-/abapmerge-0.14.8.tgz", + "integrity": "sha512-M/wkUoPiZSx/5l+rBanlixLQ/Miwk9I0FLBbd2uC9ez8ZXnknLjoKMSsi3Xh4olkmT4VJUFyNeQWK+ZSdgvfuw==", "requires": { "commander": "^7.2.0" } diff --git a/package.json b/package.json index 1507ccd7..faee9680 100644 --- a/package.json +++ b/package.json @@ -5,19 +5,20 @@ "description": "test", "scripts": { "lint": "abaplint", - "unit": "rm -rf output && abap_transpile test/abap_transpile.json && echo RUNNING && node output/index.mjs", + "build": "rm -rf output && abap_transpile test/abap_transpile.json", + "unit": "npm run build && echo RUNNING && node output/index.mjs", "test": "npm run lint && npm run downport && npm run unit", "downport": "rm -rf downport && cp -r src downport && cp deps/* downport && rm downport/*.prog.* && rm downport/zcl_aff_writer_xslt.clas.testclasses.abap && abaplint --fix abaplint-downport.jsonc", "merge": "rm -f src/z_generate_json_schema.prog.abap && abapmerge -f src/z_generate_repo.prog.abap -c saff_generate_repo > saff_generate_repo.prog.abap", - "aff": "npm test && rm -rf abap-file-formats && git clone https://github.com/SAP/abap-file-formats && cp abap-file-formats/file-formats/*.abap downport && cp abap-file-formats/file-formats/*/type/*.abap downport && cp test/cl_run.clas.abap downport && abap_transpile test/abap_transpile.json && node test/aff.mjs", + "aff": "npm run downport && rm -rf abap-file-formats && git clone https://github.com/SAP/abap-file-formats && cp abap-file-formats/file-formats/*.abap downport && cp abap-file-formats/file-formats/*/type/*.abap downport && cp test/cl_run.clas.abap downport && abap_transpile test/abap_transpile.json && node test/aff.mjs", "cutUnitTests": "sed -i '/CLASS\\ ltc_generator\\ I/,/ENDCLASS./d' saff_generate_repo.prog.abap && sed -i '/CLASS\\ ltc_generator\\ D/,/ENDCLASS./d' saff_generate_repo.prog.abap" }, "license": "MIT", "dependencies": { - "@abaplint/cli": "^2.93.33", - "@abaplint/runtime": "^2.1.88", - "@abaplint/database-sqlite": "^2.1.74", - "@abaplint/transpiler-cli": "^2.1.88", - "abapmerge": "^0.14.7" + "@abaplint/cli": "^2.93.65", + "@abaplint/runtime": "^2.3.30", + "@abaplint/database-sqlite": "^2.3.21", + "@abaplint/transpiler-cli": "^2.3.30", + "abapmerge": "^0.14.8" } } diff --git a/test/abap_transpile.json b/test/abap_transpile.json index 25afe6f0..bfc9c699 100644 --- a/test/abap_transpile.json +++ b/test/abap_transpile.json @@ -8,7 +8,7 @@ "output_folder": "output", "libs": [ { - "url": "https://github.com/open-abap/open-abap" + "url": "https://github.com/open-abap/open-abap-core" } ], "write_unit_tests": true, diff --git a/test/aff.mjs b/test/aff.mjs index 99a54d60..c78b0306 100644 --- a/test/aff.mjs +++ b/test/aff.mjs @@ -1,16 +1,43 @@ -import * as fs from 'fs'; -import * as path from 'path'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import * as child_process from 'node:child_process'; import {initializeABAP} from "../output/init.mjs"; await initializeABAP(); async function run() { - const result = await abap.Classes["CL_RUN"].run(); if (fs.existsSync("generated") === false) { fs.mkdirSync("generated"); } - for (const row of result.array()) { - fs.writeFileSync("generated" + path.sep + row.get().filename.get(), row.get().contents.get()); + + const types = []; + for (const f of fs.readdirSync("abap-file-formats/file-formats/")) { + if (f.length === 4) { + types.push(f.toUpperCase()); + } + } + + for (const type of types) { + console.log(type); + if (type === "ENHO") { + console.log("\tskip, https://github.com/SAP/abap-file-formats/issues/409"); + continue; + } + + const result = await abap.Classes["CL_RUN"].run({object_type: new abap.types.String().set(type)}); + const filename = "generated" + path.sep + type.toLowerCase() + "-v1.json"; + fs.writeFileSync(filename, result.get()); + + const command = `diff --strip-trailing-cr generated/${type.toLowerCase()}-v1.json abap-file-formats/file-formats/${type.toLowerCase()}/${type.toLowerCase()}-v1.json`; + console.log(command); + const output = child_process.execSync(`${command} || true`); + console.log(output.toString()); } + + // only run for INTF, + /* + const result = await abap.Classes["CL_RUN"].run({object_type: new abap.types.String().set("INTF")}); + fs.writeFileSync("generated" + path.sep + "intf-v1.json", result.get()); + */ } run(); \ No newline at end of file diff --git a/test/cl_run.clas.abap b/test/cl_run.clas.abap index 80a17da0..70a82d4b 100644 --- a/test/cl_run.clas.abap +++ b/test/cl_run.clas.abap @@ -1,44 +1,37 @@ CLASS cl_run DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. - TYPES: BEGIN OF ty_row, - filename TYPE string, - contents TYPE string, - END OF ty_row. - TYPES ty_tab TYPE STANDARD TABLE OF ty_row WITH DEFAULT KEY. CLASS-METHODS run - RETURNING - VALUE(tab) TYPE ty_tab. - PRIVATE SECTION. - CLASS-METHODS run_intf + IMPORTING + object_type TYPE string RETURNING VALUE(result) TYPE string. ENDCLASS. CLASS cl_run IMPLEMENTATION. - METHOD run_intf. + + METHOD run. DATA writer TYPE REF TO zcl_aff_writer_json_schema. DATA generator TYPE REF TO zcl_aff_generator. - DATA intf TYPE zif_aff_intf_v1=>ty_main. DATA string_tab TYPE string_table. + DATA type_name TYPE string. + DATA schema_id TYPE string. + DATA ref TYPE REF TO data. + + schema_id = |https://github.com/SAP/abap-file-formats/blob/main/file-formats/{ to_lower( object_type ) }/{ to_lower( object_type ) }-v1.json|. + type_name = to_upper( |ZIF_AFF_{ object_type }_V1=>TY_MAIN| ). + + CREATE DATA ref TYPE (type_name). CREATE OBJECT writer EXPORTING - schema_id = 'https://github.com/SAP/abap-file-formats/blob/main/file-formats/intf/intf-v1.json'. + schema_id = schema_id. + CREATE OBJECT generator EXPORTING writer = writer. - string_tab = generator->generate_type( intf ). + + string_tab = generator->generate_type( ref->* ). CONCATENATE LINES OF string_tab INTO result SEPARATED BY |\n|. ENDMETHOD. - METHOD run. - DATA str TYPE string. - DATA row LIKE LINE OF tab. - - str = run_intf( ). - - row-filename = 'intf.json'. - row-contents = str. - APPEND row TO tab. - ENDMETHOD. ENDCLASS.