Skip to content
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

chore: improve task flow for native core deps #10591

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
11 changes: 11 additions & 0 deletions packages/core/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 24,17 @@
"verbose": true
}
},
"copy-native-deps": {
"dependsOn": ["winter-cg:build", "ui-mobile-base:build"],
"inputs": ["{workspaceRoot}/dist/packages/winter-cg/platforms/**/*", "{workspaceRoot}/dist/packages/ui-mobile-base/platforms/**/*"],
"outputs": ["{projectRoot}/platforms/android/winter_cg-release.aar", "{projectRoot}/platforms/android/widgets-release.aar"],
"executor": "nx:run-commands",
"options": {
"commands": ["cp -R dist/packages/winter-cg/platforms/* packages/core/platforms", "cp -R dist/packages/ui-mobile-base/platforms/* packages/core/platforms"],
"cwd": ".",
"parallel": false
}
},
"build": {
"executor": "nx:run-commands",
"inputs": ["default", "^production"],
Expand Down
20 changes: 11 additions & 9 deletions packages/ui-mobile-base/build.android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 5,34 @@ set -e

echo "Use dumb gradle terminal"
export TERM=dumb
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

rm -rf dist/package/platforms/android || true
mkdir -p dist/package/platforms/android
OUTDIR=$SCRIPT_DIR/../../dist/packages/ui-mobile-base

rm -rf $OUTDIR/platforms/android || true
mkdir -p $OUTDIR/platforms/android

echo "Build android"
cd android
./gradlew --quiet assembleRelease
cd ..
cp android/widgets/build/outputs/aar/widgets-release.aar dist/package/platforms/android/widgets-release.aar
cp android/widgets/build/outputs/aar/widgets-release.aar $OUTDIR/platforms/android/widgets-release.aar

if [ "$1" ]
then
echo "Suffix package.json's version with tag: $1"
sed -i.bak 's/\(\"version\"\:[[:space:]]*\"[^\"]*\)\"/\1-'$1'"/g' ./dist/package/package.json
sed -i.bak 's/\(\"version\"\:[[:space:]]*\"[^\"]*\)\"/\1-'$1'"/g' ./$OUTDIR/package.json
fi

if [ "$SKIP_PACK" ]
then
echo "SKIP pack"
else
echo "Copy NPM artefacts"
cp .npmignore LICENSE README.md package.json dist/package
cp .npmignore LICENSE README.md package.json $OUTDIR
echo "NPM pack"
cd dist/package
PACKAGE="$(npm pack)"
cd ../..
mv dist/package/$PACKAGE dist/$PACKAGE
cd $OUTDIR
cd ..
PACKAGE="$(npm pack $OUTDIR)"
echo "Output: dist/$PACKAGE"
fi
24 changes: 13 additions & 11 deletions packages/ui-mobile-base/build.ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 5,39 @@ set -e

echo "Use dumb terminal"
export TERM=dumb
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

rm -rf dist/package/platforms/ios || true
mkdir -p dist/package/platforms/ios
OUTDIR=$SCRIPT_DIR/../../dist/packages/ui-mobile-base

rm -rf $OUTDIR/platforms/ios || true
mkdir -p $OUTDIR/platforms/ios

echo "Build iOS"

cd ios
./build.sh
cd ..
echo "Copy ios/TNSWidgets/build/*.xcframework dist/package/platforms/ios"
echo "Copy ios/TNSWidgets/build/*.xcframework $OUTDIR/platforms/ios"

cp -R ios/TNSWidgets/build/TNSWidgets.xcframework dist/package/platforms/ios
cp -R ios/TNSWidgets/build/TNSWidgets.xcframework $OUTDIR/platforms/ios

# cp ios/TNSWidgets/build/*.framework.dSYM.zip dist/package/platforms/ios
# cp ios/TNSWidgets/build/*.framework.dSYM.zip $OUTDIR/platforms/ios

if [ "$1" ]
then
echo "Suffix package.json's version with tag: $1"
sed -i.bak 's/\(\"version\"\:[[:space:]]*\"[^\"]*\)\"/\1-'$1'"/g' ./dist/package/package.json
sed -i.bak 's/\(\"version\"\:[[:space:]]*\"[^\"]*\)\"/\1-'$1'"/g' $OUTDIR/package.json
fi

if [ "$SKIP_PACK" ]
then
echo "SKIP pack"
else
echo "Copy NPM artifacts"
cp .npmignore LICENSE README.md package.json dist/package
cp .npmignore LICENSE README.md package.json $OUTDIR
echo "NPM pack"
cd dist/package
PACKAGE="$(npm pack)"
cd ../..
mv dist/package/$PACKAGE dist/$PACKAGE
cd $OUTDIR
cd ..
PACKAGE="$(npm pack $OUTDIR)"
echo "Output: dist/$PACKAGE"
fi
15 changes: 8 additions & 7 deletions packages/ui-mobile-base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 6,20 @@ set -e

echo "Use dumb gradle terminal"
export TERM=dumb
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

OUTDIR=$SCRIPT_DIR/../../dist/packages/ui-mobile-base

echo "Clean dist"
rm -rf dist
rm -rf $OUTDIR

export SKIP_PACK=true
./build.android.sh
./build.ios.sh

echo "Copy NPM artifacts"
cp .npmignore README.md package.json dist/package
cp ../../LICENSE dist/package
cp .npmignore README.md package.json $OUTDIR
cp ../../LICENSE $OUTDIR


if [ "$1" ]
Expand All @@ -26,9 29,7 @@ then
fi

echo "NPM pack"
cd dist/package
PACKAGE="$(npm pack)"
cd ../..
mv dist/package/$PACKAGE dist/$PACKAGE
cd $OUTDIR/..
PACKAGE="$(npm pack $OUTDIR)"
echo "Output: dist/$PACKAGE"

4 changes: 3 additions & 1 deletion packages/ui-mobile-base/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 7,10 @@
"targets": {
"build": {
"executor": "nx:run-commands",
"inputs": ["default", "!{projectRoot}/android/.gradle/**/*", "!{projectRoot}/android/*/build/**/*", "!{projectRoot}/ios/*/build/**/*"],
"outputs": ["{workspaceRoot}/dist/packages/ui-mobile-base"],
"options": {
"commands": ["./build.sh", "cp -R dist/package/platforms/* ../../packages/core/platforms"],
"commands": ["./build.sh"],
"cwd": "packages/ui-mobile-base",
"parallel": false
}
Expand Down
20 changes: 11 additions & 9 deletions packages/winter-cg/build.android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 5,34 @@ set -e

echo "Use dumb gradle terminal"
export TERM=dumb
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

rm -rf dist/package/platforms/android || true
mkdir -p dist/package/platforms/android
OUTDIR=$SCRIPT_DIR/../../dist/packages/winter-cg

rm -rf $OUTDIR/platforms/android || true
mkdir -p $OUTDIR/platforms/android

echo "Build android"
cd android
./gradlew --quiet assembleRelease
cd ..
cp android/winter_cg/build/outputs/aar/winter_cg-release.aar dist/package/platforms/android/winter_cg-release.aar
cp android/winter_cg/build/outputs/aar/winter_cg-release.aar $OUTDIR/platforms/android/winter_cg-release.aar

if [ "$1" ]
then
echo "Suffix package.json's version with tag: $1"
sed -i.bak 's/\(\"version\"\:[[:space:]]*\"[^\"]*\)\"/\1-'$1'"/g' ./dist/package/package.json
sed -i.bak 's/\(\"version\"\:[[:space:]]*\"[^\"]*\)\"/\1-'$1'"/g' ./$OUTDIR/package.json
fi

if [ "$SKIP_PACK" ]
then
echo "SKIP pack"
else
echo "Copy NPM artefacts"
cp .npmignore LICENSE README.md package.json dist/package
cp .npmignore LICENSE README.md package.json $OUTDIR
echo "NPM pack"
cd dist/package
PACKAGE="$(npm pack)"
cd ../..
mv dist/package/$PACKAGE dist/$PACKAGE
cd $OUTDIR
cd ..
PACKAGE="$(npm pack $OUTDIR)"
echo "Output: dist/$PACKAGE"
fi
24 changes: 13 additions & 11 deletions packages/winter-cg/build.ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 5,39 @@ set -e

echo "Use dumb terminal"
export TERM=dumb
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

rm -rf dist/package/platforms/ios || true
mkdir -p dist/package/platforms/ios
OUTDIR=$SCRIPT_DIR/../../dist/packages/winter-cg

rm -rf $OUTDIR/platforms/ios || true
mkdir -p $OUTDIR/platforms/ios

echo "Build iOS"

cd ios
./build.sh
cd ..
echo "Copy ios/NSCWinterCG/build/*.xcframework dist/package/platforms/ios"
echo "Copy ios/NSCWinterCG/build/*.xcframework $OUTDIR/platforms/ios"

cp -R ios/NSCWinterCG/build/NSCWinterCG.xcframework dist/package/platforms/ios
cp -R ios/NSCWinterCG/build/NSCWinterCG.xcframework $OUTDIR/platforms/ios

# cp ios/NSCWinterCG/build/*.framework.dSYM.zip dist/package/platforms/ios
# cp ios/NSCWinterCG/build/*.framework.dSYM.zip $OUTDIR/platforms/ios

if [ "$1" ]
then
echo "Suffix package.json's version with tag: $1"
sed -i.bak 's/\(\"version\"\:[[:space:]]*\"[^\"]*\)\"/\1-'$1'"/g' ./dist/package/package.json
sed -i.bak 's/\(\"version\"\:[[:space:]]*\"[^\"]*\)\"/\1-'$1'"/g' $OUTDIR/package.json
fi

if [ "$SKIP_PACK" ]
then
echo "SKIP pack"
else
echo "Copy NPM artifacts"
cp .npmignore LICENSE README.md package.json dist/package
cp .npmignore LICENSE README.md package.json $OUTDIR
echo "NPM pack"
cd dist/package
PACKAGE="$(npm pack)"
cd ../..
mv dist/package/$PACKAGE dist/$PACKAGE
cd $OUTDIR
cd ..
PACKAGE="$(npm pack $OUTDIR)"
echo "Output: dist/$PACKAGE"
fi
15 changes: 8 additions & 7 deletions packages/winter-cg/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 6,20 @@ set -e

echo "Use dumb gradle terminal"
export TERM=dumb
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

OUTDIR=$SCRIPT_DIR/../../dist/packages/winter-cg

echo "Clean dist"
rm -rf dist
rm -rf $OUTDIR

export SKIP_PACK=true
./build.android.sh
./build.ios.sh

echo "Copy NPM artifacts"
cp .npmignore README.md package.json dist/package
cp ../../LICENSE dist/package
cp .npmignore README.md package.json $OUTDIR
cp ../../LICENSE $OUTDIR


if [ "$1" ]
Expand All @@ -26,9 29,7 @@ then
fi

echo "NPM pack"
cd dist/package
PACKAGE="$(npm pack)"
cd ../..
mv dist/package/$PACKAGE dist/$PACKAGE
cd $OUTDIR/..
PACKAGE="$(npm pack $OUTDIR)"
echo "Output: dist/$PACKAGE"

4 changes: 3 additions & 1 deletion packages/winter-cg/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 7,10 @@
"targets": {
"build": {
"executor": "nx:run-commands",
"outputs": ["{workspaceRoot}/dist/packages/winter-cg"],
"inputs": ["default", "!{projectRoot}/android/.gradle/**/*", "!{projectRoot}/android/*/build/**/*", "!{projectRoot}/ios/*/build/**/*"],
"options": {
"commands": ["./build.sh", "cp -R dist/package/platforms/* ../../packages/core/platforms"],
"commands": ["./build.sh"],
"cwd": "packages/winter-cg",
"parallel": false
}
Expand Down
Loading