ignoreUntrackedFiles with sbt-release plugin - scala

I'm trying to ignore my unversioned files for a release. This support ticket says that i just need to add the key ignoreUntrackedFiles := true into my Build.scala file.
When I do this, I get an error trying to build my project
[error] /home/chris/dev/scalacoin/project/Build.scala:19: not found: value ignoreUntrackedFiles
[error] ignoreUntrackedFiles := true,
I've added the plugin to my project, but my Build.scala file cannot find that key. How do I tell my Build.scala file about that plugin's key?

There is a big green 'open' button, indicating that that feature is an open pull request. I.e. it doesn't exist yet in the released plugin.

Related

Merge Project: Error while building merged project with error undefined compiler variable

I am using merge project feature of install4j.
I have created sub-project with one action in it. This action uses some compiler variables which are defined in same project(sub-project).
Now I have merged this project into main project, and created the link to an action from sub-project.
But when I try to build main project it gives error that variable used in action is not defined as shown below.
Build failed.
Cause: com.exe4j.b.z
When trying to process '${compiler:RegPath}': the variable 'RegPath' has not been defined. Stack trace:
com.exe4j.a.d: com.exe4j.b.z: When trying to process
'${compiler:RegPath}': the variable 'RegPath' has not been defined.
at com.install4j.b.i.b(ejt:175) at com.install4j.gui.b.run(ejt:100)
Caused by: com.exe4j.b.z: When trying to process
'${compiler:RegPath}': the variable 'RegPath' has not been defined.
at com.install4j.config.l.a(ejt:577) at
com.install4j.config.l.a(ejt:485) at
com.install4j.config.l.a(ejt:431) at com.install4j.b.c.f.a(ejt:84)
at com.install4j.b.c.f.a(ejt:87) at com.install4j.b.c.f.a(ejt:87)
at com.install4j.b.c.a.a(ejt:1079) at com.install4j.b.c.a.a(ejt:957)
at com.install4j.b.c.a.a(ejt:943) at com.install4j.b.c.a.a(ejt:925)
at com.install4j.b.c.a.a(ejt:762) at com.install4j.b.c.a.a(ejt:721)
at com.install4j.b.c.a.k(ejt:685) at com.install4j.b.c.a.b(ejt:227)
at com.install4j.b.c.a.a(ejt:133) at com.install4j.b.b.v.a(ejt:75)
at com.install4j.b.b.c(ejt:285) at com.install4j.b.b.a(ejt:141) at
com.install4j.b.i.a(ejt:413) at com.install4j.b.i.b(ejt:156) ... 1
more
Am I missing anything?
Project Files: Sub-Project Main Project
This is a bug that will be fixed in 7.0.9. Please contact support#ej-technologies.com to get a build where this is already fixed.

sbt task to increment project version

Is there an SBT task to increment a project's version?
Given an initial configuration of something like the following build.sbt
name := 'My Project'
organization := 'org.example'
version := '0.1.0'
and a versioning nomenclature of major.minor.patch, I was hoping for an SBT task like
> incrementVersionPatch
that would result in a version of 0.1.1.
(Ideally also the corresponding incrementVersionMinor and incrementVersionMajor.)
I feel like this must already exist but cannot find a way to do it.
I think what you need is sbt-release plugin that "provides a customizable release process that you can add to your project." with "the setting release-version-file, which is set to file("version.sbt") by default and points to $PROJECT_ROOT/version.sbt".

How to add some local maven repo url to global sbt, and make them be tried first?

I want to add some fast local maven repository url to sbt, say:
http://maven.example.com/public
I want to add it to "global", so that I don't need to add them to each of sbt project. And also want to be tried first when sbt downloading some jars.
But I can't find useful information to do this, how to do it?
(My sbt version is 0.13.1)
With the help of a friend, finally I found the solution:
create a new file ~/.sbt/repositories
add content like this:
[repositories]
local
my-maven-repo: http://example.org/repo
my-ivy-repo: http://example.org/ivy-repo/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]
See official doc: http://www.scala-sbt.org/0.13.2/docs/Detailed-Topics/Library-Management.html#override-all-resolvers-for-all-builds
Modify your global configuration file, which is normally located in ~/.sbt/0.13/global.sbt, if it's not there you can create it.
In the file add following line:
externalResolvers := { ("Fast Repo" at "http://maven.example.com/public") +: externalResolvers.value }
You can confirm it's working by executing show externalResolvers in any project to see the list of resolvers. Your newly added resolver should be first.

Custom Gradle Plugin ID not found

