Native Build - excluded files not working

Hello,

the excluded files for iOS are not working.
on Android native build it working fine.
in the build.settings:

excludeFiles =
{
	-- Exclude unnecessary files for each platform

	ios = { "AndroidResources/*","fire_storage/*", "converter/*", "assets/whitelabels/*"},
	iphone = { "AndroidResources/*","fire_storage/*", "converter/*", "assets/whitelabels/*"},
        [...]
}

The converter folder is not empty
sasasasa

Second Test:

We tested it on a new clean Project. Created an Archive a *.ipa-file and unzip it, and view package content. The Icon.png is still there:

build.settings:


settings =
{
	orientation =
	{
		-- Supported values for orientation:
		-- portrait, portraitUpsideDown, landscapeLeft, landscapeRight
		default = "portrait",
		supported = { "portrait", },
	},

	--
	-- Android section
	--
	android =
	{
		usesPermissions =
		{
			"android.permission.INTERNET",
		},
	},

	--
	-- iOS section
	--
	iphone =
	{
		xcassets = "Images.xcassets",
		plist =
		{
			UIStatusBarHidden = false,
			UILaunchStoryboardName = "LaunchScreen",
		},
	},

	--
	-- Plugins section
	--
	plugins =
	{

	},

	--
	-- Project section
	--
	excludeFiles =
	{
		-- Exclude unnecessary files for each platform
		all = { "Icon.png", "Icon-*dpi.png", "Images.xcassets", },
		android = { "LaunchScreen.storyboardc", },
	},
}

We have the same issue. We’ve also tried to exclude the files through Xcode directly but to no avail. I hope someone can help.

I have a simple solution, to delete the files after build in iOS

Add the script in the follow steps:

Add a script in the build phase in your XCode project:

After that drag the script at the very End of the build phases, you can rename it.

Add the follow Code:

## Remove not needed files
echo "START FOLDER DELETE"

rootPath="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app"

foldersToDelete=("yourDeletefolder1" "yourDeletefolder2" "yourDeletefolder3")


for folderName in "${foldersToDelete[@]}"; do
    folderPathInRoot="${rootPath}/${folderName}"
    
    if [ -d "$folderPathInRoot" ]; then
        echo "Delete Folder $folderName in App.app"
        rm -rf "$folderPathInRoot"
    else
        echo "Delete Folder $folderName in App.app not found!"
    fi
done

echo "START FOLDER"
for entry in "$rootPath"/*
do
  echo "$entry"
done

echo "END FOLDER"

If you had some questions, feel free :slight_smile:

1 Like

Thanks for sharing this! It looks like a nice and easy workaround. We’ll try it. :+1:

1 Like

@Kao14 I tried your suggestion for deleting unused folders and it works like a charm! Thank you!

@Kao14 Apart from folders, is there a way to delete unused files as well?

@elvo

Here Created by ChatGPT:

Not tested :wink:

## Remove not needed files
echo "START FOLDER DELETE"

rootPath="${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app"

foldersToDelete=("yourDeletefolder1" "yourDeletefolder2" "yourDeletefolder3")
filesToDelete=("file1.txt" "file2.txt" "file3.txt")

for folderName in "${foldersToDelete[@]}"; do
    folderPathInRoot="${rootPath}/${folderName}"
    
    if [ -d "$folderPathInRoot" ]; then
        echo "Delete Folder $folderName in App.app"
        rm -rf "$folderPathInRoot"
    else
        echo "Delete Folder $folderName in App.app not found!"
    fi
done

for fileName in "${filesToDelete[@]}"; do
    filePathInRoot="${rootPath}/${fileName}"
    
    if [ -f "$filePathInRoot" ]; then
        echo "Delete File $fileName in App.app"
        rm "$filePathInRoot"
    else
        echo "Delete File $fileName in App.app not found!"
    fi
done

echo "START FOLDER"
for entry in "$rootPath"/*
do
  echo "$entry"
done

echo "END FOLDER"

@Kao14 Looks legit, I’ll try it. Thanks!