-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19039 from Ultimaker/NP-186_seperate_cura_resources
Np 186 seperate cura resources
- Loading branch information
Showing
5 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |