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

[NADE] Add feature check to allow codegen #1048

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,13 @@ def process(
src_py_file_to_collected_entities[dest_file] = collected_entities

if collected_entities is None:
cc.message("No entities could be collected from the file path.")
continue

cc.message(f"This is the file path in deploy root: {dest_file}\n")
cc.message("This is the list of collected entities:")
cc.message(collected_entities)

# 4. Enrich entities by setting additional properties
for entity in collected_entities:
_enrich_entity(
Expand Down
13 changes: 12 additions & 1 deletion src/snowflake/cli/plugins/nativeapp/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
source_path_to_deploy_path,
translate_artifact,
)
from snowflake.cli.plugins.nativeapp.codegen.compiler import (
_find_and_execute_processors,
)
from snowflake.cli.plugins.nativeapp.constants import (
ALLOWED_SPECIAL_COMMENTS,
COMMENT_COL,
Expand All @@ -47,6 +50,7 @@
MissingPackageScriptError,
UnexpectedOwnerError,
)
from snowflake.cli.plugins.nativeapp.feature_flags import FeatureFlag
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is not the gist of the change but should we consider renaming FeatureFlag to NativeAppFeatureFlags? In this way we may avoid any ambiguity with existing snowflake.cli.api.feature_flags.FeatureFlag. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it common already to have the same files in multiple plugin directories if they define the same concepts? I'm thinking commands and manager, for example. Native apps code shouldn't rely on feature flags outside of its own IMHO, so at least now there shouldn't be ambiguity.

from snowflake.cli.plugins.nativeapp.utils import verify_exists, verify_no_directories
from snowflake.cli.plugins.stage.diff import (
DiffResult,
Expand Down Expand Up @@ -309,7 +313,14 @@ def build_bundle(self) -> ArtifactDeploymentMap:
"""
Populates the local deploy root from artifact sources.
"""
return build_bundle(self.project_root, self.deploy_root, self.artifacts)
mapped_files = build_bundle(self.project_root, self.deploy_root, self.artifacts)
if FeatureFlag.ENABLE_SETUP_SCRIPT_GENERATION.is_enabled():
_find_and_execute_processors(
sfc-gh-bdufour marked this conversation as resolved.
Show resolved Hide resolved
project_definition=self._project_definition,
project_root=self.project_root,
deploy_root=self.deploy_root,
)
return mapped_files

def sync_deploy_root_with_stage(
self,
Expand Down
Loading