-
Notifications
You must be signed in to change notification settings - Fork 114
Get binding generation & publishing ready for 0.1 release #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tnull
merged 11 commits into
lightningdevkit:main
from
tnull:2023-05-get-bindings-release-ready
Jun 21, 2023
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9e7ab1b
Remove commented-out code
tnull adc409b
Update package metadata
tnull c45c3a3
Drop `Node::onchain_balance` from public API
tnull 4188725
Rename `new_funding_address` to `new_onchain_address`
tnull 3253ecc
Check documentation building in CI
tnull c8c4448
Document and enforce MSRV in CI
tnull d3e909a
Make Kotlin tests more robust
tnull c99f4bd
Rename Swift modules to `LDKNode`/`LDKNodeFFI`
tnull 70c01cc
Update Package.swift and prepare desc for SwiftPM
tnull d95bb5b
Add scripts to create Swift xcframework archive and update Package.swift
tnull 7de04b7
Avoid nightly for binding generation where possible
tnull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ditto -c -k --sequesterRsrc --keepParent ./bindings/swift/LDKNodeFFI.xcframework ./bindings/swift/LDKNodeFFI.xcframework.zip || exit 1 | ||
CHECKSUM=`swift package compute-checksum ./bindings/swift/LDKNodeFFI.xcframework.zip` || exit 1 | ||
echo "New checksum: $CHECKSUM" || exit 1 | ||
python3 ./scripts/swift_update_package_checksum.py --checksum "${CHECKSUM}" || exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import argparse | ||
import json | ||
import os | ||
import re | ||
import sys | ||
|
||
|
||
def run(new_checksum: str = None, new_tag: str = None): | ||
if new_checksum is None and new_tag is None: | ||
print('At least one of --checksum or --tag arguments must be provided.', file=sys.stderr) | ||
sys.exit(1) | ||
|
||
if new_checksum is not None: | ||
if not new_checksum.isalnum(): | ||
print('Checksum must be alphanumeric.', file=sys.stderr) | ||
sys.exit(1) | ||
|
||
if not new_checksum.islower(): | ||
print('Checksum must be lowercase.', file=sys.stderr) | ||
sys.exit(1) | ||
|
||
try: | ||
int(new_checksum, 16) | ||
except: | ||
print('Checksum must be hexadecimal.', file=sys.stderr) | ||
sys.exit(1) | ||
|
||
if new_tag is not None: | ||
if new_tag.strip() != new_tag: | ||
print('Tag must not contain any whitespace.', file=sys.stderr) | ||
|
||
tag_regex = re.compile("^\d+[.]\d+[.]\d+$") | ||
tag_match = tag_regex.match(new_tag) | ||
if tag_match is None: | ||
print('Tag must adhere to x.x.x major/minor/patch format.', file=sys.stderr) | ||
|
||
settings = [ | ||
{'variable_name': 'checksum', 'value': new_checksum}, | ||
{'variable_name': 'tag', 'value': new_tag}, | ||
] | ||
|
||
package_file_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '../Package.swift')) | ||
print(package_file_path) | ||
|
||
|
||
|
||
original_package_file = None | ||
try: | ||
with open(package_file_path, 'r') as package_file_handle: | ||
original_package_file = package_file_handle.read() | ||
except: | ||
print('Failed to read Package.swift file.', file=sys.stderr) | ||
sys.exit(1) | ||
|
||
package_file = original_package_file | ||
for current_setting in settings: | ||
current_variable_name = current_setting['variable_name'] | ||
new_value = current_setting['value'] | ||
if new_value is None: | ||
continue | ||
|
||
print(f'setting {current_variable_name} (JSON-serialization):') | ||
print(json.dumps(new_value)) | ||
|
||
regex = re.compile(f'(let[\s]+{current_variable_name}[\s]*=[\s]*)(.*)') | ||
|
||
previous_value = regex.search(package_file).group(2) | ||
package_file = package_file.replace(previous_value, f'"{new_value}"') | ||
|
||
with open(package_file_path, "w") as f: | ||
f.write(package_file) | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='Process some integers.') | ||
parser.add_argument('--checksum', type=str, help='new checksum of LDKNode.xcframework.zip', required=False, default=None) | ||
parser.add_argument('--tag', type=str, help='new release tag', required=False, default=None) | ||
args = parser.parse_args() | ||
run(new_checksum=args.checksum, new_tag=args.tag) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the additional variable needed? @arik-so Do you have any insight?