├── debug.keystore ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── publishPlugins.gradle ├── projectLocalRepo.gradle ├── codenarc.gradle ├── credentials.gradle ├── versionFile.gradle ├── bintray.gradle ├── androidGroovyLocal.gradle ├── artifactory.gradle ├── idea │ ├── codeStyle.xml │ └── idea.gradle ├── codenarc │ ├── codenarcTest.groovy │ └── codenarc.groovy └── publishing.gradle ├── groovy-android-sample-app ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── groovy │ │ │ └── groovyx │ │ │ │ └── example │ │ │ │ ├── GroovySampleApplication.groovy │ │ │ │ ├── GroovyImageService.groovy │ │ │ │ ├── BetterViewAnimator.groovy │ │ │ │ └── MainActivity.groovy │ │ └── AndroidManifest.xml │ ├── androidTest │ │ └── groovy │ │ │ └── groovyx │ │ │ └── example │ │ │ ├── AndroidTestHelper.groovy │ │ │ └── BetterViewAnimatorTest.groovy │ └── test │ │ └── groovy │ │ └── groovyx │ │ └── example │ │ └── GroovyImageServiceTest.groovy ├── proguard-rules.txt └── sample-app.gradle ├── gradle.properties ├── RELEASE.adoc ├── .github ├── CONTRIBUTING.md └── ISSUE_TEMPLATE.md ├── .editorconfig ├── .gitignore ├── groovy-android-gradle-plugin ├── src │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── gradle-plugins │ │ │ │ ├── groovyx.android.properties │ │ │ │ └── org.codehaus.groovy.android.properties │ │ └── groovy │ │ │ └── groovyx │ │ │ ├── api │ │ │ └── AndroidGroovySourceSet.groovy │ │ │ ├── internal │ │ │ ├── AndroidGroovySourceSetFactory.groovy │ │ │ └── DefaultAndroidGroovySourceSet.groovy │ │ │ ├── GroovyAndroidExtension.groovy │ │ │ └── GroovyAndroidPlugin.groovy │ └── test │ │ └── groovy │ │ └── groovyx │ │ ├── internal │ │ ├── AndroidFileHelper.groovy │ │ ├── TestProperties.groovy │ │ ├── AndroidPluginHelper.groovy │ │ └── FileHelper.groovy │ │ ├── functional │ │ ├── internal │ │ │ ├── FunctionalSpec.groovy │ │ │ └── AndroidFunctionalSpec.groovy │ │ ├── AnnotationProcessingSpec.groovy │ │ ├── SkipJavaCSpec.groovy │ │ ├── CompilationSpec.groovy │ │ ├── RenderScriptCompilationSpec.groovy │ │ ├── KotlinSupportSpec.groovy │ │ ├── FullCompilationSpec.groovy │ │ └── SourceSetSpec.groovy │ │ ├── GroovyAndroidExtensionSpec.groovy │ │ └── GroovyAndroidPluginSpec.groovy └── gradle-plugin.gradle ├── settings.gradle ├── .travis.yml ├── gradlew.bat ├── CHANGELOG.md ├── gradlew ├── README.adoc └── LICENSE.txt /debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/groovy/groovy-android-gradle-plugin/HEAD/debug.keystore -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/groovy/groovy-android-gradle-plugin/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/groovy/groovy-android-gradle-plugin/HEAD/groovy-android-sample-app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/groovy/groovy-android-gradle-plugin/HEAD/groovy-android-sample-app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/groovy/groovy-android-gradle-plugin/HEAD/groovy-android-sample-app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/groovy/groovy-android-gradle-plugin/HEAD/groovy-android-sample-app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/groovy/groovy-android-gradle-plugin/HEAD/groovy-android-sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.daemon=true 2 | org.gradle.jvmargs=-Xmx2G -Dfile.encoding=UTF-8 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled 3 | org.gradle.parallel=true 4 | org.gradle.caching=true 5 | -------------------------------------------------------------------------------- /RELEASE.adoc: -------------------------------------------------------------------------------- 1 | = How to Release 2 | 3 | . Prepare for release `./gradlew prepareRelease` 4 | . Update Version Number: remove -SNAPSHOT and commit the change 5 | . Run release task `./gradlew release` 6 | . Update Version Number in build.gradle and README.adoc (bump and put SNAPSHOT back) 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Feb 11 09:32:01 CET 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip 7 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | If you would like to contribute code to groovy-android-gradle-plugin you can do so through GitHub by 5 | forking the repository and sending a pull request. 6 | 7 | When submitting code, please make every effort to follow existing conventions 8 | and style in order to keep the code as readable as possible. Please also make 9 | sure your code compiles by running `./gradlew clean assemble check`. 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | # Change these settings to your own preference 10 | indent_style = space 11 | indent_size = 2 12 | 13 | # We recommend you to keep these unchanged 14 | end_of_line = lf 15 | charset = utf-8 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | 19 | [*.md] 20 | trim_trailing_whitespace = false 21 | indent_style = space 22 | -------------------------------------------------------------------------------- /gradle/publishPlugins.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.gradle.plugin-publish' 2 | 3 | pluginBundle { 4 | website = 'http://www.groovy-lang.org/' 5 | vcsUrl = 'https://github.com/groovy/groovy-android-gradle-plugin' 6 | tags = ['android', 'groovy', 'grooid', 'spock', 'application'] 7 | 8 | plugins { 9 | groovyAndroidPlugin { 10 | id = 'org.codehaus.groovy.android' 11 | displayName = 'Android Groovy Gradle Plugin' 12 | description = 'This plugin adds Groovy language support for Android applications and libraries.' 13 | tags = ['android', 'groovy', 'grooid', 'spock', 'application'] 14 | } 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /groovy-android-sample-app/proguard-rules.txt: -------------------------------------------------------------------------------- 1 | -dontobfuscate 2 | 3 | -keep class org.codehaus.groovy.vmplugin.** 4 | -keep class org.codehaus.groovy.runtime.dgm* 5 | 6 | -keepclassmembers class org.codehaus.groovy.runtime.dgm* {*;} 7 | -keepclassmembers class ** implements org.codehaus.groovy.runtime.GeneratedClosure {*;} 8 | -keepclassmembers class org.codehaus.groovy.reflection.GroovyClassValue* {*;} 9 | -keepclassmembers class groovyx.example.** {*;} 10 | -keepclassmembers class com.arasthel.swissknife.utils.Finder {*;} 11 | 12 | -dontwarn org.codehaus.groovy.** 13 | -dontwarn groovy** 14 | -dontnote org.codehaus.groovy.** 15 | -dontnote groovy** 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore version files written out by gradle 2 | groovy-android-gradle-plugin-version.txt 3 | 4 | #built application files 5 | *.apk 6 | *.ap_ 7 | 8 | # files for the dex VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # generated files 15 | bin/ 16 | gen/ 17 | 18 | # Local configuration file (sdk path, etc) 19 | local.properties 20 | 21 | # Windows thumbnail db 22 | Thumbs.db 23 | 24 | # OSX files 25 | .DS_Store 26 | 27 | # Eclipse project files 28 | .classpath 29 | .project 30 | 31 | # Android Studio 32 | .idea 33 | *.iml 34 | *.ipr 35 | *.iws 36 | .gradle 37 | build/ 38 | 39 | # Gradle Wrapper 40 | # Force include the wrapper jar 41 | !gradle/wrapper/gradle-wrapper.jar 42 | -------------------------------------------------------------------------------- /groovy-android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/groovyx.android.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016 the original author or authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | implementation-class=groovyx.GroovyAndroidPlugin 18 | -------------------------------------------------------------------------------- /groovy-android-gradle-plugin/src/main/resources/META-INF/gradle-plugins/org.codehaus.groovy.android.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2016 the original author or authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | implementation-class=groovyx.GroovyAndroidPlugin 18 | -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | Groovy Sample 20 | Load Image 21 | 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | What kind of issue is this? 2 | 3 | - [ ] Question. This issue tracker is not the place for questions. If you want to ask how to do 4 | something, or to understand why something isn't working the way you expect it to, use [Stack 5 | Overflow](https://stackoverflow.com/questions/tagged/groovy-android) with the android-groovy tag. 6 | 7 | - [ ] Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests 8 | get fixed. See [here](https://github.com/groovy/groovy-android-gradle-plugin/tree/master/gradle-groovy-android-plugin/src/test/groovy/groovyx) 9 | for some example tests. 10 | 11 | - [ ] Feature Request. Start by telling us what problem you’re trying to solve. Often a solution 12 | already exists! Don’t send pull requests to implement new features without first getting our 13 | support. Sometimes we leave features out on purpose to keep the project small. 14 | -------------------------------------------------------------------------------- /gradle/projectLocalRepo.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins.withType(MavenPlugin) { 18 | ext.localRepoUrl = new File(rootProject.buildDir, 'localrepo').toURI() 19 | 20 | install { 21 | repositories { 22 | mavenDeployer { 23 | repository(url: localRepoUrl) 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /gradle/codenarc.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | project.apply plugin: "codenarc" 18 | 19 | dependencies { 20 | codenarc 'org.codenarc:CodeNarc:1.0' 21 | } 22 | 23 | codenarc { 24 | configFile rootProject.file('gradle/codenarc/codenarc.groovy') 25 | } 26 | 27 | codenarcTest { 28 | configFile rootProject.file('gradle/codenarc/codenarcTest.groovy') 29 | } 30 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | include 'groovy-android-gradle-plugin' 18 | include 'groovy-android-sample-app' 19 | 20 | rootProject.name = 'groovy-android' 21 | 22 | def setBuildFile(projects) { 23 | projects.each { 24 | it.buildFileName = "${it.name}.gradle" - 'groovy-android-' 25 | setBuildFile(it.children) 26 | } 27 | } 28 | 29 | setBuildFile(rootProject.children) 30 | -------------------------------------------------------------------------------- /groovy-android-sample-app/src/androidTest/groovy/groovyx/example/AndroidTestHelper.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.example 18 | 19 | import android.content.Context 20 | import android.support.test.InstrumentationRegistry 21 | import groovy.transform.CompileStatic 22 | 23 | @CompileStatic 24 | trait AndroidTestHelper { 25 | final Context context = InstrumentationRegistry.context 26 | } 27 | -------------------------------------------------------------------------------- /gradle/credentials.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | ext.bintrayUsername = project.hasProperty('bintrayUsername')?project.getProperty('bintrayUsername'):System.getenv('BINTRAY_USER')?:'' 18 | ext.bintrayKey = project.hasProperty('bintrayKey')?project.getProperty('bintrayKey'):System.getenv('BINTRAY_KEY')?:'' 19 | ext.githubToken = project.hasProperty('githubToken')?project.getProperty('githubToken'):System.getenv('GITHUB_TOKEN') 20 | -------------------------------------------------------------------------------- /gradle/versionFile.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | task writeVersionNumberFile { 18 | def versionFile = file("src/main/resources/groovyx/groovy-android-gradle-plugin-version.txt") 19 | inputs.property "version", project.version 20 | outputs.file versionFile 21 | 22 | doFirst { 23 | assert versionFile.parentFile.mkdirs() || versionFile.parentFile.directory 24 | versionFile.text = project.version 25 | } 26 | } 27 | 28 | processResources.dependsOn writeVersionNumberFile 29 | -------------------------------------------------------------------------------- /groovy-android-gradle-plugin/src/main/groovy/groovyx/api/AndroidGroovySourceSet.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.api 18 | 19 | import org.gradle.api.tasks.GroovySourceSet 20 | 21 | /** 22 | * A {@code AndroidGroovySourceSet} represents a logical group of Java, and Groovy sources. 23 | */ 24 | interface AndroidGroovySourceSet extends GroovySourceSet { 25 | 26 | /** 27 | * Returns the name of this source set. 28 | * 29 | * @return The name. Never returns null. 30 | */ 31 | String getName() 32 | } 33 | -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/groovy/groovyx/example/GroovySampleApplication.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.example 18 | 19 | import android.app.Application 20 | import android.content.Context 21 | import groovy.transform.CompileStatic 22 | 23 | @CompileStatic 24 | class GroovySampleApplication extends Application { 25 | 26 | final GroovyImageService groovyImageService = new GroovyImageService() 27 | 28 | static GroovySampleApplication get(Context context) { 29 | return context.applicationContext as GroovySampleApplication 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/groovy/groovyx/example/GroovyImageService.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.example 18 | 19 | import groovy.transform.CompileStatic 20 | 21 | @CompileStatic 22 | class GroovyImageService { 23 | private static final String GROOVY_IMAGE_URL = 'https://raw.githubusercontent.com/apache/groovy/master/xdocs/images/groovy-logo.png' 24 | 25 | /** 26 | * @return Input stream that when consumed will retrieve the groovy logo. 27 | */ 28 | InputStream getGroovyImageInputStream() { 29 | return new URL(GROOVY_IMAGE_URL).newInputStream() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /gradle/bintray.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Handles publication of distributions to Bintray 18 | 19 | apply plugin: 'com.jfrog.bintray' 20 | 21 | bintray { 22 | user = bintrayUsername 23 | key = bintrayKey 24 | publications = ['mavenJava'] 25 | pkg { 26 | repo = 'gradle-plugins' 27 | name = project.name 28 | desc = 'Adds support for the Groovy language to Android' 29 | userOrg = 'groovy' 30 | licenses = ['Apache-2.0'] 31 | labels = ['android','groovy'] 32 | vcsUrl = 'https://github.com/groovy/groovy-android-gradle-plugin.git' 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | android: 4 | components: 5 | - tools 6 | - platform-tools 7 | - build-tools-28.0.3 8 | - android-28 9 | - extra-google-m2repository 10 | - extra-android-m2repository 11 | 12 | jdk: 13 | - oraclejdk8 14 | 15 | before_install: 16 | - cat /etc/hosts # optionally check the content *before* 17 | - sudo hostname "$(hostname | cut -c1-63)" 18 | - sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts 19 | - cat /etc/hosts # optionally check the content *after* 20 | - yes | sdkmanager "platforms;android-26" 21 | 22 | script: 23 | - travis_wait 30 ./gradlew -q -s -PbuildInfo.build.number=$TRAVIS_BUILD_NUMBER -PbuildInfo.buildUrl=https://travis-ci.org/${TRAVIS_REPO_SLUG}/builds/${TRAVIS_JOB_ID} -PbuildInfo.buildAgent.name=$USER -PbuildInfo.principal=$USER :groovy-android-sample-app:build 24 | - travis_wait 30 ./gradlew -q -s -Dscan -PbuildInfo.build.number=$TRAVIS_BUILD_NUMBER -PbuildInfo.buildUrl=https://travis-ci.org/${TRAVIS_REPO_SLUG}/builds/${TRAVIS_JOB_ID} -PbuildInfo.buildAgent.name=$USER -PbuildInfo.principal=$USER :groovy-android-gradle-plugin:build fullTest artifactoryPublish 25 | 26 | branches: 27 | except: 28 | - gh-pages 29 | 30 | cache: 31 | directories: 32 | - $HOME/.gradle 33 | -------------------------------------------------------------------------------- /groovy-android-sample-app/src/test/groovy/groovyx/example/GroovyImageServiceTest.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.example 18 | 19 | import spock.lang.Specification 20 | 21 | /** 22 | * Class to test the {@link GroovyImageService}. 23 | * 24 | * Note: There is no @CompileStatic because this is run on the JVM instead of Android, and there 25 | * for is not required. 26 | * 27 | * Note: this is not a good test, it's just a example of how to do JVM testing. 28 | */ 29 | class GroovyImageServiceTest extends Specification { 30 | 31 | def "should download groovy image"() { 32 | given: 33 | def imageService = new GroovyImageService() 34 | InputStream stream = imageService.groovyImageInputStream 35 | 36 | expect: 37 | assert stream != null 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /gradle/androidGroovyLocal.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | For projects using the groovy-android-gradle-plugin, replace the module dependencies with project dependencies 19 | so that they build against the source instead of the published versions. 20 | */ 21 | import groovyx.GroovyAndroidPlugin 22 | 23 | plugins.matching { it instanceof GroovyAndroidPlugin }.all { 24 | configurations.all { configuration -> 25 | def deps = dependencies.toList().findAll { it instanceof ModuleDependency && it.group == 'org.codehaus.groovy' && it.name == 'groovy-android-gradle-plugin' } 26 | deps.each { dependency -> 27 | dependencies.remove(dependency) 28 | project.dependencies { 29 | delegate."$configuration.name" project(":$dependency.name") 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /gradle/artifactory.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // handles distribution of snapshots to Artifactory (oss.jfrog.org) 18 | 19 | apply plugin: 'com.jfrog.artifactory' 20 | 21 | def targetRepo = project.version.endsWith('-SNAPSHOT')?'oss-snapshot-local':'oss-release-local' 22 | 23 | artifactory { 24 | contextUrl = 'http://oss.jfrog.org/artifactory' 25 | publish { 26 | repository { 27 | repoKey = targetRepo 28 | username = bintrayUsername 29 | password = bintrayKey 30 | } 31 | defaults { 32 | publications ('mavenJava') 33 | } 34 | } 35 | } 36 | 37 | artifactoryPublish { 38 | onlyIf { 39 | def pullRequest = System.getenv('TRAVIS_PULL_REQUEST') 40 | 41 | !pullRequest || pullRequest=='false' 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | 23 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /groovy-android-gradle-plugin/src/test/groovy/groovyx/internal/AndroidFileHelper.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.internal 18 | 19 | trait AndroidFileHelper implements FileHelper { 20 | /** 21 | * Creates a simple android manifest that will make the Android Plugin happy. 22 | */ 23 | void createSimpleAndroidManifest() { 24 | file('src/main/AndroidManifest.xml') << """ 25 | 26 | 28 | """.trim() 29 | } 30 | 31 | void createSimpleGroovyFile() { 32 | file('src/main/groovy/groovyx/Simple.groovy') << """ 33 | package groovyx 34 | 35 | import groovy.transform.CompileStatic 36 | 37 | @CompileStatic 38 | class Simple { 39 | void doWork() { 40 | 'Hello World' 41 | } 42 | } 43 | """ 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /groovy-android-gradle-plugin/src/test/groovy/groovyx/internal/TestProperties.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.internal 18 | 19 | // default values added to be able to run tests in intellij 20 | abstract class TestProperties { 21 | static boolean isAllTests() { 22 | return System.getProperty('allTests', 'false') == 'true' 23 | } 24 | 25 | static String getAndroidPluginVersion() { 26 | return System.getProperty('androidPluginVersion')?:'3.3.1' 27 | } 28 | 29 | static String getBuildToolsVersion() { 30 | return System.getProperty('buildToolsVersion')?:'28.0.3' 31 | } 32 | 33 | static int getCompileSdkVersion() { 34 | String prop = System.getProperty('compileSdkVersion') 35 | return Integer.parseInt(prop?:'28') 36 | } 37 | 38 | static String getKotlinVersion() { 39 | return System.getProperty('kotlinVersion')?:'1.3.21' 40 | } 41 | 42 | static String getGroovyVersion() { 43 | return System.getProperty('groovyVersion')?:'2.4.16' 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /groovy-android-gradle-plugin/src/main/groovy/groovyx/internal/AndroidGroovySourceSetFactory.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.internal 18 | 19 | import groovyx.api.AndroidGroovySourceSet 20 | import org.gradle.api.NamedDomainObjectFactory 21 | import org.gradle.api.model.ObjectFactory 22 | import org.gradle.internal.reflect.Instantiator 23 | 24 | /** 25 | * Factory to create {@link AndroidGroovySourceSet} object using an {@link Instantiator} to add 26 | * the DSL methods. 27 | */ 28 | class AndroidGroovySourceSetFactory implements NamedDomainObjectFactory { 29 | 30 | private final Instantiator instantiator 31 | private final ObjectFactory objects 32 | 33 | AndroidGroovySourceSetFactory(Instantiator instantiator, ObjectFactory objects) { 34 | this.instantiator = instantiator 35 | this.objects = objects 36 | } 37 | 38 | @Override AndroidGroovySourceSet create(String name) { 39 | return instantiator.newInstance(DefaultAndroidGroovySourceSet, name, objects) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /groovy-android-gradle-plugin/src/test/groovy/groovyx/internal/AndroidPluginHelper.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.internal 18 | 19 | import com.android.build.gradle.AppPlugin 20 | import com.android.build.gradle.LibraryPlugin 21 | import groovyx.GroovyAndroidExtension 22 | import groovyx.GroovyAndroidPlugin 23 | import org.gradle.api.Project 24 | 25 | trait AndroidPluginHelper { 26 | void applyAppPlugin() { 27 | project.pluginManager.apply(AppPlugin) 28 | createSourceDirs() 29 | project.pluginManager.apply(GroovyAndroidPlugin) 30 | } 31 | 32 | void applyLibraryPlugin() { 33 | project.pluginManager.apply(LibraryPlugin) 34 | createSourceDirs() 35 | project.pluginManager.apply(GroovyAndroidPlugin) 36 | } 37 | 38 | GroovyAndroidExtension getExtension() { 39 | project.extensions.getByType(GroovyAndroidExtension) 40 | } 41 | 42 | private void createSourceDirs() { 43 | def sourceSets = project.extensions.getByName('android').sourceSets 44 | sourceSets.each { 45 | project.file("src/$it.name/groovy").mkdirs() 46 | } 47 | } 48 | 49 | abstract Project getProject() 50 | } 51 | -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/groovy/groovyx/example/BetterViewAnimator.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package groovyx.example 18 | 19 | import android.content.Context 20 | import android.support.annotation.IdRes 21 | import android.util.AttributeSet 22 | import android.widget.ViewAnimator 23 | import groovy.transform.CompileStatic 24 | 25 | @CompileStatic 26 | class BetterViewAnimator extends ViewAnimator { 27 | BetterViewAnimator(Context context, AttributeSet attrs) { 28 | super(context, attrs) 29 | } 30 | 31 | /** Displays the view of the id passed in */ 32 | public void setDisplayedChildId(@IdRes int id) { 33 | if (displayedChildId == id) return 34 | 35 | def value = (0..(childCount - 1)).find { 36 | getChildAt(it as int).id == id 37 | } 38 | 39 | if (value != null) { 40 | displayedChild = value as int 41 | return 42 | } 43 | 44 | throw new IllegalArgumentException("No view with ID $id") 45 | } 46 | 47 | /** Get the id this ViewAnimator is currently displaying */ 48 | @IdRes public int getDisplayedChildId() { 49 | return getChildAt(displayedChild).id 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /groovy-android-sample-app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 25 | 26 | 32 | 33 | 40 | 41 |