diff --git a/.github/workflows/cleanup.yaml b/.github/workflows/cleanup.yaml index 16eb925..19098bf 100644 --- a/.github/workflows/cleanup.yaml +++ b/.github/workflows/cleanup.yaml @@ -27,7 +27,7 @@ jobs: git config --local user.name "GitHub Action" owner=$(echo $GITHUB_REPOSITORY | cut -d/ -f1 | tr '[:upper:]' '[:lower:]') name=$(echo $GITHUB_REPOSITORY | cut -d/ -f2 | tr '[:upper:]' '[:lower:]' | tr -d "-" | tr -d ".") - ./change_package_name.sh com.github.${owner,,}.${name,,} "$(echo $GITHUB_REPOSITORY | cut -d/ -f2)" + ./change_package_name.sh $GITHUB_REPOSITORY # Push changes - name: Push changes uses: ad-m/github-push-action@v0.6.0 diff --git a/build.gradle.kts b/build.gradle.kts index 70a3f42..47ed4bb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,14 @@ plugins { kotlin("jvm") version "1.8.20" - `maven-publish` } -group = "org.example.detekt" -version = "1.0-SNAPSHOT" +buildscript { + dependencies { + classpath("com.vanniktech:gradle-maven-publish-plugin:0.21.0") + } +} + +apply(plugin="com.vanniktech.maven.publish") dependencies { compileOnly("io.gitlab.arturbosch.detekt:detekt-api:1.22.0") @@ -23,11 +27,3 @@ tasks.withType().configureEach { systemProperty("junit.jupiter.testinstance.lifecycle.default", "per_class") systemProperty("compile-snippet-tests", project.hasProperty("compile-test-snippets")) } - -publishing { - publications { - create("mavenJava") { - from(components["java"]) - } - } -} diff --git a/change_package_name.sh b/change_package_name.sh index dd0f8de..44741f8 100755 --- a/change_package_name.sh +++ b/change_package_name.sh @@ -1,15 +1,20 @@ #!/usr/bin/env bash -package_name=$1 +github_repository=$1 +owner=$(echo $github_repository | cut -d/ -f1 | tr '[:upper:]' '[:lower:]') +name=$(echo $github_repository | cut -d/ -f2 | tr '[:upper:]' '[:lower:]' | tr -d "-" | tr -d ".") +package_name="com.github.${owner}.${name}" directory=$(echo $package_name | tr "." "/") -repo_name=$2 +repo_name=$(echo $github_repository | cut -d/ -f2) mkdir -p src/main/kotlin/$directory mkdir -p src/test/kotlin/$directory -find src/main src/test -type f -exec sed -i s/org.example.detekt/$package_name/g {} + -sed -i s/org.example.detekt/$package_name/g build.gradle.kts -sed -i s/detekt-custom-rule/$repo_name/g settings.gradle.kts +find src/main src/test -type f -exec sed -i "s/org.example.detekt/$package_name/g" {} + + +sed -i "s/org.example.detekt/com.github.${owner}/g" build.gradle.kts gradle.properties +sed -i "s/detekt-custom-rule/$repo_name/g" settings.gradle.kts gradle.properties +sed -i "s|github.com/example/custom-rule|github.com/$github_repository|g" gradle.properties mv src/main/kotlin/org/example/detekt/* src/main/kotlin/$directory mv src/test/kotlin/org/example/detekt/* src/test/kotlin/$directory diff --git a/gradle.properties b/gradle.properties index 7fc6f1f..803d3a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,20 @@ -kotlin.code.style=official +GROUP=org.example.detekt +POM_ARTIFACT_ID=detekt-custom-rule +VERSION_NAME=0.0.1 + +POM_NAME=detekt-custom-rule +POM_DESCRIPTION=A description for my RuleSet. +POM_INCEPTION_YEAR=2022 +POM_URL=https://github.com/example/custom-rule/ + +POM_LICENSE_NAME= +POM_LICENSE_URL= +POM_LICENSE_DIST=repo + +POM_SCM_URL=https://github.com/example/custom-rule/ +POM_SCM_CONNECTION=scm:git:git://github.com/example/custom-rule.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/example/custom-rule.git + +POM_DEVELOPER_ID=username +POM_DEVELOPER_NAME=User Name +POM_DEVELOPER_URL=https://github.com/username/