diff --git a/.github/workflows/intellij-plugin-branch.yml b/.github/workflows/intellij-plugin-branch.yml deleted file mode 100644 index 333312b9..00000000 --- a/.github/workflows/intellij-plugin-branch.yml +++ /dev/null @@ -1,101 +0,0 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - -name: IntelliJ Plugin Branch Release -on: - push: - tags: '*' - branches: '*' - workflow_dispatch: - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - cache: maven - - name: Set up Git Config - run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" - - name: Build with Maven - run: | - cd shared - mvn install - cd ../cli - mvn install - - - name: Grant execute permission for gradlew - run: | - cd jdeploy-intellij-plugin - chmod +x ./gradlew - - - name: Build Plugin - run: | - cd jdeploy-intellij-plugin - ./gradlew buildPlugin - - - name: Archive production artifacts - uses: actions/upload-artifact@v2 - with: - name: plugin - path: | - jdeploy-intellij-plugin/build/distributions/*.zip - - release: - needs: build - runs-on: ubuntu-latest - if: github.event_name == 'push' && !startsWith(github.ref, 'refs/pull/') - steps: - - uses: actions/checkout@v2 - - - name: Download Artifact - uses: actions/download-artifact@v2 - with: - name: plugin - - - name: List plugin contents - run: find . - shell: bash - - - name: Get the version - id: get_version - run: | - echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/*/})" - shell: bash - - - name: Delete Existing Release if Present - run: | - if gh release view jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }}; then - gh release delete jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }} - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }} - release_name: jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }} - draft: false - prerelease: false - - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./plugin/jdeploy-intellij-plugin.zip - asset_name: jdeploy-intellij-plugin-${{ steps.get_version.outputs.version }}.zip - asset_content_type: application/zip diff --git a/.idea/vcs.xml b/.idea/vcs.xml index f1c6209c..a868dbfb 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,9 +2,6 @@ - - - \ No newline at end of file diff --git a/cli/src/main/java/ca/weblite/jdeploy/builders/ProjectGeneratorRequestBuilder.java b/cli/src/main/java/ca/weblite/jdeploy/builders/ProjectGeneratorRequestBuilder.java index fa4f8ecd..e0829d23 100644 --- a/cli/src/main/java/ca/weblite/jdeploy/builders/ProjectGeneratorRequestBuilder.java +++ b/cli/src/main/java/ca/weblite/jdeploy/builders/ProjectGeneratorRequestBuilder.java @@ -19,6 +19,9 @@ public class ProjectGeneratorRequestBuilder implements ProjectGeneratorRequest.P @CommandLineParser.Help("Whether the repository should be private") private boolean privateRepository; + @CommandLineParser.Help("Whether to use an existing directory") + private boolean useExistingDirectory; + @CommandLineParser.PositionalArg(1) @CommandLineParser.Help("The fully-qualified main class name. If not specified, will be inferred from the package name and project name.") private String magicArg; @@ -80,6 +83,11 @@ public ProjectGeneratorRequest.Params setProjectName(String projectName) { return this; } + public ProjectGeneratorRequest.Params setUseExistingDirectory(boolean useExistingDirectory) { + this.useExistingDirectory = useExistingDirectory; + return this; + } + public String getProjectName() { if (projectName != null) { return projectName; @@ -400,6 +408,11 @@ public boolean isPrivateRepository() { return privateRepository; } + @Override + public boolean isUseExistingDirectory() { + return useExistingDirectory; + } + private String getGithubUser() { String repo = getGithubRepository(); if (repo != null) { diff --git a/cli/src/main/java/ca/weblite/jdeploy/dtos/ProjectGeneratorRequest.java b/cli/src/main/java/ca/weblite/jdeploy/dtos/ProjectGeneratorRequest.java index b99b4845..72c3686b 100644 --- a/cli/src/main/java/ca/weblite/jdeploy/dtos/ProjectGeneratorRequest.java +++ b/cli/src/main/java/ca/weblite/jdeploy/dtos/ProjectGeneratorRequest.java @@ -23,6 +23,8 @@ public class ProjectGeneratorRequest { private final boolean privateRepository; + private final boolean useExistingDirectory; + public File getParentDirectory() { return parentDirectory; } @@ -71,6 +73,10 @@ public boolean isPrivateRepository() { return privateRepository; } + public boolean isUseExistingDirectory() { + return useExistingDirectory; + } + public interface Params { @CommandLineParser.Help("The github repository to use. E.g. \"username/repo\". If not specified, will be inferred from the package name and project name.") @@ -80,6 +86,10 @@ public interface Params { @CommandLineParser.Alias("p") boolean isPrivateRepository(); + @CommandLineParser.Help("Use existing directory") + @CommandLineParser.Alias("e") + boolean isUseExistingDirectory(); + @CommandLineParser.PositionalArg(1) @CommandLineParser.Help("The fully-qualified main class name. If not specified, will be inferred from the package name and project name.") String getMagicArg(); @@ -151,6 +161,8 @@ public interface Params { Params setPrivateRepository(boolean privateRepository); + Params setUseExistingDirectory(boolean useExistingDirectory); + Params setExtensions(String[] extensions); Params setWithCheerpj(boolean withCheerpj); @@ -170,6 +182,7 @@ public ProjectGeneratorRequest(Params params) { this.extensions = params.getExtensions(); this.githubRepository = params.getGithubRepository(); this.privateRepository = params.isPrivateRepository(); + this.useExistingDirectory = params.isUseExistingDirectory(); } } diff --git a/cli/src/main/java/ca/weblite/jdeploy/services/ProjectGenerator.java b/cli/src/main/java/ca/weblite/jdeploy/services/ProjectGenerator.java index 0924c64b..2a5137b0 100644 --- a/cli/src/main/java/ca/weblite/jdeploy/services/ProjectGenerator.java +++ b/cli/src/main/java/ca/weblite/jdeploy/services/ProjectGenerator.java @@ -65,7 +65,7 @@ public File generate(ProjectGeneratorRequest request) throws Exception { request.getParentDirectory(), stringUtils.camelCaseToLowerCaseWithSeparator(request.getProjectName(), "-") ); - if ( projectDir.exists() ) { + if (!request.isUseExistingDirectory() && projectDir.exists() ) { throw new Exception("Project directory already exists: " + projectDir.getAbsolutePath()); } projectDir.mkdirs();