Remove unnecessary architecture library for lib folder of app
authorj-h.choi <j-h.choi@samsung.com>
Fri, 12 Jul 2024 06:53:01 +0000 (15:53 +0900)
committer조웅석/MDE Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Tue, 23 Jul 2024 00:00:45 +0000 (09:00 +0900)
17 files changed:
NativeLauncher/tool/multi_target_resolver.cc
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11.sln [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/Directory.Build.targets [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11.cs [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11.csproj [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/aarch64/test.so [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/arm/test.so [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/arm64/test.so [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/armel/test.so [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/riscv64/test.so [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/x64/test.so [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/x86/test.so [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/shared/res/Launcher_TC_PLUGIN_11.png [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/tizen-manifest.xml [new file with mode: 0755]
tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/tizen_dotnet_project.yaml [new file with mode: 0755]
tests/TCs/2_PLUGIN/PLUGIN.py
tests/TCs/Utils.py

index 5c12aaa..9542a35 100644 (file)
@@ -124,8 +124,27 @@ static bool moveAllFilesTo(const std::string& from, const std::string& to)
 int resolvePlatformSpecificFiles(const std::string& rootPath)
 {
        std::string appBinPath = concatPath(rootPath, "bin");
+       std::string appLibPath = concatPath(rootPath, "lib");
        std::string runtimesPath = concatPath(appBinPath, "runtimes");
 
+       // remove unused arch directory
+       std::vector<std::string> archList = {"x86", "x64", "arm", "armel", "arm64", "aarch64", "riscv32", "riscv64"};
+       archList.erase(find(archList.begin(), archList.end(), ARCHITECTURE_IDENTIFIER));
+       if (!strncmp(ARCHITECTURE_IDENTIFIER, "armel", 5)) {
+               archList.erase(find(archList.begin(), archList.end(), "arm"));
+       } else if (!strncmp(ARCHITECTURE_IDENTIFIER, "arm64", 5)) {
+               archList.erase(find(archList.begin(), archList.end(), "aarch64"));
+       }
+
+       for (const auto &arch : archList) {
+               std::string archPath = concatPath(appLibPath, arch);
+               if (exist(archPath)) {
+                       if (!removeAll(archPath)) {
+                               _ERR("Failed to remove %s directory", archPath.c_str());
+                       }
+               }
+       }
+
        // if runtimes directory doesnot exist, return 0
        if (!isDirectory(runtimesPath)) {
                return 0;
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11.sln b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11.sln
new file mode 100755 (executable)
index 0000000..1d4f0dc
--- /dev/null
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio Version 16\r
+VisualStudioVersion = 16.0.31005.135\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher_TC_PLUGIN_11", "Launcher_TC_PLUGIN_11\Launcher_TC_PLUGIN_11.csproj", "{3daa496e-195a-4708-8316-dd6207adbd9a}"\r
+EndProject\r
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{c9bd2802-b0a0-41c2-9453-e159261615bc}"\r
+       ProjectSection(SolutionItems) = preProject\r
+               tizen_workspace.yaml = tizen_workspace.yaml\r
+       EndProjectSection\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+               Debug|Any CPU = Debug|Any CPU\r
+               Release|Any CPU = Release|Any CPU\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+               {3daa496e-195a-4708-8316-dd6207adbd9a}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {3daa496e-195a-4708-8316-dd6207adbd9a}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {3daa496e-195a-4708-8316-dd6207adbd9a}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {3daa496e-195a-4708-8316-dd6207adbd9a}.Release|Any CPU.Build.0 = Release|Any CPU\r
+\r
+       EndGlobalSection\r
+       GlobalSection(SolutionProperties) = preSolution\r
+               HideSolutionNode = FALSE\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/Directory.Build.targets b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/Directory.Build.targets
new file mode 100755 (executable)
index 0000000..67fcf5d
--- /dev/null
@@ -0,0 +1,21 @@
+<!--\r
+***********************************************************************************************\r
+<Build.Directory.targets>\r
+WARNING:  DO NOT MODIFY this file. Incorrect changes to this file will make it\r
+          impossible to load or build your projects from the IDE.\r
+\r
+***********************************************************************************************\r
+-->\r
+\r
+<Project>    \r
+       <Target Name="BuildDotnet" AfterTargets="TizenPackage" >\r
+        <Message Text="Tizen Build starts here ------------" Importance="high"/>\r
+        <Message Text="$(MSBuildProjectDirectory)" Importance="high"/>\r
+        <PropertyGroup>\r
+            <WorkspaceFolder>$([System.IO.Path]::GetDirectoryName($(MSBuildProjectDirectory)))</WorkspaceFolder>\r
+        </PropertyGroup>\r
+        <Message Text="Workspace: '$(WorkspaceFolder)'"  Importance="high" />\r
+\r
+               <Exec Command="C:\tizen-studio\tools\tizen-core\tz.exe pack  -S $(ProjectDir) $(WorkspaceFolder)"> </Exec>\r
+    </Target>\r
+</Project>\r
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11.cs b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11.cs
new file mode 100755 (executable)
index 0000000..9c6e1b8
--- /dev/null
@@ -0,0 +1,49 @@
+using System;\r
+using Tizen.NUI;\r
+using Tizen.NUI.BaseComponents;\r
+\r
+namespace Launcher_TC_PLUGIN_11\r
+{\r
+    class Program : NUIApplication\r
+    {\r
+        protected override void OnCreate()\r
+        {\r
+            base.OnCreate();\r
+            Initialize();\r
+        }\r
+\r
+        void Initialize()\r
+        {\r
+            Window.Instance.KeyEvent += OnKeyEvent;\r
+\r
+            TextLabel text = new TextLabel("Hello Tizen NUI World");\r
+            text.HorizontalAlignment = HorizontalAlignment.Center;\r
+            text.VerticalAlignment = VerticalAlignment.Center;\r
+            text.TextColor = Color.Blue;\r
+            text.PointSize = 12.0f;\r
+            text.HeightResizePolicy = ResizePolicyType.FillToParent;\r
+            text.WidthResizePolicy = ResizePolicyType.FillToParent;\r
+            Window.Instance.GetDefaultLayer().Add(text);\r
+\r
+            Animation animation = new Animation(2000);\r
+            animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(180.0f)), PositionAxis.X), 0, 500);\r
+            animation.AnimateTo(text, "Orientation", new Rotation(new Radian(new Degree(0.0f)), PositionAxis.X), 500, 1000);\r
+            animation.Looping = true;\r
+            animation.Play();\r
+        }\r
+\r
+        public void OnKeyEvent(object sender, Window.KeyEventArgs e)\r
+        {\r
+            if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))\r
+            {\r
+                Exit();\r
+            }\r
+        }\r
+\r
+        static void Main(string[] args)\r
+        {\r
+            var app = new Program();\r
+            app.Run(args);\r
+        }\r
+    }\r
+}\r
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11.csproj b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11.csproj
new file mode 100755 (executable)
index 0000000..4926595
--- /dev/null
@@ -0,0 +1,19 @@
+<Project Sdk="Microsoft.NET.Sdk">\r
+\r
+  <PropertyGroup>\r
+    <OutputType>Exe</OutputType>\r
+    <TargetFramework>net6.0-tizen</TargetFramework>\r
+  </PropertyGroup>\r
+\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugType>portable</DebugType>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>None</DebugType>\r
+  </PropertyGroup>\r
+\r
+  <ItemGroup>\r
+    <Folder Include="res\" />\r
+  </ItemGroup>\r
+\r
+</Project>\r
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/aarch64/test.so b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/aarch64/test.so
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/arm/test.so b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/arm/test.so
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/arm64/test.so b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/arm64/test.so
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/armel/test.so b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/armel/test.so
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/riscv64/test.so b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/riscv64/test.so
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/x64/test.so b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/x64/test.so
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/x86/test.so b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/lib/x86/test.so
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/shared/res/Launcher_TC_PLUGIN_11.png b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/shared/res/Launcher_TC_PLUGIN_11.png
new file mode 100755 (executable)
index 0000000..9f3cb98
Binary files /dev/null and b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/shared/res/Launcher_TC_PLUGIN_11.png differ
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/tizen-manifest.xml b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/tizen-manifest.xml
new file mode 100755 (executable)
index 0000000..7f43df3
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="9.0" package="org.tizen.example.Launcher_TC_PLUGIN_11" version="1.0.0">
+  <profile name="common" />
+  <ui-application appid="org.tizen.example.Launcher_TC_PLUGIN_11"
+                                       exec="Launcher_TC_PLUGIN_11.dll"
+                                       type="dotnet-nui"
+                                       multiple="false"
+                                       taskmanage="true"
+                                       nodisplay="false"
+                                       launch_mode="single"
+                    api-version="12">
+    <label>Launcher_TC_PLUGIN_11</label>
+    <icon>Launcher_TC_PLUGIN_11.png</icon>
+    <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
+  </ui-application>
+</manifest>
diff --git a/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/tizen_dotnet_project.yaml b/tests/Apps/Launcher_TC_PLUGIN_11/Launcher_TC_PLUGIN_11/tizen_dotnet_project.yaml
new file mode 100755 (executable)
index 0000000..d5eb080
--- /dev/null
@@ -0,0 +1,9 @@
+# csproj file path
+csproj_file: Launcher_TC_PLUGIN_11.csproj
+
+# files monitored for dirty/modified status
+files:
+  - Launcher_TC_PLUGIN_11.csproj
+  - Launcher_TC_PLUGIN_11.cs
+  - tizen-manifest.xml
+  - shared/res/Launcher_TC_PLUGIN_11.png
\ No newline at end of file
index b6709fb..be55dce 100755 (executable)
@@ -303,6 +303,90 @@ def TC_10():
 
     return "PASS"
 
+# The `Launcher_TC_PLUGIN_11` application should not have a library of other architecture.
+def TC_11():
+    sln_name = "Launcher_TC_PLUGIN_11"
+
+    tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
+    if tpk_path == None:
+        return f"FAIL : Get the tpk path for {sln_name}"
+
+    if "OK" not in app_install(f"{tpk_path}"):
+        return f"FAIL : Install the application for {tpk_path}"
+
+    pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_11"
+
+    root_path = get_root_path(f"{pkg_id}")
+    if root_path == "None":
+        return f"FAIL : Get the root path for {pkg_id}"
+
+    device_abi = get_device_abi()
+    if "arm_32" == device_abi:
+        if not exist(f"{root_path}/lib/arm") or \
+           not exist(f"{root_path}/lib/armel") or \
+           exist(f"{root_path}/lib/aarch64") or \
+           exist(f"{root_path}/lib/arm64") or \
+           exist(f"{root_path}/lib/riscv32") or \
+           exist(f"{root_path}/lib/riscv64") or \
+           exist(f"{root_path}/lib/x64") or \
+           exist(f"{root_path}/lib/x86"):
+            return "FAIL"
+    elif "arm_64" == device_abi:
+        if exist(f"{root_path}/lib/arm") or \
+           exist(f"{root_path}/lib/armel") or \
+           not exist(f"{root_path}/lib/aarch64") or \
+           not exist(f"{root_path}/lib/arm64") or \
+           exist(f"{root_path}/lib/riscv32") or \
+           exist(f"{root_path}/lib/riscv64") or \
+           exist(f"{root_path}/lib/x64") or \
+           exist(f"{root_path}/lib/x86"):
+            return "FAIL"
+    elif "riscv_32" == device_abi:
+        if exist(f"{root_path}/lib/arm") or \
+           exist(f"{root_path}/lib/armel") or \
+           exist(f"{root_path}/lib/aarch64") or \
+           exist(f"{root_path}/lib/arm64") or \
+           not exist(f"{root_path}/lib/riscv32") or \
+           exist(f"{root_path}/lib/riscv64") or \
+           exist(f"{root_path}/lib/x64") or \
+           exist(f"{root_path}/lib/x86"):
+            return "FAIL"
+    elif "riscv_64" == device_abi:
+        if exist(f"{root_path}/lib/arm") or \
+           exist(f"{root_path}/lib/armel") or \
+           exist(f"{root_path}/lib/aarch64") or \
+           exist(f"{root_path}/lib/arm64") or \
+           exist(f"{root_path}/lib/riscv32") or \
+           not exist(f"{root_path}/lib/riscv64") or \
+           exist(f"{root_path}/lib/x64") or \
+           exist(f"{root_path}/lib/x86"):
+            return "FAIL"
+    elif "x86_64" == device_abi:
+        if exist(f"{root_path}/lib/arm") or \
+           exist(f"{root_path}/lib/armel") or \
+           exist(f"{root_path}/lib/aarch64") or \
+           exist(f"{root_path}/lib/arm64") or \
+           exist(f"{root_path}/lib/riscv32") or \
+           exist(f"{root_path}/lib/riscv64") or \
+           not exist(f"{root_path}/lib/x64") or \
+           exist(f"{root_path}/lib/x86"):
+            return "FAIL"
+    elif "x86" == device_abi:
+        if exist(f"{root_path}/lib/arm") or \
+           exist(f"{root_path}/lib/armel") or \
+           exist(f"{root_path}/lib/aarch64") or \
+           exist(f"{root_path}/lib/arm64") or \
+           exist(f"{root_path}/lib/riscv32") or \
+           exist(f"{root_path}/lib/riscv64") or \
+           exist(f"{root_path}/lib/x64") or \
+           not exist(f"{root_path}/lib/x86"):
+            return "FAIL"
+    else:
+        return "NONE - TC_11 is not supported on this platform"
+
+
+    return "PASS"
+
 # Run the test
 def run():
     cmd(f"root on")
@@ -335,6 +419,7 @@ def clean():
     cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_08.Tizen")
     cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_09.Tizen")
     cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_10.Tizen")
+    cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_11")
 
 # Main entry point
 def main():
@@ -352,7 +437,7 @@ def main():
             else:
                 tc_array.append(funcMap[tc_num])
     else:
-        tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08, TC_09, TC_10]
+        tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08, TC_09, TC_10, TC_11]
 
     global serial
     if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
@@ -372,9 +457,10 @@ def main():
 
 
 funcMap = {
-'TC_01': TC_01, 'TC_02': TC_02, 'TC_03': TC_03, 'TC_04': TC_04, 'TC_05': TC_05, 'TC_06': TC_06, 'TC_07': TC_07, 'TC_08': TC_08, 'TC_09': TC_09, 'TC_10': TC_10,
+'TC_01': TC_01, 'TC_02': TC_02, 'TC_03': TC_03, 'TC_04': TC_04, 'TC_05': TC_05,
+'TC_06': TC_06, 'TC_07': TC_07, 'TC_08': TC_08, 'TC_09': TC_09, 'TC_10': TC_10, 'TC_11': TC_11,
 'PLUGIN_TC_01': TC_01, 'PLUGIN_TC_02': TC_02, 'PLUGIN_TC_03': TC_03, 'PLUGIN_TC_04': TC_04, 'PLUGIN_TC_05': TC_05,
-'PLUGIN_TC_06': TC_06, 'PLUGIN_TC_07': TC_07, 'PLUGIN_TC_08': TC_08, 'PLUGIN_TC_09': TC_09, 'PLUGIN_TC_10': TC_10
+'PLUGIN_TC_06': TC_06, 'PLUGIN_TC_07': TC_07, 'PLUGIN_TC_08': TC_08, 'PLUGIN_TC_09': TC_09, 'PLUGIN_TC_10': TC_10, 'PLUGIN_TC_11': TC_11
 }
 
 
index b5e4af3..e302854 100755 (executable)
@@ -164,6 +164,12 @@ def get_device_arch():
     line = [l for l in raw.splitlines() if "cpu_arch" in l]
     return line[0].split(":")[1]
 
+# Get the device abi
+def get_device_abi():
+    raw = cmd("capability")
+    line = [l for l in raw.splitlines() if "core_abi" in l]
+    return line[0].split(":")[1]
+
 # Check the library type
 def check_library_arch(rootpath, library):
     raw = cmd(f"pull {rootpath}/bin/{library} {library}")