Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
450 changes: 68 additions & 382 deletions .github/workflows/npm_release.yml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion build_all_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ rm -rf ./dist
./build_nativescript.sh --no-vision
./build_tklivesync.sh --no-vision
./prepare_dSYMs.sh
./build_spm_artifacts.sh ios
./build_npm_ios.sh
1 change: 0 additions & 1 deletion build_all_vision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ rm -rf ./dist
./build_nativescript.sh --no-catalyst --no-iphone --no-sim
./build_tklivesync.sh --no-catalyst --no-iphone --no-sim
./prepare_dSYMs.sh
./build_spm_artifacts.sh visionos
./build_npm_vision.sh
61 changes: 11 additions & 50 deletions build_npm_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,26 @@ cp ./package.json "$OUTPUT_DIR"

cp -r "./project-template-ios/" "$OUTPUT_DIR/framework"

# The NativeScript / TKLiveSync xcframeworks are NO LONGER bundled in npm. They
# are published as GitHub Release artifacts and consumed via SwiftPM
# (github.com/NativeScript/ios-spm). Stamp the runtime version into the packaged
# template's SwiftPM reference so it resolves the matching release.
NPM_VERSION=$(node -e "console.log(require('./package.json').version)")
node ./scripts/stamp-template-version.mjs \
"$OUTPUT_DIR/framework/__PROJECT_NAME__.xcodeproj/project.pbxproj" \
"$NPM_VERSION"
cp -r "dist/NativeScript.xcframework" "$OUTPUT_DIR/framework/internal"
cp -r "dist/TKLiveSync.xcframework" "$OUTPUT_DIR/framework/internal"

# Local builds have no ios-spm release tag to resolve, so by default (outside
# CI) rewrite the template to a LOCAL SwiftPM package over the xcframeworks
# just built into dist/. Force with NS_SPM_LOCAL=1, disable with NS_SPM_LOCAL=0.
# The resulting .tgz embeds an absolute path into this checkout — local
# `ns platform add ios --framework-path=dist/nativescript-ios-*.tgz` use only.
if [[ "${NS_SPM_LOCAL:-}" == "1" || ( -z "${CI:-}" && "${NS_SPM_LOCAL:-}" != "0" ) ]]; then
LOCAL_SPM_DIR="$(pwd)/dist/local-spm"
rm -rf "$LOCAL_SPM_DIR"
mkdir -p "$LOCAL_SPM_DIR"
cp -R "dist/NativeScript.xcframework" "$LOCAL_SPM_DIR/"
cp -R "dist/TKLiveSync.xcframework" "$LOCAL_SPM_DIR/"
cat > "$LOCAL_SPM_DIR/Package.swift" <<'EOF'
// swift-tools-version: 5.10
// Local dev override of github.com/NativeScript/ios-spm: same product shape,
// but binaryTargets point at the freshly built xcframeworks in this folder.
import PackageDescription

let package = Package(
name: "NativeScriptSDK",
platforms: [
.iOS(.v13),
.macCatalyst(.v13),
],
products: [
.library(name: "NativeScript", targets: ["NativeScript", "TKLiveSync"]),
.library(name: "NativeScriptSDK", targets: ["NativeScript", "TKLiveSync"]),
],
dependencies: [],
targets: [
.binaryTarget(name: "NativeScript", path: "NativeScript.xcframework"),
.binaryTarget(name: "TKLiveSync", path: "TKLiveSync.xcframework"),
]
)
EOF
node ./scripts/stamp-template-local-spm.mjs \
"$OUTPUT_DIR/framework/__PROJECT_NAME__.xcodeproj/project.pbxproj" \
"$LOCAL_SPM_DIR"
fi

# Build-time metadata generator is still shipped in npm (Phase 1). See the
# distribution plan for moving this to an on-demand artifact (Phase 2).
mkdir -p "$OUTPUT_DIR/framework/internal/metadata-generator-x86_64"
cp -r "metadata-generator/dist/x86_64/." "$OUTPUT_DIR/framework/internal/metadata-generator-x86_64"

mkdir -p "$OUTPUT_DIR/framework/internal/metadata-generator-arm64"
cp -r "metadata-generator/dist/arm64/." "$OUTPUT_DIR/framework/internal/metadata-generator-arm64"

