diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3100d0a8..a79f9cc1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -78,6 +78,6 @@ jobs: BINTRAY_USER: ${{ secrets.BINTRAY_USER }} BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }} CLOJARS_USER: ${{ secrets.CLOJARS_USER }} - CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }} + CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }} GRADLE_OPTS: "-Dorg.gradle.project.gradle.publish.key=${{ secrets.GRADLE_PLUGIN_KEY }} -Dorg.gradle.project.gradle.publish.secret=${{ secrets.GRADLE_PLUGIN_SECRET }}" run: "./gradlew reckonTagPush publish publishPlugins -Preckon.scope=${{ github.event.inputs.scope }} -Preckon.stage=${{ github.event.inputs.stage }}" diff --git a/build.gradle b/build.gradle deleted file mode 100644 index fb76a279..00000000 --- a/build.gradle +++ /dev/null @@ -1,135 +0,0 @@ -plugins { - id 'org.ajoberstar.grgit' version '4.1.0' - id 'org.ajoberstar.reckon' version '0.13.0' - id 'com.diffplug.spotless' version '5.9.0' - - id 'dev.clojurephant.clojure' version '0.6.0-alpha.4' apply false - id 'org.ajoberstar.stutter' version '0.6.0' apply false - id 'com.gradle.plugin-publish' version '0.12.0' apply false -} - -/////////////////////////////////////////////////////////////////////////////// -// Dependencies -/////////////////////////////////////////////////////////////////////////////// -allprojects { - plugins.withId('java') { - repositories { - mavenCentral() - maven { - name = 'Clojars' - url = 'https://repo.clojars.org/' - } - } - } -} - -/////////////////////////////////////////////////////////////////////////////// -// Packaging -/////////////////////////////////////////////////////////////////////////////// -allprojects { - group = 'dev.clojurephant' - - plugins.withId('java') { - sourceCompatibility = 8 - - task sourcesJar(type: Jar) { - from sourceSets.main.allSource - classifier = 'sources' - } - } -} - -/////////////////////////////////////////////////////////////////////////////// -// Publishing -/////////////////////////////////////////////////////////////////////////////// -allprojects { - plugins.withId('maven-publish') { - // Publish to following repositories - publishing { - repositories { - maven { - name = 'bintray' - url = 'https://api.bintray.com/maven/clojurephant/maven/clojurephant/;publish=1' - credentials { - username = System.env['BINTRAY_USER'] - password = System.env['BINTRAY_KEY'] - } - } - maven { - name = 'clojars' - url = 'https://repo.clojars.org' - credentials { - username = System.env['CLOJARS_USER'] - password = System.env['CLOJARS_PASSWORD'] - } - } - } - publications.withType(MavenPublication) { - // use static versions in poms - versionMapping { - usage('java-api') { - fromResolutionOf('runtimeClasspath') - } - usage('java-runtime') { - fromResolutionResult() - } - } - - pom { - // include repository info in POM (needed for cljdoc) - scm { - connection = 'https://github.com/clojurephant/clojurephant.git' - developerConnection = 'git@github.com:clojurephant/clojurephant.git' - url = 'https://github.com/clojurephant/clojurephant' - if (!version.toString().contains('+')) { - tag = version.toString() - } - } - } - } - } - - // Clojars doesn't support module metadata - tasks.withType(GenerateModuleMetadata) { - enabled = false - } - } -} - -/////////////////////////////////////////////////////////////////////////////// -// Versioning and Release -/////////////////////////////////////////////////////////////////////////////// -reckon { - scopeFromProp() - stageFromProp('alpha', 'beta', 'rc', 'final') -} - -// make sure tests pass before tagging the version -allprojects { - tasks.matching { it.name == 'check' }.all { task -> - rootProject.tasks.reckonTagCreate.dependsOn task - } -} - -/////////////////////////////////////////////////////////////////////////////// -// Code Style and Formatting -/////////////////////////////////////////////////////////////////////////////// -allprojects { - apply plugin: 'com.diffplug.spotless' - - plugins.withId('java') { - spotless { - java { - importOrder 'java', 'javax', '' - removeUnusedImports() - eclipse().configFile rootProject.file('gradle/eclipse-java-formatter.xml') - } - format('gradle') { - target '**/*.gradle' - trimTrailingWhitespace() - indentWithSpaces(2) - endWithNewline() - } - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..2f022f99 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + id("org.ajoberstar.grgit") + id("org.ajoberstar.reckon") + id("com.diffplug.spotless") +} + +/////////////////////////////////////////////////////////////////////////////// +// Versioning and Release +/////////////////////////////////////////////////////////////////////////////// +reckon { + scopeFromProp() + stageFromProp("alpha", "beta", "rc", "final") +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 00000000..63b4ec85 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,13 @@ +plugins { + `kotlin-dsl` +} + +repositories { + jcenter() + maven(url = "https://repo.clojars.org") +} + +dependencies { + implementation("dev.clojurephant:clojurephant-plugin:0.6.0-alpha.4") + implementation("com.diffplug.spotless:spotless-plugin-gradle:5.9.0") +} diff --git a/buildSrc/src/main/kotlin/clj-new-template.gradle.kts b/buildSrc/src/main/kotlin/clj-new-template.gradle.kts new file mode 100644 index 00000000..3d861706 --- /dev/null +++ b/buildSrc/src/main/kotlin/clj-new-template.gradle.kts @@ -0,0 +1,72 @@ +import java.io.ByteArrayOutputStream +import org.apache.tools.ant.filters.ReplaceTokens +import org.gradle.util.GradleVersion + +plugins { + id("dev.clojurephant.clojure") + id("maven-publish") +} + +dependencies { + compileOnly("org.clojure:clojure:1.10.1") + compileOnly("seancorfield:clj-new:1.1.234") +} + +publishing { + publications { + create("main") { + group = project.name + artifactId = "clj-template" + from(components["java"]) + } + } +} + +tasks.named("processResources") { + eachFile { + if (name.endsWith(".gradle")) { + filter(ReplaceTokens::class, "tokens" to mapOf("clojurephant.version" to project.version.toString())) + } + } +} + +tasks.register("newProject") { + workingDir = file("${rootProject.projectDir}/templates-test") + classpath = files(sourceSets["main"].output, configurations["compileClasspath"]) + main = "clojure.main" + args("-m", "clj-new.create", project.name, "my.group/sample-${project.name}", "+localplugin") + doFirst { + workingDir.mkdirs() + delete("${workingDir}/sample-${project.name}") + } + dependsOn(tasks.jar) + dependsOn(":clojurephant-tools:publishToMavenLocal") + dependsOn(":clojurephant-plugin:publishToMavenLocal") +} + +tasks.register("verifyGradleVersion") { + dependsOn(tasks.named("newProject")) + + workingDir = file("${rootProject.projectDir}/templates-test/sample-${project.name}") + if (System.getProperty("os.name").toLowerCase().contains("windows")) { + executable = "gradlew.bat" + } else { + executable = "./gradlew" + } + args("--version") + + standardOutput = ByteArrayOutputStream() + doLast { + val out = standardOutput.toString() + val versionPattern = """Gradle (\d+\S+)""".toRegex() + val matchResult = versionPattern.find(out) + val (version) = matchResult!!.destructured + if (!GradleVersion.version(version).equals(GradleVersion.current())) { + throw GradleException("Templates have incorrect Gradle wrapper \"$version\". Run ./copy-wrapper.ps1 to update.") + } + } +} + +tasks.named("check") { + dependsOn(tasks.named("verifyGradleVersion")) +} diff --git a/buildSrc/src/main/kotlin/library-convention.gradle.kts b/buildSrc/src/main/kotlin/library-convention.gradle.kts new file mode 100644 index 00000000..2bae94d4 --- /dev/null +++ b/buildSrc/src/main/kotlin/library-convention.gradle.kts @@ -0,0 +1,96 @@ +plugins { + java + `maven-publish` + id("dev.clojurephant.clojure") + id("com.diffplug.spotless") +} + +/////////////////////////////////////////////////////////////////////////////// +// Dependencies +/////////////////////////////////////////////////////////////////////////////// +repositories { + mavenCentral() + maven { + name = "Clojars" + url = uri("https://repo.clojars.org/") + } +} + +/////////////////////////////////////////////////////////////////////////////// +// Packaging +/////////////////////////////////////////////////////////////////////////////// +group = "dev.clojurephant" + +configure { + sourceCompatibility = JavaVersion.VERSION_1_8 +} + +tasks.register("sourcesJar") { + from(sourceSets["main"].allSource) + archiveClassifier.set("sources") +} + +/////////////////////////////////////////////////////////////////////////////// +// Code Style and Formatting +/////////////////////////////////////////////////////////////////////////////// +spotless { + java { + importOrder("java", "javax", "") + removeUnusedImports() + eclipse().configFile(rootProject.file("gradle/eclipse-java-formatter.xml")) + } +} + +/////////////////////////////////////////////////////////////////////////////// +// Publishing +/////////////////////////////////////////////////////////////////////////////// + +// Publish to following repositories +publishing { + repositories { + maven { + name = "bintray" + url = uri("https://api.bintray.com/maven/clojurephant/maven/clojurephant/;publish=1") + credentials { + username = System.getenv("BINTRAY_USER") + password = System.getenv("BINTRAY_KEY") + } + } + maven { + name = "clojars" + url = uri("https://repo.clojars.org") + credentials { + username = System.getenv("CLOJARS_USER") + password = System.getenv("CLOJARS_TOKEN") + } + } + } + publications.withType() { + // use static versions in poms + versionMapping { + usage("java-api") { + fromResolutionOf("runtimeClasspath") + } + usage("java-runtime") { + fromResolutionResult() + } + } + + pom { + // include repository info in POM (needed for cljdoc) + scm { + connection.set("https://github.com/clojurephant/clojurephant.git") + developerConnection.set("git@github.com:clojurephant/clojurephant.git") + url.set("https://github.com/clojurephant/clojurephant") + if (!version.toString().contains("+")) { + tag.set(version.toString()) + } + } + } + } +} + +// Clojars doesn"t support module metadata +tasks.withType() { + enabled = false +} diff --git a/clojurephant-plugin/.stutter/java14.lock b/clojurephant-plugin/.stutter/java14.lock index 0aff1cbc..34ac33ed 100644 --- a/clojurephant-plugin/.stutter/java14.lock +++ b/clojurephant-plugin/.stutter/java14.lock @@ -1,4 +1,3 @@ # DO NOT MODIFY: Generated by Stutter plugin. 6.3 -6.7.1 -6.8-rc-5 +6.8 diff --git a/clojurephant-plugin/.stutter/java8.lock b/clojurephant-plugin/.stutter/java8.lock index 679cdcf1..0fb22242 100644 --- a/clojurephant-plugin/.stutter/java8.lock +++ b/clojurephant-plugin/.stutter/java8.lock @@ -2,5 +2,4 @@ 5.0 5.6.4 6.0.1 -6.7.1 -6.8-rc-5 +6.8 diff --git a/clojurephant-plugin/build.gradle b/clojurephant-plugin/build.gradle deleted file mode 100644 index 7f271139..00000000 --- a/clojurephant-plugin/build.gradle +++ /dev/null @@ -1,130 +0,0 @@ -plugins { - id 'java' - id 'dev.clojurephant.clojure' - id 'maven-publish' - id 'org.ajoberstar.stutter' - id 'java-gradle-plugin' - id 'com.gradle.plugin-publish' -} - -dependencies { - // gradle - compileOnly gradleApi() - - // edn support - implementation 'us.bpsm:edn-java:0.7.1' - - // util - implementation 'org.apache.commons:commons-text:1.9' - - // compat testing - compatTestImplementation gradleTestKit() - compatTestImplementation 'org.clojure:clojure:1.10.1' - compatTestImplementation 'org.clojure:tools.namespace:1.1.0' - compatTestImplementation 'nrepl:nrepl:0.8.3' - compatTestImplementation 'junit:junit:4.13.1' - compatTestImplementation 'org.ajoberstar:ike.cljj:0.4.1' -} - -task writeProperties(type: WriteProperties) { - outputFile = "${buildDir}/clojurephant.properties" - property 'version', version -} - -processResources { - from writeProperties -} - -stutter { - sparse = true - java(8) { - compatibleRange '5.0' - } - java(14) { - compatibleRange '6.3' - } -} - -plugins.withId('eclipse') { - eclipse.classpath.plusConfigurations += [configurations.compatTestCompileClasspath] -} - -sourceSets.compatTest.runtimeClasspath = files(compileCompatTestClojure, sourceSets.compatTest.runtimeClasspath) - -compileCompatTestClojure { - namespaces.add 'dev.clojurephant.tools.logger' - namespaces.add 'dev.clojurephant.tools.clojure-test-junit4' -} - -tasks.withType(Test).matching { it.name.startsWith('compatTest') }.all { - dependsOn ':clojurephant-tools:publishToMavenLocal' - - testClassesDirs = files(compileCompatTestClojure, sourceSets.compatTest.output) - - inputs.dir 'src/compatTest/projects' - systemProperty 'clojure.test.dirs', 'src/compatTest/clojure' - systemProperty 'stutter.projects', 'src/compatTest/projects' - systemProperty 'org.gradle.testkit.dir', file('build/stutter-test-kit').absolutePath -} - -publishing { - publications { - pluginMaven(MavenPublication) { - artifact sourcesJar - } - } -} - -gradlePlugin { - plugins { - clojureBase { - id = 'dev.clojurephant.clojure-base' - implementationClass = 'dev.clojurephant.plugin.clojure.ClojureBasePlugin' - } - clojure { - id = 'dev.clojurephant.clojure' - implementationClass = 'dev.clojurephant.plugin.clojure.ClojurePlugin' - } - clojurescriptBase { - id = 'dev.clojurephant.clojurescript-base' - implementationClass = 'dev.clojurephant.plugin.clojurescript.ClojureScriptBasePlugin' - } - clojurescript { - id = 'dev.clojurephant.clojurescript' - implementationClass = 'dev.clojurephant.plugin.clojurescript.ClojureScriptPlugin' - } - } -} - -pluginBundle { - website = 'https://clojurephant.dev/' - vcsUrl = 'https://github.com/clojurephant/clojurephant.git' - description = 'Clojure and ClojureScript language support for Gradle' - plugins { - clojureBase { - id = 'dev.clojurephant.clojure-base' - displayName = 'Clojure base language plugin for Gradle' - tags = ['clojure', 'language'] - } - clojure { - id = 'dev.clojurephant.clojure' - displayName = 'Clojure language plugin for Gradle' - tags = ['clojure', 'language'] - } - clojurescriptBase { - id = 'dev.clojurephant.clojurescript-base' - displayName = 'ClojureScript base language plugin for Gradle' - tags = ['clojurescript', 'language'] - } - clojurescript { - id = 'dev.clojurephant.clojurescript' - displayName = 'ClojureScript language plugin for Gradle' - tags = ['clojurescript', 'language'] - } - } - mavenCoordinates { - groupId = project.group - artifactId = project.name - version = project.version - } -} diff --git a/clojurephant-plugin/build.gradle.kts b/clojurephant-plugin/build.gradle.kts new file mode 100644 index 00000000..86522a92 --- /dev/null +++ b/clojurephant-plugin/build.gradle.kts @@ -0,0 +1,130 @@ +import dev.clojurephant.plugin.clojure.tasks.ClojureCompile +import org.gradle.plugins.ide.eclipse.model.EclipseModel + +plugins { + `library-convention` + `java-gradle-plugin` + + id("org.ajoberstar.stutter") + id("com.gradle.plugin-publish") +} + +dependencies { + // edn support + implementation("us.bpsm:edn-java:0.7.1") + + // util + implementation("org.apache.commons:commons-text:1.9") + + // compat testing + compatTestImplementation(gradleTestKit()) + compatTestImplementation("org.clojure:clojure:1.10.1") + compatTestImplementation("org.clojure:tools.namespace:1.1.0") + compatTestImplementation("nrepl:nrepl:0.8.3") + compatTestImplementation("junit:junit:4.13.1") + compatTestImplementation("org.ajoberstar:ike.cljj:0.4.1") +} + +tasks.register("writeProperties") { + outputFile = file("${buildDir}/clojurephant.properties") + property("version", version) +} + +tasks.named("processResources") { + from(tasks.named("writeProperties")) +} + +stutter { + setSparse(true) + java(8) { + compatibleRange("5.0") + } + java(14) { + compatibleRange("6.3") + } +} + +plugins.withId("eclipse") { + val eclipse = extensions.getByType(EclipseModel::class) + eclipse.classpath.plusConfigurations.add(configurations["compatTestCompileClasspath"]) +} + +sourceSets["compatTest"].runtimeClasspath = files(tasks.compileCompatTestClojure, sourceSets["compatTest"].runtimeClasspath) + +tasks.named("compileCompatTestClojure") { + namespaces.add("dev.clojurephant.tools.logger") + namespaces.add("dev.clojurephant.tools.clojure-test-junit4") +} + +tasks.withType().matching { t -> t.name.startsWith("compatTest") }.all { + dependsOn(":clojurephant-tools:publishToMavenLocal") + + testClassesDirs = files(tasks.compileCompatTestClojure, sourceSets["compatTest"].output) + + inputs.dir("src/compatTest/projects") + systemProperty("clojure.test.dirs", "src/compatTest/clojure") + systemProperty("stutter.projects", "src/compatTest/projects") + systemProperty("org.gradle.testkit.dir", file("build/stutter-test-kit").absolutePath) +} + +publishing { + publications { + create("pluginMaven") { + artifact(tasks.sourcesJar) + } + } +} + +gradlePlugin { + plugins { + create("clojureBase") { + id = "dev.clojurephant.clojure-base" + implementationClass = "dev.clojurephant.plugin.clojure.ClojureBasePlugin" + } + create("clojure") { + id = "dev.clojurephant.clojure" + implementationClass = "dev.clojurephant.plugin.clojure.ClojurePlugin" + } + create("clojurescriptBase") { + id = "dev.clojurephant.clojurescript-base" + implementationClass = "dev.clojurephant.plugin.clojurescript.ClojureScriptBasePlugin" + } + create("clojurescript") { + id = "dev.clojurephant.clojurescript" + implementationClass = "dev.clojurephant.plugin.clojurescript.ClojureScriptPlugin" + } + } +} + +pluginBundle { + website = "https://clojurephant.dev/" + vcsUrl = "https://github.com/clojurephant/clojurephant.git" + description = "Clojure and ClojureScript language support for Gradle" + (plugins) { + "clojureBase" { + id = "dev.clojurephant.clojure-base" + displayName = "Clojure base language plugin for Gradle" + tags = listOf("clojure", "language") + } + "clojure" { + id = "dev.clojurephant.clojure" + displayName = "Clojure language plugin for Gradle" + tags = listOf("clojure", "language") + } + "clojurescriptBase" { + id = "dev.clojurephant.clojurescript-base" + displayName = "ClojureScript base language plugin for Gradle" + tags = listOf("clojurescript", "language") + } + "clojurescript" { + id = "dev.clojurephant.clojurescript" + displayName = "ClojureScript language plugin for Gradle" + tags = listOf("clojurescript", "language") + } + } + mavenCoordinates { + groupId = project.group.toString() + artifactId = project.name.toString() + version = project.version.toString() + } +} diff --git a/clojurephant-tools/build.gradle b/clojurephant-tools/build.gradle deleted file mode 100644 index c5aa8ab5..00000000 --- a/clojurephant-tools/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -plugins { - id 'dev.clojurephant.clojure' - id 'maven-publish' -} - -dependencies { - // gradle - compileOnly gradleApi() - - // clojure runtime - compileOnly 'org.clojure:clojure:1.10.1' - compileOnly 'org.clojure:clojurescript:1.10.773' - compileOnly 'nrepl:nrepl:0.8.3' - compileOnly 'com.bhauman:figwheel-main:0.2.12' - compileOnly 'junit:junit:4.13.1' -} - -publishing { - publications { - main(MavenPublication) { - from components.java - artifact sourcesJar - } - } -} - -compileClojure { - // prevent it from trying to compile (since there's a circular dependency) - namespaces = [] -} - -checkClojure { - // prevent it from trying to compile (since there's a circular dependency) - enabled = false -} diff --git a/clojurephant-tools/build.gradle.kts b/clojurephant-tools/build.gradle.kts new file mode 100644 index 00000000..85eadea1 --- /dev/null +++ b/clojurephant-tools/build.gradle.kts @@ -0,0 +1,34 @@ +import dev.clojurephant.plugin.clojure.tasks.ClojureCheck +import dev.clojurephant.plugin.clojure.tasks.ClojureCompile + +plugins { + `library-convention` +} + +dependencies { + // clojure runtime + compileOnly("org.clojure:clojure:1.10.1") + compileOnly("org.clojure:clojurescript:1.10.773") + compileOnly("nrepl:nrepl:0.8.3") + compileOnly("com.bhauman:figwheel-main:0.2.12") + compileOnly("junit:junit:4.13.1") +} + +publishing { + publications { + create("main") { + from(components["java"]) + artifact(tasks.sourcesJar) + } + } +} + +tasks.named("compileClojure") { + // prevent it from trying to compile (since there"s a circular dependency) + namespaces.set(setOf()) +} + +tasks.named("checkClojure") { + // prevent it from trying to compile (since there"s a circular dependency) + enabled = false +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 490fda85..e708b1c0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4d9ca164..da9702f9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 2fe81a7d..4f906e0c 100755 --- a/gradlew +++ b/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 9109989e..ac1b06f9 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 1a99994b..00000000 --- a/settings.gradle +++ /dev/null @@ -1,8 +0,0 @@ -rootProject.name = 'clojurephant' -include 'clojurephant-plugin' -include 'clojurephant-tools' - -// templates -include 'templates:clojurephant-clj-lib' -include 'templates:clojurephant-clj-app' -include 'templates:clojurephant-cljs-app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..f1b4f991 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,20 @@ +pluginManagement { + plugins { + id("org.ajoberstar.grgit") version("4.1.0") + id("org.ajoberstar.reckon") version("0.13.0") + id("com.diffplug.spotless") version("5.9.0") + + id("dev.clojurephant.clojure") version("0.6.0-alpha.4") + id("org.ajoberstar.stutter") version("0.6.0") + id("com.gradle.plugin-publish") version("0.12.0") + } +} + +rootProject.name = "clojurephant" +include("clojurephant-plugin") +include("clojurephant-tools") + +// templates +include("templates:clojurephant-clj-lib") +include("templates:clojurephant-clj-app") +include("templates:clojurephant-cljs-app") diff --git a/templates/build.gradle b/templates/build.gradle deleted file mode 100644 index f718157d..00000000 --- a/templates/build.gradle +++ /dev/null @@ -1,62 +0,0 @@ -subprojects { - apply plugin: 'dev.clojurephant.clojure' - apply plugin: 'maven-publish' - - dependencies { - compileOnly 'org.clojure:clojure:1.10.1' - compileOnly 'seancorfield:clj-new:1.1.234' - } - - publishing { - publications { - main(MavenPublication) { - group = project.name - artifactId = 'clj-template' - from components.java - } - } - } - - processResources { - eachFile { details -> - if (details.name.endsWith('.gradle')) { - details.filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: ['clojurephant.version': project.version.toString()]) - } - } - } - - task newProject(type: JavaExec) { - workingDir = file("${rootProject.projectDir}/templates-test") - classpath = files(sourceSets.main.output, configurations.compileClasspath) - main = 'clojure.main' - args '-m', 'clj-new.create', project.name, "my.group/sample-${project.name}", '+localplugin' - doFirst { - workingDir.mkdirs() - delete("${workingDir}/sample-${project.name}") - } - dependsOn jar - dependsOn ':clojurephant-tools:publishToMavenLocal' - dependsOn ':clojurephant-plugin:publishToMavenLocal' - } - - task verifyGradleVersion(type: Exec, dependsOn: newProject) { - workingDir = file("${rootProject.projectDir}/templates-test/sample-${project.name}") - if (System.properties['os.name'].toLowerCase().contains('windows')) { - executable = 'gradlew.bat' - } else { - executable = './gradlew' - } - args '--version' - - standardOutput = new ByteArrayOutputStream() - doLast { - def out = standardOutput.toString() - def version = (out =~ /Gradle (\d+\S+)/)[0][1] - if (org.gradle.util.GradleVersion.version(version) != org.gradle.util.GradleVersion.current()) { - throw new GradleException("Templates have incorrect Gradle wrapper \"$version\". Run ./copy-wrapper.ps1 to update.") - } - } - } - - check.dependsOn verifyGradleVersion -} diff --git a/templates/clojurephant-clj-app/build.gradle.kts b/templates/clojurephant-clj-app/build.gradle.kts new file mode 100644 index 00000000..d670f0a4 --- /dev/null +++ b/templates/clojurephant-clj-app/build.gradle.kts @@ -0,0 +1,4 @@ +plugins { + `clj-new-template` + `library-convention` +} diff --git a/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradle-wrapper.jar b/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradle-wrapper.jar index 490fda85..e708b1c0 100644 Binary files a/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradle-wrapper.jar and b/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradle-wrapper.jar differ diff --git a/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradle-wrapper.properties b/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradle-wrapper.properties index 4d9ca164..da9702f9 100644 --- a/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradle-wrapper.properties +++ b/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradlew b/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradlew index 2fe81a7d..4f906e0c 100644 --- a/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradlew +++ b/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradlew.bat b/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradlew.bat index 62bd9b9c..107acd32 100644 --- a/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradlew.bat +++ b/templates/clojurephant-clj-app/src/main/resources/clj/new/clojurephant_clj_app/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/templates/clojurephant-clj-lib/build.gradle.kts b/templates/clojurephant-clj-lib/build.gradle.kts new file mode 100644 index 00000000..d670f0a4 --- /dev/null +++ b/templates/clojurephant-clj-lib/build.gradle.kts @@ -0,0 +1,4 @@ +plugins { + `clj-new-template` + `library-convention` +} diff --git a/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradle-wrapper.jar b/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradle-wrapper.jar index 490fda85..e708b1c0 100644 Binary files a/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradle-wrapper.jar and b/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradle-wrapper.jar differ diff --git a/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradle-wrapper.properties b/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradle-wrapper.properties index 4d9ca164..da9702f9 100644 --- a/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradle-wrapper.properties +++ b/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradlew b/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradlew index 2fe81a7d..4f906e0c 100644 --- a/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradlew +++ b/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradlew.bat b/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradlew.bat index 62bd9b9c..107acd32 100644 --- a/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradlew.bat +++ b/templates/clojurephant-clj-lib/src/main/resources/clj/new/clojurephant_clj_lib/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/templates/clojurephant-cljs-app/build.gradle.kts b/templates/clojurephant-cljs-app/build.gradle.kts new file mode 100644 index 00000000..d670f0a4 --- /dev/null +++ b/templates/clojurephant-cljs-app/build.gradle.kts @@ -0,0 +1,4 @@ +plugins { + `clj-new-template` + `library-convention` +} diff --git a/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradle-wrapper.jar b/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradle-wrapper.jar index 490fda85..e708b1c0 100644 Binary files a/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradle-wrapper.jar and b/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradle-wrapper.jar differ diff --git a/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradle-wrapper.properties b/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradle-wrapper.properties index 4d9ca164..da9702f9 100644 --- a/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradle-wrapper.properties +++ b/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradlew b/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradlew index 2fe81a7d..4f906e0c 100644 --- a/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradlew +++ b/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradlew.bat b/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradlew.bat index 62bd9b9c..107acd32 100644 --- a/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradlew.bat +++ b/templates/clojurephant-cljs-app/src/main/resources/clj/new/clojurephant_cljs_app/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell