Class Project
- java.lang.Object
-
- software.amazon.jsii.JsiiObject
-
- software.constructs.Construct
-
- io.github.cdklabs.projen.Project
-
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
- Direct Known Subclasses:
GitHubProject
@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-03-28T21:16:42.781Z") @Stability(Experimental) public class Project extends software.constructs.Construct
(experimental) Base project.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProject.Builder(experimental) A fluent builder forProject.
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_TASK(experimental) The name of the default task (the task executed whenprojenis run without arguments).
-
Constructor Summary
Constructors Modifier Constructor Description Project(ProjectOptions options)protectedProject(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)protectedProject(software.amazon.jsii.JsiiObjectRef objRef)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddExcludeFromCleanup(@NotNull String... globs)(experimental) Exclude the matching files from pre-synth cleanup.voidaddGitIgnore(String pattern)(experimental) Adds a .gitignore pattern.voidaddPackageIgnore(String _pattern)(experimental) Exclude these files from the bundled package.TaskaddTask(String name)(experimental) Adds a new task to this project.TaskaddTask(String name, TaskOptions props)(experimental) Adds a new task to this project.voidaddTip(String message)Deprecated.useproject.logger.info(message)to show messages during synthesisvoidannotateGenerated(String _glob)(experimental) Consider a set of files as "generated".TaskgetBuildTask()BooleangetCommitGenerated()(experimental) Whether to commit the managed files by default.TaskgetCompileTask()List<Component>getComponents()(experimental) Returns all the components within this project.TaskgetDefaultTask()(experimental) This is the "default" task, the one that executes "projen".DependenciesgetDeps()(experimental) Project dependencies.BooleangetEjected()(experimental) Whether or not the project is being ejected.List<FileBase>getFiles()(experimental) All files in this project.GitAttributesFilegetGitattributes()(experimental) The .gitattributes file for this repository.IgnoreFilegetGitignore()(experimental) .gitignore.InitProjectgetInitProject()(experimental) The options used when this project is bootstrapped viaprojen new.LoggergetLogger()(experimental) Logging utilities.StringgetName()(experimental) Project name.StringgetOutdir()(experimental) Absolute output directory of this project.TaskgetPackageTask()ProjectgetParent()(experimental) A parent project.TaskgetPostCompileTask()TaskgetPreCompileTask()ProjectBuildgetProjectBuild()(experimental) Manages the build process of the project.StringgetProjenCommand()(experimental) The command to use in order to run the projen CLI.ProjectgetRoot()(experimental) The root project.List<Project>getSubprojects()(experimental) Returns all the subprojects within this project.TasksgetTasks()(experimental) Project tasks.TaskgetTestTask()static BooleanisProject(Object x)(experimental) Test whether the given construct is a project.static Projectof(software.constructs.IConstruct construct)(experimental) Find the closest ancestor project for given construct.voidpostSynthesize()(experimental) Called after all components are synthesized.voidpreSynthesize()(experimental) Called before all components are synthesized.TaskremoveTask(String name)(experimental) Removes a task from a project.StringrunTaskCommand(Task task)(experimental) Returns the shell command to execute in order to run a task.voidsynth()(experimental) Synthesize all project files intooutdir.FileBasetryFindFile(String filePath)(experimental) Finds a file at the specified relative path within this project and all its subprojects.JsonFiletryFindJsonFile(String filePath)Deprecated.usetryFindObjectFileObjectFiletryFindObjectFile(String filePath)(experimental) Finds an object file (like JsonFile, YamlFile, etc.) by name.FileBasetryRemoveFile(String filePath)(experimental) Finds a file at the specified relative path within this project and removes it.-
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
-
-
-
-
Field Detail
-
DEFAULT_TASK
@Stability(Experimental) public static final String DEFAULT_TASK
(experimental) The name of the default task (the task executed whenprojenis run without arguments).Normally this task should synthesize the project files.
-
-
Constructor Detail
-
Project
protected Project(software.amazon.jsii.JsiiObjectRef objRef)
-
Project
protected Project(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
Project
@Stability(Experimental) public Project(@NotNull ProjectOptions options)- Parameters:
options- This parameter is required.
-
-
Method Detail
-
isProject
@Stability(Experimental) @NotNull public static Boolean isProject(@NotNull Object x)
(experimental) Test whether the given construct is a project.- Parameters:
x- This parameter is required.
-
of
@Stability(Experimental) @NotNull public static Project of(@NotNull software.constructs.IConstruct construct)
(experimental) Find the closest ancestor project for given construct.When given a project, this it the project itself.
- Parameters:
construct- This parameter is required.
-
addExcludeFromCleanup
@Stability(Experimental) public void addExcludeFromCleanup(@NotNull @NotNull String... globs)(experimental) Exclude the matching files from pre-synth cleanup.Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.
- Parameters:
globs- The glob patterns to match. This parameter is required.
-
addGitIgnore
@Stability(Experimental) public void addGitIgnore(@NotNull String pattern)(experimental) Adds a .gitignore pattern.- Parameters:
pattern- The glob pattern to ignore. This parameter is required.
-
addPackageIgnore
@Stability(Experimental) public void addPackageIgnore(@NotNull String _pattern)(experimental) Exclude these files from the bundled package.Implemented by project types based on the packaging mechanism. For example,
NodeProjectdelegates this to.npmignore.- Parameters:
_pattern- The glob pattern to exclude. This parameter is required.
-
addTask
@Stability(Experimental) @NotNull public Task addTask(@NotNull String name, @Nullable TaskOptions props)
(experimental) Adds a new task to this project.This will fail if the project already has a task with this name.
- Parameters:
name- The task name to add. This parameter is required.props- Task properties.
-
addTask
@Stability(Experimental) @NotNull public Task addTask(@NotNull String name)
(experimental) Adds a new task to this project.This will fail if the project already has a task with this name.
- Parameters:
name- The task name to add. This parameter is required.
-
addTip
@Stability(Deprecated) @Deprecated public void addTip(@NotNull String message)
Deprecated.- use
project.logger.info(message)to show messages during synthesis
(deprecated) Prints a "tip" message during synthesis.- Parameters:
message- The message. This parameter is required.
- use
-
annotateGenerated
@Stability(Experimental) public void annotateGenerated(@NotNull String _glob)(experimental) Consider a set of files as "generated".This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.
- Parameters:
_glob- the glob pattern to match (could be a file path). This parameter is required.
-
postSynthesize
@Stability(Experimental) public void postSynthesize()
(experimental) Called after all components are synthesized.Order is not guaranteed.
-
preSynthesize
@Stability(Experimental) public void preSynthesize()
(experimental) Called before all components are synthesized.
-
removeTask
@Stability(Experimental) @Nullable public Task removeTask(@NotNull String name)
(experimental) Removes a task from a project.- Parameters:
name- The name of the task to remove. This parameter is required.- Returns:
- The
Taskthat was removed, otherwiseundefined.
-
runTaskCommand
@Stability(Experimental) @NotNull public String runTaskCommand(@NotNull Task task)
(experimental) Returns the shell command to execute in order to run a task.By default, this is
npx projen@<version> <task>- Parameters:
task- The task for which the command is required. This parameter is required.
-
synth
@Stability(Experimental) public void synth()
(experimental) Synthesize all project files intooutdir.- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
-
tryFindFile
@Stability(Experimental) @Nullable public FileBase tryFindFile(@NotNull String filePath)
(experimental) Finds a file at the specified relative path within this project and all its subprojects.- Parameters:
filePath- The file path. This parameter is required.- Returns:
- a
FileBaseor undefined if there is no file in that path
-
tryFindJsonFile
@Stability(Deprecated) @Deprecated @Nullable public JsonFile tryFindJsonFile(@NotNull String filePath)
Deprecated.usetryFindObjectFile(deprecated) Finds a json file by name.- Parameters:
filePath- The file path. This parameter is required.
-
tryFindObjectFile
@Stability(Experimental) @Nullable public ObjectFile tryFindObjectFile(@NotNull String filePath)
(experimental) Finds an object file (like JsonFile, YamlFile, etc.) by name.- Parameters:
filePath- The file path. This parameter is required.
-
tryRemoveFile
@Stability(Experimental) @Nullable public FileBase tryRemoveFile(@NotNull String filePath)
(experimental) Finds a file at the specified relative path within this project and removes it.- Parameters:
filePath- The file path. This parameter is required.- Returns:
- a
FileBaseif the file was found and removed, or undefined if the file was not found.
-
getBuildTask
@Stability(Experimental) @NotNull public Task getBuildTask()
-
getCommitGenerated
@Stability(Experimental) @NotNull public Boolean getCommitGenerated()
(experimental) Whether to commit the managed files by default.
-
getCompileTask
@Stability(Experimental) @NotNull public Task getCompileTask()
-
getComponents
@Stability(Experimental) @NotNull public List<Component> getComponents()
(experimental) Returns all the components within this project.
-
getDeps
@Stability(Experimental) @NotNull public Dependencies getDeps()
(experimental) Project dependencies.
-
getEjected
@Stability(Experimental) @NotNull public Boolean getEjected()
(experimental) Whether or not the project is being ejected.
-
getFiles
@Stability(Experimental) @NotNull public List<FileBase> getFiles()
(experimental) All files in this project.
-
getGitattributes
@Stability(Experimental) @NotNull public GitAttributesFile getGitattributes()
(experimental) The .gitattributes file for this repository.
-
getGitignore
@Stability(Experimental) @NotNull public IgnoreFile getGitignore()
(experimental) .gitignore.
-
getLogger
@Stability(Experimental) @NotNull public Logger getLogger()
(experimental) Logging utilities.
-
getName
@Stability(Experimental) @NotNull public String getName()
(experimental) Project name.
-
getOutdir
@Stability(Experimental) @NotNull public String getOutdir()
(experimental) Absolute output directory of this project.
-
getPackageTask
@Stability(Experimental) @NotNull public Task getPackageTask()
-
getPostCompileTask
@Stability(Experimental) @NotNull public Task getPostCompileTask()
-
getPreCompileTask
@Stability(Experimental) @NotNull public Task getPreCompileTask()
-
getProjectBuild
@Stability(Experimental) @NotNull public ProjectBuild getProjectBuild()
(experimental) Manages the build process of the project.
-
getProjenCommand
@Stability(Experimental) @NotNull public String getProjenCommand()
(experimental) The command to use in order to run the projen CLI.
-
getRoot
@Stability(Experimental) @NotNull public Project getRoot()
(experimental) The root project.
-
getSubprojects
@Stability(Experimental) @NotNull public List<Project> getSubprojects()
(experimental) Returns all the subprojects within this project.
-
getTasks
@Stability(Experimental) @NotNull public Tasks getTasks()
(experimental) Project tasks.
-
getTestTask
@Stability(Experimental) @NotNull public Task getTestTask()
-
getDefaultTask
@Stability(Experimental) @Nullable public Task getDefaultTask()
(experimental) This is the "default" task, the one that executes "projen".Undefined if the project is being ejected.
-
getInitProject
@Stability(Experimental) @Nullable public InitProject getInitProject()
(experimental) The options used when this project is bootstrapped viaprojen new.It includes the original set of options passed to the CLI and also the JSII FQN of the project type.
-
getParent
@Stability(Experimental) @Nullable public Project getParent()
(experimental) A parent project.If undefined, this is the root project.
-
-