I'm writing a Gradle plugin and I'm failing to get the apply plugin: command to work in the Gradle script that uses the plugin. I'm using Gradle 1.1.
I've build the plugin with clean build and I'm attempting to add it to the Gradle build via a flat repo for now. That seems to be working but Gradle isn't picking up that there is a plugin with the ID test-plugin. The project name in the plugin's settings.gradle is test-plugin and the properties file in META-INF/gradle-plugins is also test-plugin.properties. I'm not sure where else I can specify the plugin ID.
The build.gradle file in the project that is using the test-plugin:
repositories {
flatDir name: 'libs', dirs: "../build/libs"
}
dependencies {
compile 'test:test-plugin:0.1'
}
apply plugin: 'test-plugin'
Error from Gradle:
What went wrong:
A problem occurred evaluating root project 'tmp'.
Plugin with id 'test-plugin' not found.
The plugin Jar has to be added as a build script dependency:
buildscript {
repositories { flatDir name: 'libs', dirs: "../build/libs" }
dependencies { classpath 'test:test-plugin:0.1' }
}
apply plugin: "test-plugin"
If you want to implement a plugin into your buildscript, then you have two options.
Option 1
apply plugin: YourCustomPluginClassName
Option 2
plugins {
id 'your.custom.plugin.id'
}
apply plugin: is used when specifying your plugin by its class name (ex. apply plugin: JavaPlugin)
plugins { } is used when specifying your plugin by its id (ex. plugins { id 'java' })
See Gradle Plugins by tutorialspoint for reference
If you choose Option 1, the your custom plugin will need to be brought into your build script by 1 of 3 ways.
You can code it directly within your Gradle build script.
You can put it under buildSrc (ex. buildSrc/src/main/groovy/MyCustomPlugin).
You can import your custom plugin as a jar in your buildscript method.
See Gradle Goodness by Mr. Haki for information about the buildscript method.
If you choose Option 2, then you need to create a plugin id. Create the following file buildSrc/src/main/resources/META-INF/gradle-plugins/[desired.plugin.id].properties.
Copy and paste implementation-class=package.namespace.YourCustomPluginClassName into your newly created .properties file. Replace package.namespace.YourCustomPluginClassName with the fully-qualified class name of your desired plugin class.
See Custom Plugins by Gradle for more info.
I also had the same problem with a custom plugin id not being found. In my case, I simply forgot to add the 'src/main/resources/META-INF/gradle-plugins' properties file. The name of the properties file must match the name of the plugin id with a '.properties' extension.
The file must contain a the line:
implementation-class=(your fully qualified plugin classpath)
That's the complete mechanism on how plugin id's get resolved to class names.
In addition the plugin needs to be added as a dependency as pointed out in the previous answer. The android documentation states that you should use a name associated with your unique domain name. I.e.: the name 'test-plugin' is not really in good form, but an id like 'com.foo.gradle.test-plugin' would be better.
Ensure that your top-level build.gradle uses the correct classpath to refer to the path to the built *.jar file.
Some plugins, like maven-publish, will build and save the jar to a specific location in mavenLocal, but the path may not be clear to see.
You should look at the file path of the jar file, and ensure it matches your classpath, but the mapping is not immediately obvious:
buildscript {
dependencies {
// This *MUST* match the local file path of the jar file in mavenLocal, which is:
// ~/.m2/repository/com/company/product/plugin/product-gradle-plugin/1.0/product-gradle-plugin-1.0.jar
classpath 'com.company.product.plugin:product-gradle-plugin:1.0'
}
}
Be careful not to use the wrong classpath, which can refer to a directory instead of the actual jar file; like this:
buildscript {
dependencies {
// This is wrong, because it refers to the mavenLocal FOLDER "product-gradle-plugin",
// instead of the jar FILE "product-gradle-plugin-1.0.jar"
// However, a gradle sync will still resolve it as a valid classpath!!
classpath 'com.company.product:product-gradle-plugin:1.0'
}
}
More info:
https://discuss.gradle.org/t/what-is-the-preferred-gradle-approach-to-locally-install-an-artifact-equivalent-to-mavens-install/5592
https://docs.gradle.org/current/userguide/publishing_maven.html
https://blog.codefx.org/tools/snapshots-gradle-maven-publish-plugin/
https://docs.gradle.org/current/userguide/custom_plugins.html#sec:custom_plugins_standalone_project
Adding to what #Bonifacio2 wrote this is a path META-INF/gradle-plugins and shows in IntelliJ as META-INF.gradle-plugins. At all costs don't make the stupid mistake I did creating this directly as a directory META-INF.gradle-plugins because you are based on another sample, and never works. Another tip is copying also from another intelliJ project as this is what is added: gradle-plugins.
hmm perhaps try;
configure <org.jsonschema2pojo.gradle.JsonSchemaExtension> {
this.sourceFiles = files("${project.rootDir}/schemas")
}

iphone: Building error precompiling app_prefix.pch

I dont know what happened to Xcode. I was debugging my app when after a while of writing some code I tried to compile and an error message appeared:
Building error precompiling app_prefix.pch
arm-apple-darwin9-gcc-4.2.1: te: no such file or directory
I had never this error before, and I am not sure how to solve it.
Did you move your [Project Name]_prefix.pch file ? If you moved it to say, a subdirectory of the project's parent, you need to open up the target Build settings for each of your targets by double clicking on them, do a search for "pch" in the build settings, and update the path to the .pch file.
For example, if you moved your .pch file to a subdirectory "Core" which is in the project parent, then you'd change "[Project Name]_prefix.pch" in the build settings to "Core/[Project Name]_prefix.pch".
Try to change the buid setting of the target in project propertys:
Change the option Precompile prefix header to "NO"