mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-30 01:55:55 +08:00
Merge pull request #19039 from Ultimaker/NP-186_seperate_cura_resources
Np 186 seperate cura resources
This commit is contained in:
commit
5e731b8575
40
.github/workflows/conan-package-resources.yml
vendored
Normal file
40
.github/workflows/conan-package-resources.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
name: conan-package-resources
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/conan-package-resources.yml'
|
||||||
|
- 'resources/definitions/**'
|
||||||
|
- 'resources/extruders/**'
|
||||||
|
- 'resources/images/**'
|
||||||
|
- 'resources/intent/**'
|
||||||
|
- 'resources/meshes/**'
|
||||||
|
- 'resources/quality/**'
|
||||||
|
- 'resources/variants/**'
|
||||||
|
- 'resources/conanfile.py'
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
- 'CURA-*'
|
||||||
|
- 'PP-*'
|
||||||
|
- 'NP-*'
|
||||||
|
- '[0-9].[0-9]*'
|
||||||
|
- '[0-9].[0-9][0-9]*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
|
||||||
|
CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
conan-recipe-version:
|
||||||
|
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main
|
||||||
|
with:
|
||||||
|
project_name: cura_resources
|
||||||
|
|
||||||
|
conan-package-export:
|
||||||
|
needs: [ conan-recipe-version ]
|
||||||
|
uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-export.yml@main
|
||||||
|
with:
|
||||||
|
recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
|
||||||
|
recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }}
|
||||||
|
conan_recipe_root: "./resources/"
|
||||||
|
secrets: inherit
|
13
.github/workflows/conan-package.yml
vendored
13
.github/workflows/conan-package.yml
vendored
@ -4,12 +4,20 @@ on:
|
|||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- 'plugins/**'
|
- 'plugins/**'
|
||||||
- 'resources/**'
|
|
||||||
- 'cura/**'
|
- 'cura/**'
|
||||||
|
- 'resources/bundled_packages/**'
|
||||||
|
- 'resources/i18n/**'
|
||||||
|
- 'resources/qml/**'
|
||||||
|
- 'resources/setting_visibility/**'
|
||||||
|
- 'resources/shaders/**'
|
||||||
|
- 'resources/texts/**'
|
||||||
|
- 'resources/themes/**'
|
||||||
|
- 'resources/public_key.pem'
|
||||||
|
- 'resources/README_resources.txt'
|
||||||
- 'icons/**'
|
- 'icons/**'
|
||||||
- 'tests/**'
|
- 'tests/**'
|
||||||
- 'packaging/**'
|
- 'packaging/**'
|
||||||
- '.github/workflows/conan-*.yml'
|
- '.github/workflows/conan-package.yml'
|
||||||
- '.github/workflows/notify.yml'
|
- '.github/workflows/notify.yml'
|
||||||
- '.github/workflows/requirements-runner.txt'
|
- '.github/workflows/requirements-runner.txt'
|
||||||
- 'requirements*.txt'
|
- 'requirements*.txt'
|
||||||
@ -20,6 +28,7 @@ on:
|
|||||||
- 'main'
|
- 'main'
|
||||||
- 'CURA-*'
|
- 'CURA-*'
|
||||||
- 'PP-*'
|
- 'PP-*'
|
||||||
|
- 'NP-*'
|
||||||
- '[0-9].[0-9]*'
|
- '[0-9].[0-9]*'
|
||||||
- '[0-9].[0-9][0-9]*'
|
- '[0-9].[0-9][0-9]*'
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
version: "5.8.0-alpha.0"
|
version: "5.8.0-alpha.0"
|
||||||
requirements:
|
requirements:
|
||||||
|
- "cura_resources/(latest)@ultimaker/latest"
|
||||||
- "uranium/(latest)@ultimaker/testing"
|
- "uranium/(latest)@ultimaker/testing"
|
||||||
- "curaengine/(latest)@ultimaker/testing"
|
- "curaengine/(latest)@ultimaker/testing"
|
||||||
- "cura_binary_data/(latest)@ultimaker/testing"
|
- "cura_binary_data/(latest)@ultimaker/testing"
|
||||||
@ -51,8 +52,8 @@ pyinstaller:
|
|||||||
src: "res/bundled_packages"
|
src: "res/bundled_packages"
|
||||||
dst: "share/cura/resources/bundled_packages"
|
dst: "share/cura/resources/bundled_packages"
|
||||||
cura_resources:
|
cura_resources:
|
||||||
package: "cura"
|
package: "cura_resources"
|
||||||
src: "resources"
|
src: "res"
|
||||||
dst: "share/cura/resources"
|
dst: "share/cura/resources"
|
||||||
cura_private_data:
|
cura_private_data:
|
||||||
package: "cura_private_data"
|
package: "cura_private_data"
|
||||||
|
12
conanfile.py
12
conanfile.py
@ -468,6 +468,12 @@ class CuraConan(ConanFile):
|
|||||||
copy(self, "*", os.path.join(self.package_folder, self.cpp_info.resdirs[0]), str(self._share_dir.joinpath("cura", "resources")), keep_path = True)
|
copy(self, "*", os.path.join(self.package_folder, self.cpp_info.resdirs[0]), str(self._share_dir.joinpath("cura", "resources")), keep_path = True)
|
||||||
copy(self, "*", os.path.join(self.package_folder, self.cpp_info.resdirs[1]), str(self._share_dir.joinpath("cura", "plugins")), keep_path = True)
|
copy(self, "*", os.path.join(self.package_folder, self.cpp_info.resdirs[1]), str(self._share_dir.joinpath("cura", "plugins")), keep_path = True)
|
||||||
|
|
||||||
|
# Copy the cura_resources resources from the package
|
||||||
|
rm(self, "conanfile.py", os.path.join(self.package_folder, self.cpp.package.resdirs[0]))
|
||||||
|
cura_resources = self.dependencies["cura_resources"].cpp_info
|
||||||
|
for res_dir in cura_resources.resdirs:
|
||||||
|
copy(self, "*", res_dir, str(self._share_dir.joinpath("cura", "resources", Path(res_dir).name)), keep_path = True)
|
||||||
|
|
||||||
# Copy resources of Uranium (keep folder structure)
|
# Copy resources of Uranium (keep folder structure)
|
||||||
uranium = self.dependencies["uranium"].cpp_info
|
uranium = self.dependencies["uranium"].cpp_info
|
||||||
copy(self, "*", uranium.resdirs[0], str(self._share_dir.joinpath("uranium", "resources")), keep_path = True)
|
copy(self, "*", uranium.resdirs[0], str(self._share_dir.joinpath("uranium", "resources")), keep_path = True)
|
||||||
@ -519,6 +525,12 @@ echo "CURA_APP_NAME={{ cura_app_name }}" >> ${{ env_prefix }}GITHUB_ENV
|
|||||||
# Remove the fdm_materials from the package
|
# Remove the fdm_materials from the package
|
||||||
rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[0], "materials"))
|
rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[0], "materials"))
|
||||||
|
|
||||||
|
# Remove the cura_resources resources from the package
|
||||||
|
rm(self, "conanfile.py", os.path.join(self.package_folder, self.cpp.package.resdirs[0]))
|
||||||
|
cura_resources = self.dependencies["cura_resources"].cpp_info
|
||||||
|
for res_dir in cura_resources.resdirs:
|
||||||
|
rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[0], Path(res_dir).name))
|
||||||
|
|
||||||
def package_info(self):
|
def package_info(self):
|
||||||
self.user_info.pip_requirements = "requirements.txt"
|
self.user_info.pip_requirements = "requirements.txt"
|
||||||
self.user_info.pip_requirements_git = "requirements-ultimaker.txt"
|
self.user_info.pip_requirements_git = "requirements-ultimaker.txt"
|
||||||
|
64
resources/conanfile.py
Normal file
64
resources/conanfile.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from conan import ConanFile
|
||||||
|
from conan.tools.files import copy, update_conandata
|
||||||
|
from conan.tools.scm import Version
|
||||||
|
from conan.errors import ConanInvalidConfiguration
|
||||||
|
|
||||||
|
required_conan_version = ">=1.58.0 <2.0.0"
|
||||||
|
|
||||||
|
|
||||||
|
class CuraResource(ConanFile):
|
||||||
|
name = "cura_resources"
|
||||||
|
license = ""
|
||||||
|
author = "UltiMaker"
|
||||||
|
url = "https://github.com/Ultimaker/cura"
|
||||||
|
description = "Cura Resources"
|
||||||
|
topics = ("conan", "cura")
|
||||||
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
|
no_copy_source = True
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _shared_resources(self):
|
||||||
|
return ["definitions", "extruders", "images", "intent", "meshes", "quality", "variants"]
|
||||||
|
|
||||||
|
def set_version(self):
|
||||||
|
if not self.version:
|
||||||
|
self.version = self.conan_data["version"]
|
||||||
|
|
||||||
|
def export(self):
|
||||||
|
copy(self, pattern="conandata.yml", src=os.path.join(self.recipe_folder, ".."), dst=self.export_folder,
|
||||||
|
keep_path=False)
|
||||||
|
copy(self, pattern="LICENSE*", src=os.path.join(self.recipe_folder, ".."), dst=self.export_folder,
|
||||||
|
keep_path=False)
|
||||||
|
update_conandata(self, {"version": self.version})
|
||||||
|
|
||||||
|
def export_sources(self):
|
||||||
|
for shared_resources in self._shared_resources:
|
||||||
|
copy(self, pattern="*", src=os.path.join(self.recipe_folder, shared_resources),
|
||||||
|
dst=os.path.join(self.export_sources_folder, shared_resources))
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
if Version(self.version) <= Version("4"):
|
||||||
|
raise ConanInvalidConfiguration("Only versions 5+ are support")
|
||||||
|
|
||||||
|
def layout(self):
|
||||||
|
self.cpp.source.resdirs = self._shared_resources
|
||||||
|
self.cpp.package.resdirs = [f"res/{res}" for res in self._shared_resources]
|
||||||
|
|
||||||
|
def package(self):
|
||||||
|
copy(self, "*", os.path.join(self.export_sources_folder),
|
||||||
|
os.path.join(self.package_folder, "res"))
|
||||||
|
|
||||||
|
def package_info(self):
|
||||||
|
self.cpp_info.includedirs = []
|
||||||
|
self.runenv_info.append_path("CURA_RESOURCES", os.path.join(self.package_folder, "res"))
|
||||||
|
self.runenv_info.append_path("CURA_ENGINE_SEARCH_PATH", os.path.join(self.package_folder, "res", "definitions"))
|
||||||
|
self.runenv_info.append_path("CURA_ENGINE_SEARCH_PATH", os.path.join(self.package_folder, "res", "extruders"))
|
||||||
|
self.env_info.CURA_RESOURCES.append(os.path.join(self.package_folder, "res"))
|
||||||
|
self.env_info.CURA_ENGINE_SEARCH_PATH.append(os.path.join(self.package_folder, "res", "definitions"))
|
||||||
|
self.env_info.CURA_ENGINE_SEARCH_PATH.append(os.path.join(self.package_folder, "res", "definitions"))
|
||||||
|
|
||||||
|
def package_id(self):
|
||||||
|
self.info.clear()
|
Loading…
x
Reference in New Issue
Block a user