# Add xcframeworks to .zip (NPM modules do not support symlinks, unzipping is done by {N} CLI)
(
set -e
cd $OUTPUT_DIR/framework/internal
zip -qr --symlinks XCFrameworks.zip *.xcframework
rm -rf *.xcframework
)

pushd "$OUTPUT_DIR"
npm pack
mv *.tgz ../
popd

checkpoint "npm package created."
checkpoint "npm package created."
24 changes: 12 additions & 12 deletions build_npm_vision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ cp ./package.json "$OUTPUT_DIR"

cp -r "./project-template-vision/" "$OUTPUT_DIR/framework"

# The NativeScript / TKLiveSync xcframeworks are NO LONGER bundled in npm. They
# are published as GitHub Release artifacts and consumed via SwiftPM
# (github.com/NativeScript/ios-spm). Stamp the runtime version into the packaged
# template's SwiftPM reference so it resolves the matching release.
NPM_VERSION=$(node -e "console.log(require('./package.json').version)")
node ./scripts/stamp-template-version.mjs \
"$OUTPUT_DIR/framework/__PROJECT_NAME__.xcodeproj/project.pbxproj" \
"$NPM_VERSION"

# Build-time metadata generator is still shipped in npm (Phase 1). See the
# distribution plan for moving this to an on-demand artifact (Phase 2).
cp -r "dist/NativeScript.xcframework" "$OUTPUT_DIR/framework/internal"
cp -r "dist/TKLiveSync.xcframework" "$OUTPUT_DIR/framework/internal"

mkdir -p "$OUTPUT_DIR/framework/internal/metadata-generator-x86_64"
cp -r "metadata-generator/dist/x86_64/." "$OUTPUT_DIR/framework/internal/metadata-generator-x86_64"

mkdir -p "$OUTPUT_DIR/framework/internal/metadata-generator-arm64"
cp -r "metadata-generator/dist/arm64/." "$OUTPUT_DIR/framework/internal/metadata-generator-arm64"

# Add xcframeworks to .zip (NPM modules do not support symlinks, unzipping is done by {N} CLI)
(
set -e
cd $OUTPUT_DIR/framework/internal
zip -qr --symlinks XCFrameworks.zip *.xcframework
rm -rf *.xcframework
)

pushd "$OUTPUT_DIR"
npm pack
mv *.tgz ../
popd

checkpoint "npm package created."
checkpoint "npm package created."
83 changes: 0 additions & 83 deletions build_spm_artifacts.sh

This file was deleted.

35 changes: 8 additions & 27 deletions project-template-ios/__PROJECT_NAME__.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
AA10000000000000000000C1 /* NativeScript in Frameworks */ = {isa = PBXBuildFile; productRef = AA10000000000000000000B1 /* NativeScript */; };
39940D9122C4EF600050DDE1 /* NativeScript.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 39940D8C22C4EAAA0050DDE1 /* NativeScript.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
39940E1C22C5DFFF0050DDE1 /* TKLiveSync.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 39940E1B22C5DFFF0050DDE1 /* TKLiveSync.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
858B842D18CA22B800AB12DE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 858B833A18CA111C00AB12DE /* InfoPlist.strings */; };
AAA0AADB2A54B96B00EE55A4 /* NativeScriptStart.m in Sources */ = {isa = PBXBuildFile; fileRef = AAA0AADA2A54B96B00EE55A4 /* NativeScriptStart.m */; };
CD45EE7C18DC2D5800FB50C0 /* app in Resources */ = {isa = PBXBuildFile; fileRef = CD45EE7A18DC2D5800FB50C0 /* app */; };
Expand All @@ -21,6 +22,8 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
39940D9122C4EF600050DDE1 /* NativeScript.xcframework in Embed Frameworks */,
39940E1C22C5DFFF0050DDE1 /* TKLiveSync.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -32,6 +35,8 @@
391174B721F1D99900BA2583 /* plugins-release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "plugins-release.xcconfig"; sourceTree = SOURCE_ROOT; };
391174B821F1D99900BA2583 /* plugins-debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "plugins-debug.xcconfig"; sourceTree = SOURCE_ROOT; };
39940D8122C4E84C0050DDE1 /* __PROJECT_NAME__.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = __PROJECT_NAME__.entitlements; sourceTree = "<group>"; };
39940D8C22C4EAAA0050DDE1 /* NativeScript.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = NativeScript.xcframework; path = internal/NativeScript.xcframework; sourceTree = "<group>"; };
39940E1B22C5DFFF0050DDE1 /* TKLiveSync.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = TKLiveSync.xcframework; path = internal/TKLiveSync.xcframework; sourceTree = "<group>"; };
42C751E2232B769100186695 /* nativescript-pre-link */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "nativescript-pre-link"; path = "internal/nativescript-pre-link"; sourceTree = SOURCE_ROOT; };
42C751E3232B769100186695 /* strip-dynamic-framework-architectures.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "strip-dynamic-framework-architectures.sh"; path = "internal/strip-dynamic-framework-architectures.sh"; sourceTree = SOURCE_ROOT; };
42C751E4232B769100186695 /* nsld.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = nsld.sh; path = internal/nsld.sh; sourceTree = SOURCE_ROOT; };
Expand All @@ -58,7 +63,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AA10000000000000000000C1 /* NativeScript in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -111,6 +115,8 @@
858B833018CA111C00AB12DE /* Frameworks */ = {
isa = PBXGroup;
children = (
39940E1B22C5DFFF0050DDE1 /* TKLiveSync.xcframework */,
39940D8C22C4EAAA0050DDE1 /* NativeScript.xcframework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -170,9 +176,6 @@
dependencies = (
);
name = __PROJECT_NAME__;
packageProductDependencies = (
AA10000000000000000000B1 /* NativeScript */,
);
productName = JDBridgeApp;
productReference = 858B843318CA22B800AB12DE /* __PROJECT_NAME__.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -203,9 +206,6 @@
Base,
);
mainGroup = 858B832518CA111C00AB12DE;
packageReferences = (
AA10000000000000000000A1 /* XCRemoteSwiftPackageReference "ios-spm" */,
);
productRefGroup = 858B832F18CA111C00AB12DE /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -498,25 +498,6 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
AA10000000000000000000A1 /* XCRemoteSwiftPackageReference "ios-spm" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/NativeScript/ios-spm.git";
requirement = {
kind = exactVersion;
version = "__NS_RUNTIME_VERSION__";
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
AA10000000000000000000B1 /* NativeScript */ = {
isa = XCSwiftPackageProductDependency;
package = AA10000000000000000000A1 /* XCRemoteSwiftPackageReference "ios-spm" */;
productName = NativeScript;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 858B832618CA111C00AB12DE /* Project object */;
}
7 changes: 1 addition & 6 deletions project-template-ios/internal/nativescript-build.xcconfig
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// * NativeScript build related flags
// * Add [sdk=*] after each one to avoid conflict with CocoaPods flags
// * NativeScript + TKLiveSync are provided by the SwiftPM "NativeScript" product
// * (github.com/NativeScript/ios-spm), so SwiftPM links/embeds them automatically.
// * The explicit -framework NativeScript / -framework TKLiveSync / -F internal are
// * intentionally omitted. SwiftPM stages the resolved framework slice into
// * CONFIGURATION_BUILD_DIR (below), which is where the metadata generator finds it.
OTHER_LDFLAGS[sdk=*] = $(inherited) -ObjC -sectcreate __DATA __TNSMetadata "$(CONFIGURATION_BUILD_DIR)/metadata-$(CURRENT_ARCH).bin" -licucore -lz -lc++ -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreServices -framework Security
OTHER_LDFLAGS[sdk=*] = $(inherited) -ObjC -sectcreate __DATA __TNSMetadata "$(CONFIGURATION_BUILD_DIR)/metadata-$(CURRENT_ARCH).bin" -framework NativeScript -framework TKLiveSync -F"$(SRCROOT)/internal" -licucore -lz -lc++ -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreServices -framework Security

// We need to add CONFIGURATION_BUILD_DIR here so that we can explicitly quote-escape any paths in it, because the implicitly added path by Xcode is not always escaped
FRAMEWORK_SEARCH_PATHS[sdk=*] = $(inherited) "$(SRCROOT)/internal/" "$(CONFIGURATION_BUILD_DIR)"
Expand Down
Loading
Loading