Skip to content

Commit

Permalink
Merge pull request #169 from Shopify/bugfix/copy-artifacts-fails
Browse files Browse the repository at this point in the history
Fixed copy files step for npm package
  • Loading branch information
chrfalch authored Feb 2, 2022
2 parents 770c21e + 0b6a8b4 commit 436e9df
Showing 1 changed file with 9 additions and 39 deletions.
48 changes: 9 additions & 39 deletions scripts/workflow-copy-libs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,6 @@ import { ensureFolderExists } from "./utils";
* the Skia Binaries from the artifact folder into the libs folder
* in the checkout directory. This build script is run by the
* build-npm.yml workflow and does not require anything.
*
* The folder structure after downloading artifacts are:
*
* artifacts:
*
* ./skia-android-arm
* ./skia-android-arm-64
* ./skia-android-arm-x64
* ./skia-android-arm-x86
* ./skia-ios-fat-libs
*
* ./skia-android-arm:
* libskia.a
* libskshaper.a
* libsvg.a
*
* ./skia-android-arm-64:
* libskia.a
* libskshaper.a
* libsvg.a
*
* ./skia-android-arm-x64:
* libskia.a
* libskshaper.a
* libsvg.a
*
* ./skia-android-arm-x86:
* libskia.a
* libskshaper.a
* libsvg.a
*
* ./skia-ios-xc-frameworks:
* libskia.xcframework
* libskshaper.xcframework
* libsvg.xcframework
*/

console.log("Copying Skia Binaries from artifacts to libs folder");
Expand All @@ -53,9 +18,14 @@ const sources = [

const destinations = ["armeabi-v7a", "arm64-v8a", "x86", "x86_64"];

const files = ["libskia.a", "libskshaper.a", "libsvg.a"];
const androidFiles = ["libskia.a", "libskshaper.a", "libsvg.a"];
const iosFiles = [
"libskia.xcframework",
"libskshaper.xcframework",
"libsvg.xcframework",
];

const copyFiles = (from: string, to: string) => {
const copyFiles = (from: string, to: string, files: string[]) => {
ensureFolderExists(to);
files.forEach((f) => {
const source = "./artifacts/" + from + "/" + f;
Expand Down Expand Up @@ -85,10 +55,10 @@ const copyFiles = (from: string, to: string) => {

console.log("Copying android files...");
destinations.forEach((d, i) => {
copyFiles(sources[i], "./package/libs/android/" + d);
copyFiles(sources[i], "./package/libs/android/" + d, androidFiles);
});

console.log("Copying ios files...");
copyFiles("skia-ios-xcframeworks", "./package/libs/ios");
copyFiles("skia-ios-xcframeworks", "./package/libs/ios", iosFiles);

console.log("Done copying artifacts.");

0 comments on commit 436e9df

Please sign in to comment.