Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #26 from arrow-kt/is-ide-reorg
Browse files Browse the repository at this point in the history
Re-org on #19
  • Loading branch information
i-walker authored May 14, 2020
2 parents dd00a8a + 37b4197 commit 0ed2204
Show file tree
Hide file tree
Showing 25 changed files with 485 additions and 107 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
cd hello-world/compiler-plugin
./gradlew clean :use-plugin:test :use-plugin:shadowJar
java -jar use-plugin/build/libs/use-plugin-all.jar
- name: Hello World Intellij IDEA Plugin example
- name: Hello World IDEA Plugin example
run: |
cd hello-world/ide-plugin
cd hello-world/cli-and-ide-plugin
./gradlew clean build
- name: Use of Arrow Meta Compiler Plugin with Gradle Plugin
run: |
Expand Down
39 changes: 0 additions & 39 deletions hello-world/build.gradle

This file was deleted.

11 changes: 11 additions & 0 deletions hello-world/cli-and-ide-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
id "org.jetbrains.kotlin.jvm" version "$KOTLIN_VERSION" apply false
id "com.github.johnrengelman.shadow" version "$SHADOW_JAR_VERSION" apply false
}

allprojects {
repositories {
mavenCentral()
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
}
38 changes: 38 additions & 0 deletions hello-world/cli-and-ide-plugin/compiler-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2019 The Arrow Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id "org.jetbrains.kotlin.jvm"
id "com.github.johnrengelman.shadow"
}

dependencies {
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION"
compileOnly "com.intellij:openapi:$OPENAPI_VERSION"
compileOnly "io.arrow-kt:compiler-plugin:$ARROW_META_VERSION"
}

compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-XXLanguage:+InlineClasses"]
jvmTarget = "$JVM_TARGET_VERSION"
}
}

shadowJar {
configurations = [project.configurations.compileOnly]
relocate 'org.jetbrains.kotlin.com.intellij', 'com.intellij'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.arrowkt.example

import arrow.meta.CliPlugin
import arrow.meta.Meta
import arrow.meta.invoke
import arrow.meta.quotes.Transform
import arrow.meta.quotes.namedFunction

val Meta.helloWorld: CliPlugin
get() =
"Hello World" {
meta(
namedFunction({ name == "helloWorld" }) { c ->
Transform.replace(
replacing = c,
newDeclaration =
"""|fun helloWorld(): Unit =
| println("Hello ΛRROW Meta!")
|""".function.syntheticScope
)
}
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.arrowkt.example

import arrow.meta.CliPlugin
import arrow.meta.Meta
import arrow.meta.phases.CompilerContext
import kotlin.contracts.ExperimentalContracts

class MetaPlugin : Meta {
@ExperimentalContracts
override fun intercept(ctx: CompilerContext): List<CliPlugin> =
listOf(
helloWorld
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.arrowkt.example.MetaPlugin
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ JVM_TARGET_VERSION=1.8
ARROW_VERSION=0.10.5
ARROW_META_VERSION=1.3.61-SNAPSHOT
SHADOW_JAR_VERSION=5.2.0
INTELLIJ_GRADLE_PLUGIN_VERSION=0.4.18
KOTLIN_IDEA_VERSION=1.3.61-release-IJ2019.3-1
INTELLIJ_IDEA_VERSION=2019.3.4
KOTLIN_IDEA_VERSION=1.3.61-release-IJ2019.3-1
INTELLIJ_GRADLE_PLUGIN_VERSION=0.4.18
OPENAPI_VERSION=7.0.3
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Wed Apr 22 22:53:19 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
22 changes: 19 additions & 3 deletions hello-world/gradlew → hello-world/cli-and-ide-plugin/gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
55 changes: 55 additions & 0 deletions hello-world/cli-and-ide-plugin/ide-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (C) 2020 The Arrow Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id "org.jetbrains.kotlin.jvm"
id "org.jetbrains.intellij" version "$INTELLIJ_GRADLE_PLUGIN_VERSION"
}

apply plugin: 'java'

dependencies {
implementation ("io.arrow-kt:idea-plugin:$ARROW_META_VERSION") {
exclude group: "io.arrow-kt", module: "compiler-plugin"
}
implementation project(path: ':compiler-plugin', configuration: 'shadow')
}

buildSearchableOptions.enabled = false

intellij {
version "$INTELLIJ_IDEA_VERSION"
pluginName = "Example"
plugins = ["gradle", "gradle-java", "java", "org.jetbrains.kotlin:${KOTLIN_IDEA_VERSION}"]
}

compileKotlin {
kotlinOptions.jvmTarget = "$JVM_TARGET_VERSION"
}

compileTestKotlin {
kotlinOptions.jvmTarget = "$JVM_TARGET_VERSION"
}

runIde {
jvmArgs '-Xmx2G'
}

patchPluginXml {
changeNotes """
Add change notes here.<br>
<em>most HTML tags may be used</em>"""
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<idea-plugin>
<id>mygroup.myartifact</id>
<name>My Ide Plugin</name>
<name>My Meta Ide Example</name>
<vendor email="support@yourlibrary.com" url="http://www.yourlibrary.com">YourLibrary</vendor>

<depends>com.intellij.gradle</depends>
Expand Down
2 changes: 2 additions & 0 deletions hello-world/cli-and-ide-plugin/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include ':compiler-plugin'
include ':ide-plugin'
2 changes: 1 addition & 1 deletion hello-world/compiler-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ allprojects {
mavenCentral()
maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
}
}
}
6 changes: 6 additions & 0 deletions hello-world/compiler-plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
KOTLIN_VERSION=1.3.61
KOTLIN_TEST_VERSION=3.4.2
JVM_TARGET_VERSION=1.8
ARROW_VERSION=0.10.5
ARROW_META_VERSION=1.3.61-SNAPSHOT
SHADOW_JAR_VERSION=5.2.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Wed Apr 22 22:53:19 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0ed2204

Please sign in to comment.